in approximate, don't autocorrect continuity. Explain requirements in UserDocu instead

This commit is contained in:
tomate44
2017-03-14 10:12:36 +01:00
committed by wmayer
parent 8da5ea5e2d
commit 645dc7d2ba
4 changed files with 2 additions and 19 deletions

View File

@@ -315,7 +315,7 @@ from the knots table of this B-Spline curve.</UserDocu>
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.

View File

@@ -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()) {

View File

@@ -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)

View File

@@ -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 {