From 15216a35682b23f392a9454498b9fe8dd38843d4 Mon Sep 17 00:00:00 2001 From: azv Date: Tue, 12 Jul 2016 11:24:17 +0300 Subject: [PATCH] Remove legacy code adjusting the Angle constraint (issue #1615) --- .../SolveSpaceSolver_Builder.cpp | 64 +------------------ 1 file changed, 1 insertion(+), 63 deletions(-) diff --git a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Builder.cpp b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Builder.cpp index 9792467c1..b3fc9272e 100644 --- a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Builder.cpp +++ b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Builder.cpp @@ -696,70 +696,8 @@ void adjustAngle(ConstraintWrapperPtr theConstraint) std::shared_ptr anAngle(new GeomAPI_Angle2d(aLine[0], isReversed[0], aLine[1], isReversed[1])); std::shared_ptr aCenter = anAngle->center(); - std::shared_ptr aDir[2]; - Slvs_Constraint& aSlvsConstraint = aConstraint->changeConstraint(); - aSlvsConstraint.other = false; - for (int i = 0; i < 2; i++) { - aDir[i] = aLine[i]->direction(); - if (isReversed[i]) { - aSlvsConstraint.other = !aSlvsConstraint.other; - aDir[i]->reverse(); - } - } - - double aDist[2][2]; - for (int i = 0; i < 2; i++) { - for (int j = 0; j < 2; j++) { - aDist[i][j] = aDir[i]->xy()->dot(aPoints[i][j]->xy()->decreased(aCenter->xy())); - if (fabs(aDist[i][j]) <= tolerance) - aDist[i][j] = 0.0; - } - } - - // Recalculate positions of lines to avoid conflicting constraints - // while changing angle value several times - double cosA = cos(aConstraint->value() * PI / 180.0); - double sinA = sin(aConstraint->value() * PI / 180.0); - //if (aDir[0]->cross(aDir[1]) < 0.0) - // sinA *= -1.0; - int aLineToUpd = 1; - if (isFixed[1][0] && isFixed[1][1]) { - sinA *= -1.0; - aLineToUpd = 0; - } - double x = aDir[1-aLineToUpd]->x() * cosA - aDir[1-aLineToUpd]->y() * sinA; - double y = aDir[1-aLineToUpd]->x() * sinA + aDir[1-aLineToUpd]->y() * cosA; - - std::shared_ptr aNewPoints[2]; - for (int i = 0; i < 2; i++) { - aNewPoints[i] = std::shared_ptr( - new GeomAPI_Pnt2d(aCenter->x() + x * aDist[aLineToUpd][i], - aCenter->y() + y * aDist[aLineToUpd][i])); - } - - std::shared_ptr aDelta; - if (isFixed[aLineToUpd][0] && !isFixed[aLineToUpd][1]) - aDelta = aPoints[aLineToUpd][0]->xy()->decreased(aNewPoints[0]->xy()); - else if (!isFixed[aLineToUpd][0] && isFixed[aLineToUpd][1]) - aDelta = aPoints[aLineToUpd][1]->xy()->decreased(aNewPoints[1]->xy()); - if (aDelta) { - for (int i = 0; i < 2; i++) { - aNewPoints[i]->setX(aNewPoints[i]->x() + aDelta->x()); - aNewPoints[i]->setY(aNewPoints[i]->y() + aDelta->y()); - } - } - - // Update positions of points - std::list::const_iterator anUpdLine = aConstrLines.begin(); - if (aLineToUpd > 0) ++anUpdLine; - const std::list& anUpdPoints = (*anUpdLine)->subEntities(); - std::list::const_iterator aPIt = anUpdPoints.begin(); - for (int i = 0; aPIt != anUpdPoints.end(); ++aPIt, ++i) { - std::shared_ptr aPnt2D = - std::dynamic_pointer_cast((*aPIt)->baseAttribute()); - aPnt2D->setValue(aNewPoints[i]); - } + aSlvsConstraint.other = isReversed[0] != isReversed[1]; } void adjustMirror(ConstraintWrapperPtr theConstraint) -- 2.39.2