+ double firstPoint[3], secPoint[3], contrPoint[3];
+ points->GetPoint(firstPointId, firstPoint);
+ points->GetPoint(secPointId, secPoint);
+
+ double firstVect[3], secVect[3], normal[3], contrVect[3];
+
+ vtkMath::Subtract(firstPoint, centroid, firstVect);
+ vtkMath::Subtract(secPoint, centroid, secVect);
+
+ points->GetPoint(contrPointId, contrPoint);
+ vtkMath::Subtract(contrPoint, centroid, contrVect);
+
+ vtkMath::Cross(firstVect, secVect, normal);
+ double dotCalc;
+ dotCalc = vtkMath::Dot(normal, contrVect);
+
+ return dotCalc<0;
+}
+
+/**
+* Checks if the order of the points represent a curved spline (U shape) or the points resemble a straight spline.
+* Now it checks the angle between each point and the vector that goes from the last point to the first.
+*
+* Previous version checked the curvature between 3 points in the spline, but this created problems when the straight lines
+* had curves in the middle, increasing the curvature although they are not in the U shape.
+*/
+bool CreateMeshFromPoints::CheckLinePointOrder(){
+ int sizePoints = bbGetInputLstX().size();
+ std::vector<int> lstIndexs = bbGetInputLstIndexs();
+ double point1[3], point2[3], point3[3];
+ double center[3];
+ double firstAngleSum = 0;
+ double secondAngleSum = 0;
+
+ points->GetPoint(0, point1);
+ points->GetPoint((lstIndexs[0]-1), point3);
+ double firstVect[3];
+ double secVect[3];
+ vtkMath::Subtract(point3, point1, firstVect);
+ for(int i = 0; i < lstIndexs[0]; i++){
+ points->GetPoint(i, point2);
+ vtkMath::Subtract(point2, point1, secVect);
+ firstAngleSum += vtkMath::SignedAngleBetweenVectors(firstVect, secVect, firstVect);