From 7628a2b34c6b45206aea13f789cc4784cbae4347 Mon Sep 17 00:00:00 2001 From: azv Date: Fri, 29 Dec 2017 08:32:19 +0300 Subject: [PATCH] Fix the problem related to incorrect DoF calculation while moving any element of a sketch --- src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp index aaf98ef90..09c18b1f9 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp @@ -237,12 +237,15 @@ void PlaneGCSSolver_Solver::addFictiveConstraintIfNecessary() if (myFictiveConstraint) return; // no need several fictive constraints + int aDOF = myDOF; double* aParam = createParameter(); double* aFictiveParameter = new double(0.0); myFictiveConstraint = new GCS::ConstraintEqual(aFictiveParameter, aParam); myFictiveConstraint->setTag(CID_FICTIVE); myEquationSystem->addConstraint(myFictiveConstraint); + // DoF should not be changed when adding fictive constraint + myDOF = aDOF; } void PlaneGCSSolver_Solver::removeFictiveConstraint() @@ -250,7 +253,6 @@ void PlaneGCSSolver_Solver::removeFictiveConstraint() if (myFictiveConstraint) { myEquationSystem->removeConstraint(myFictiveConstraint); myParameters.pop_back(); - --myDOF; GCS::VEC_pD aParams = myFictiveConstraint->params(); for (GCS::VEC_pD::iterator anIt = aParams.begin(); anIt != aParams.end(); ++ anIt) -- 2.39.2