From 68d67ecb8750c6669f549e2fdc59aa04859466fd Mon Sep 17 00:00:00 2001 From: Ajinkya Dahale Date: Fri, 10 Mar 2023 00:41:47 +0530 Subject: [PATCH] [Sketcher][planegcs] Fix knot position in non-uniform B-spline The default factors set in `addConstraintInternalAlignmentKnotPoint` does not work if the knots around a C1 knot are not equally far. --- src/Mod/Sketcher/App/planegcs/GCS.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Mod/Sketcher/App/planegcs/GCS.cpp b/src/Mod/Sketcher/App/planegcs/GCS.cpp index 0ee8e39366..33ab6f5541 100644 --- a/src/Mod/Sketcher/App/planegcs/GCS.cpp +++ b/src/Mod/Sketcher/App/planegcs/GCS.cpp @@ -1397,9 +1397,9 @@ int System::addConstraintInternalAlignmentKnotPoint(BSpline &b, Point &p, unsign // Calculate the factors to be passed to weighted linear combination constraint. // The if condition has a small performance benefit, but that is not why it is here. - // One case when numpoles <= 2 is for the last knot of a non-periodic B-spline. + // One case when numpoles <= 1 is for the last knot of a non-periodic B-spline. // In this case, the interval `k` passed to `getLinCombFactor` is degenerate, and this is the cleanest way to handle it. - if (numpoles > 2) + if (numpoles > 1) for (size_t i = 0; i < numpoles; ++i) factors[i] = b.getLinCombFactor(*(b.knots[knotindex]), startpole + b.degree, startpole + i);