]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Update adjusting of the Angle constraint (issue #1181)
authorazv <azv@opencascade.com>
Fri, 25 Dec 2015 14:24:56 +0000 (17:24 +0300)
committerazv <azv@opencascade.com>
Fri, 25 Dec 2015 14:25:30 +0000 (17:25 +0300)
src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Builder.cpp
src/SketchSolver/SketchSolver_ConstraintAngle.cpp

index 57537a0567a277872fcb6ed0e55c7b56b70584ae..1045b5ecc908dfb872ccc4f05cf698e609220142 100644 (file)
@@ -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)
index 2ed05b5a1db7b76da910143a30a950c9742dd682..6138e3062cf3cb2f0b00ca4d6935a7edd35900b2 100644 (file)
@@ -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);