]> Creatis software - creaMaracasVisu.git/commitdiff
#3532 Split and order contours (Rotating Plane)
authorPablo Garzon <gapablo2001@gmail.com>
Fri, 28 Jul 2023 15:28:32 +0000 (17:28 +0200)
committerPablo Garzon <gapablo2001@gmail.com>
Fri, 28 Jul 2023 15:28:32 +0000 (17:28 +0200)
bbtk/src/bbcreaMaracasVisuShowNPoints_Tools.cxx

index bbac782899cbab4926f4a19c19f926824a55b746..46998f905f4005d5bab1c54be42ae38ce79ff963 100644 (file)
@@ -894,7 +894,6 @@ void ShowNPoints_Tools::SeparateSplines()
                        std::vector<std::vector<double>> pointsOver = pointsAroundPlane[0];
                        std::vector<std::vector<double>> pointsUnder = pointsAroundPlane[1];
                        std::vector<std::vector<double>> pointsOn = pointsAroundPlane[2];
-                       
                        //Calculate points where splines should intersect
                        double middlePoint[3];
                        if(intersectionTop.empty() && intersectionBottom.empty()){
@@ -1017,9 +1016,11 @@ std::vector<std::vector<std::vector<double>>> ShowNPoints_Tools::GetOrderedPoint
                        pointsOn.push_back(point);
                }
        }
+       
        ////////
        /// Check direction of points and reverse if needed.
        /// Always follows axis vector direction
+       /// remove points if size is less than or equal to 2
        ////////
        if(pointsUnder.size() > 2){
                vtkMath::Subtract(pointsUnder.front(), pointsUnder.back(), vector1);
@@ -1031,6 +1032,10 @@ std::vector<std::vector<std::vector<double>>> ShowNPoints_Tools::GetOrderedPoint
                        }
                }
        }
+       else{
+               pointsUnder.clear();
+       }
+       
        if(pointsOver.size() > 2){
                vtkMath::Subtract(pointsOver.front(), pointsOver.back(), vector1);
                double dot = vtkMath::Dot(vector1, rotAxis.data());
@@ -1041,6 +1046,9 @@ std::vector<std::vector<std::vector<double>>> ShowNPoints_Tools::GetOrderedPoint
                        }
                }
        }
+       else{
+               pointsOver.clear();
+       }
        
        std::vector<std::vector<std::vector<double>>> results = {pointsOver, pointsUnder, pointsOn};
        return results;