From 12af6d8df76070408d14574eb65ede9c27a51d8d Mon Sep 17 00:00:00 2001 From: azv Date: Wed, 11 Jan 2017 08:57:49 +0300 Subject: [PATCH] Fix problem with jumping sketch while movement (issue #1446) --- .../PlaneGCSSolver/PlaneGCSSolver_Solver.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp index b1097be97..a16a3bbde 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp @@ -127,6 +127,7 @@ SketchSolver_SolveStatus PlaneGCSSolver_Solver::solve() // Additionally check redundant constraints if (aResult == GCS::Success || aResult == GCS::Converged) { + bool isSolveWithoutTangent = !aRedundantID.empty(); GCS::VEC_I aRedundantLocal; myEquationSystem->getRedundant(aRedundantLocal); aRedundantID.insert(aRedundantID.end(), aRedundantLocal.begin(), aRedundantLocal.end()); @@ -137,7 +138,15 @@ SketchSolver_SolveStatus PlaneGCSSolver_Solver::solve() // if the entities are coupled smoothly. // Sometimes tangent constraints are fall to both conflicting and redundant constraints. // Need to check if there are redundant constraints without these tangencies. - if (!aRedundantID.empty()) + if (!aRedundantID.empty() && !isSolveWithoutTangent) { + GCS::VEC_I::iterator aCIt = aRedundantID.begin(); + for (; aCIt != aRedundantID.end(); ++ aCIt) + if (myTangent.find(*aCIt) != myTangent.end()) { + isSolveWithoutTangent = true; + break; + } + } + if (isSolveWithoutTangent) aResult = myTangent.empty() ? GCS::Failed : solveWithoutTangent(); else aResult = GCS::Success; -- 2.39.2