]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Modification of distance constraint changes the line direction (issue #874)
authorazv <azv@opencascade.com>
Tue, 1 Sep 2015 10:53:06 +0000 (13:53 +0300)
committerazv <azv@opencascade.com>
Wed, 2 Sep 2015 11:28:28 +0000 (14:28 +0300)
src/SketchSolver/SketchSolver_ConstraintDistance.cpp
src/SketchSolver/SketchSolver_ConstraintDistance.h

index d7313a49dfc9609d7fb5dad62dfa5b9b0469cce5..63bd0ae7ddbd2c3d2f8bffb7a278a8d245cda1bd 100644 (file)
@@ -91,9 +91,10 @@ void SketchSolver_ConstraintDistance::adjustConstraint()
     }
     std::shared_ptr<GeomAPI_XY> aLineVec = aPoints[2]->decreased(aPoints[1]);
     std::shared_ptr<GeomAPI_XY> aPtLineVec = aPoints[0]->decreased(aPoints[1]);
-    if (aPtLineVec->cross(aLineVec) * aConstraint.valA < 0.0) {
+    if (aPtLineVec->cross(aLineVec) * aConstraint.valA < 0.0 || myIsNegative) {
       aConstraint.valA *= -1.0;
       myStorage->updateConstraint(aConstraint);
+      myIsNegative = true;
     }
   }
 }
index ba1827208743f01e074cace7fcdf38680ea31b10..8c3a7ea5c5d663b5621212b3dd791b3193d33df7 100644 (file)
@@ -38,6 +38,7 @@ protected:
 private:
   int myType; ///< type of constraint (applicable: SLVS_C_PT_PT_DISTANCE, SLVS_C_PT_LINE_DISTANCE)
   double myPrevValue; ///< previous value of distance (for correct calculation of a distance sign)
+  bool myIsNegative;  ///< \c true, if the point if placed rightside of line direction (SLVS_C_PT_LINE_DISTANCE only)
 };
 
 #endif