From: azv Date: Fri, 25 Dec 2015 14:24:56 +0000 (+0300) Subject: Update adjusting of the Angle constraint (issue #1181) X-Git-Tag: V_2.1.0~35 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=55baa15e9a78ff2b9de61f2034c4406197eff2eb;p=modules%2Fshaper.git Update adjusting of the Angle constraint (issue #1181) --- diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Builder.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Builder.cpp index 57537a056..1045b5ecc 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Builder.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Builder.cpp @@ -1084,15 +1084,15 @@ void adjustAngle(ConstraintWrapperPtr theConstraint) } } - if (aDir[0]->cross(aDir[1]) * aConstraint->value() < 0.0) + double anAngle = aLine[0]->direction()->angle(aLine[1]->direction()) / PI * 180; + if (anAngle * aConstraint->value() < 0.0) aConstraint->setValue(-aConstraint->value()); - - bool isChange = false; - for (int i = 0; i < 2; i++) - if (aLine[i]->direction()->dot(aDir[i]) < 0.0) - isChange = !isChange; - if (isChange) - aConstraint->setValue(180.0 - aConstraint->value()); + if ((90.0 - fabs(anAngle)) * (fabs(aConstraint->value()) - 90.0) > 0.0) { + if (aConstraint->value() < 0.0) + aConstraint->setValue(-180.0 - aConstraint->value()); + else + aConstraint->setValue(180.0 - aConstraint->value()); + } } ////void adjustMirror(ConstraintWrapperPtr theConstraint) diff --git a/src/SketchSolver/SketchSolver_ConstraintAngle.cpp b/src/SketchSolver/SketchSolver_ConstraintAngle.cpp index 2ed05b5a1..6138e3062 100644 --- a/src/SketchSolver/SketchSolver_ConstraintAngle.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintAngle.cpp @@ -23,8 +23,8 @@ void SketchSolver_ConstraintAngle::adjustConstraint() BuilderPtr aBuilder = SketchSolver_Manager::instance()->builder(); ConstraintWrapperPtr aConstraint = myStorage->constraint(myBaseConstraint).front(); - if (fabs(myAngle - aConstraint->value()) < aTol) - return; + //if (fabs(myAngle - aConstraint->value()) < aTol) + // return; myAngle = aConstraint->value(); aBuilder->adjustConstraint(aConstraint); myStorage->addConstraint(myBaseConstraint, aConstraint);