Salome HOME
Unit tests for B-splines in the sketcher.
[modules/shaper.git] / src / GeomAPI / GeomAPI_BSpline2d.cpp
index de07f9299e1437c93baffa05d0c254cf61268d5b..d23633dfa4ccf6474a754a771c6932f14b3c4819 100644 (file)
 #define MY_BSPLINE (*(implPtr<Handle_Geom2d_BSplineCurve>()))
 
 
+static Handle_Geom2d_BSplineCurve* newBSpline2d(
+  const std::list<std::shared_ptr<GeomAPI_Pnt2d> >& thePoles,
+  const std::list<double>& theWeights,
+  const int theDegree,
+  const bool thePeriodic);
+
+
 static Handle_Geom2d_BSplineCurve* newBSpline2d(
     const std::list<std::shared_ptr<GeomAPI_Pnt2d> >& thePoles,
     const std::list<double>& theWeights,
@@ -34,6 +41,9 @@ static Handle_Geom2d_BSplineCurve* newBSpline2d(
     const int theDegree,
     const bool thePeriodic)
 {
+  if (theKnots.empty() || theMults.empty())
+    return newBSpline2d(thePoles, theWeights, theDegree, thePeriodic);
+
   // collect arrays of poles, weights, knots and multiplicities
   TColgp_Array1OfPnt2d aPoles(1, (int)thePoles.size());
   TColStd_Array1OfReal aWeights(1, (int)theWeights.size());
@@ -62,7 +72,7 @@ static Handle_Geom2d_BSplineCurve* newBSpline2d(
   return new Handle_Geom2d_BSplineCurve(aCurve);
 }
 
-static Handle_Geom2d_BSplineCurve* newBSpline2d(
+Handle_Geom2d_BSplineCurve* newBSpline2d(
     const std::list<std::shared_ptr<GeomAPI_Pnt2d> >& thePoles,
     const std::list<double>& theWeights,
     const int theDegree,