From 977c1a15cd8c5a625686dea1c9115374ca98d640 Mon Sep 17 00:00:00 2001
From: florian maurin <florian@coreform.com>
Date: Sun, 8 Mar 2020 09:33:07 -0600
Subject: [PATCH] Fix the point order in GenerateBezier/LagrangeCurves

(cherry picked from commit da432c3d77919b12cb12c4af283cec2be6d59d16)
---
 Filters/Sources/vtkCellTypeSource.cxx | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Filters/Sources/vtkCellTypeSource.cxx b/Filters/Sources/vtkCellTypeSource.cxx
index ad24e2d13bc..f1b93472450 100644
--- a/Filters/Sources/vtkCellTypeSource.cxx
+++ b/Filters/Sources/vtkCellTypeSource.cxx
@@ -1237,13 +1237,13 @@ void vtkCellTypeSource::GenerateLagrangeCurves(vtkUnstructuredGrid* output, int
     output->GetPoint(i + 1, p1.GetData());
     dp = p1 - p0;
     conn[0] = i;
-    conn[this->CellOrder] = i + 1;
+    conn[1] = i + 1;
     double denom = static_cast<double>(this->CellOrder);
     for (int j = 1; j < this->CellOrder; ++j)
     {
       pm = p0 + (static_cast<double>(j) / denom) * dp;
       vtkIdType innerPointId = points->InsertNextPoint(pm.GetData());
-      conn[j] = innerPointId;
+      conn[j + 1] = innerPointId;
     }
     output->InsertNextCell(VTK_LAGRANGE_CURVE, this->CellOrder + 1, &conn[0]);
   }
@@ -1719,13 +1719,13 @@ void vtkCellTypeSource::GenerateBezierCurves(vtkUnstructuredGrid* output, int ex
     output->GetPoint(i + 1, p1.GetData());
     dp = p1 - p0;
     conn[0] = i;
-    conn[this->CellOrder] = i + 1;
+    conn[1] = i + 1;
     double denom = static_cast<double>(this->CellOrder);
     for (int j = 1; j < this->CellOrder; ++j)
     {
       pm = p0 + (static_cast<double>(j) / denom) * dp;
       vtkIdType innerPointId = points->InsertNextPoint(pm.GetData());
-      conn[j] = innerPointId;
+      conn[j + 1] = innerPointId;
     }
     output->InsertNextCell(VTK_BEZIER_CURVE, this->CellOrder + 1, &conn[0]);
   }
-- 
GitLab