From 1f4e6ad89974d1becc29ad7290cc8446ff126f04 Mon Sep 17 00:00:00 2001 From: Ajinkya Dahale Date: Wed, 6 Jul 2022 17:45:04 +0530 Subject: [PATCH] [Sketcher] Do regular drag for small B-splines Here, "small" means that the number of poles of the spline is so low that moving any piece of the curve without changing shape would require moving all the poles. In that case the rest of the algorithm in `initBSplinePieceMove()` only complicates the matter. --- src/Mod/Sketcher/App/Sketch.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Mod/Sketcher/App/Sketch.cpp b/src/Mod/Sketcher/App/Sketch.cpp index 4bbeb41f7d..c6a5e1f6e1 100644 --- a/src/Mod/Sketcher/App/Sketch.cpp +++ b/src/Mod/Sketcher/App/Sketch.cpp @@ -4040,11 +4040,16 @@ int Sketch::initBSplinePieceMove(int geoId, PointPos pos, const Base::Vector3d& return -1; } + GCS::BSpline &bsp = BSplines[Geoms[geoId].index]; + + // If spline has too few poles, just move all + if (bsp.poles.size() <= (bsp.degree + 1)) + return initMove(geoId, pos, fine); + // Find the closest knot auto partBsp = static_cast(Geoms[geoId].geo); double uNear; partBsp->closestParameter(firstPoint, uNear); - GCS::BSpline &bsp = BSplines[Geoms[geoId].index]; auto& knots = bsp.knots; auto upperknot = std::upper_bound( knots.begin(), knots.end(), uNear,