From 645dc7d2ba3d22204c9ecf7c6afbbc667e17726c Mon Sep 17 00:00:00 2001 From: tomate44 Date: Tue, 14 Mar 2017 10:12:36 +0100 Subject: [PATCH] in approximate, don't autocorrect continuity. Explain requirements in UserDocu instead --- src/Mod/Part/App/BSplineCurvePy.xml | 2 +- src/Mod/Part/App/BSplineCurvePyImp.cpp | 11 ----------- src/Mod/Part/App/BSplineSurfacePy.xml | 1 + src/Mod/Part/App/BSplineSurfacePyImp.cpp | 7 ------- 4 files changed, 2 insertions(+), 19 deletions(-) diff --git a/src/Mod/Part/App/BSplineCurvePy.xml b/src/Mod/Part/App/BSplineCurvePy.xml index e0c070935f..3ff72e7ca8 100644 --- a/src/Mod/Part/App/BSplineCurvePy.xml +++ b/src/Mod/Part/App/BSplineCurvePy.xml @@ -315,7 +315,7 @@ from the knots table of this B-Spline curve. points using variational smoothing algorithm, which tries to minimize additional criterium: LengthWeight*CurveLength + CurvatureWeight*Curvature + TorsionWeight*Torsion - Continuity must be C0, C1 or C2, else defaults to C2. + Continuity must be C0, C1(with DegMax >= 3) or C2(with DegMax >= 5). Parameters = list of floats : knot sequence of the approximated points. This argument is only used if the weights above are all null. diff --git a/src/Mod/Part/App/BSplineCurvePyImp.cpp b/src/Mod/Part/App/BSplineCurvePyImp.cpp index 0f6a932057..67e5100f9f 100644 --- a/src/Mod/Part/App/BSplineCurvePyImp.cpp +++ b/src/Mod/Part/App/BSplineCurvePyImp.cpp @@ -840,17 +840,6 @@ PyObject* BSplineCurvePy::approximate(PyObject *args, PyObject *kwds) if (weight1 || weight2 || weight3) { // It seems that this function only works with Continuity = C0, C1 or C2 - if (degMax < 3) { - c = GeomAbs_C0; - } - else if (degMax < 5) { - if (!(c == GeomAbs_C0)) { - c = GeomAbs_C1; - } - } - else if (!(c == GeomAbs_C0 || c == GeomAbs_C1 || c == GeomAbs_C2)) { - c = GeomAbs_C2; - } GeomAPI_PointsToBSpline fit(pnts, weight1, weight2, weight3, degMax, c, tol3d); Handle_Geom_BSplineCurve spline = fit.Curve(); if (!spline.IsNull()) { diff --git a/src/Mod/Part/App/BSplineSurfacePy.xml b/src/Mod/Part/App/BSplineSurfacePy.xml index b6df615ee7..a967328b2e 100644 --- a/src/Mod/Part/App/BSplineSurfacePy.xml +++ b/src/Mod/Part/App/BSplineSurfacePy.xml @@ -695,6 +695,7 @@ - X0, dX, Y0, dY (floats) with Points = 2Darray of floats - ParamType = 'Uniform','Centripetal' or 'ChordLength' - LengthWeight, CurvatureWeight, TorsionWeight (floats) + (with this smoothing algorithm, continuity C1 requires DegMax >= 3 and C2, DegMax >=5) Possible combinations : - approximate(Points, DegMin, DegMax, Continuity, Tolerance) diff --git a/src/Mod/Part/App/BSplineSurfacePyImp.cpp b/src/Mod/Part/App/BSplineSurfacePyImp.cpp index 1bccc18f76..949cd6cb3c 100644 --- a/src/Mod/Part/App/BSplineSurfacePyImp.cpp +++ b/src/Mod/Part/App/BSplineSurfacePyImp.cpp @@ -1329,13 +1329,6 @@ PyObject* BSplineSurfacePy::approximate(PyObject *args, PyObject *kwds) } else if (!(weight1 == 0) || !(weight2 == 0) || !(weight3 == 0)) { // one of the weights is not null, we use the smoothing algorithm - // adjust continuity for low values of degMax, instead of failing - if (degMax < 3) { - c = GeomAbs_C0; - } - else if ((degMax < 5) && (c == GeomAbs_C2)) { - c = GeomAbs_C1; - } surInterpolation.Init(interpolationPoints, weight1, weight2, weight3, degMax, c, tol3d); } else {