]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Update processing of the Angle constraint in the sketch solver connectors
authorazv <azv@opencascade.com>
Wed, 23 Mar 2016 11:05:59 +0000 (14:05 +0300)
committerazv <azv@opencascade.com>
Wed, 23 Mar 2016 11:05:59 +0000 (14:05 +0300)
src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Builder.cpp
src/SketchSolver/SketchSolver_Group.cpp
src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Builder.cpp

index 583c6540139405fabee0a7431ea91338e5b85410..9f92a1c4dbb7375117b75add97ba2735678e0faf 100644 (file)
@@ -1183,15 +1183,12 @@ void adjustAngle(ConstraintWrapperPtr theConstraint)
     }
   }
 
-  double anAngle = aLine[0]->direction()->angle(aLine[1]->direction()) / PI * 180;
-  if (anAngle * aConstraint->value() < 0.0)
-    aConstraint->setValue(-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());
-  }
+  bool isReversed = false;
+  for (int i = 0; i < 2; i++)
+    if (aLine[i]->direction()->dot(aDir[i]) < 0.0)
+      isReversed = !isReversed;
+  if (isReversed)
+    aConstraint->setValue(aConstraint->value() - 180.0);
 }
 
 void makeMirrorPoints(EntityWrapperPtr theOriginal,
index 3fad1d4ad4e2528eed0ffe1e4a57818866a1f88b..c0edad021f899af3bae506cf6ca24fb367f02618 100644 (file)
@@ -207,7 +207,7 @@ static void updateMultiConstraints(ConstraintConstraintMap& theConstraints, Feat
         && aCIt->second->isUsed(theFeature))
       std::dynamic_pointer_cast<SketchSolver_ConstraintMulti>(aCIt->second)->update(true);
     else if ((aType == CONSTRAINT_TANGENT_CIRCLE_LINE ||
-              aType == CONSTRAINT_SYMMETRIC)
+              aType == CONSTRAINT_SYMMETRIC || aType == CONSTRAINT_ANGLE)
              && aCIt->second->isUsed(theFeature))
       aCIt->second->update();
   }
index f080a9fcab404f1ef1ff8f30bde2c9917f360357..b277cd70733a06635426ac67e28f6cab89ba7b1d 100644 (file)
@@ -731,8 +731,8 @@ void adjustAngle(ConstraintWrapperPtr theConstraint)
   // 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;
+  //if (aDir[0]->cross(aDir[1]) < 0.0)
+  //  sinA *= -1.0;
   int aLineToUpd = 1;
   if (isFixed[1][0] && isFixed[1][1]) {
     sinA *= -1.0;
@@ -766,11 +766,9 @@ void adjustAngle(ConstraintWrapperPtr theConstraint)
   const std::list<EntityWrapperPtr>& anUpdPoints = (*anUpdLine)->subEntities();
   std::list<EntityWrapperPtr>::const_iterator aPIt = anUpdPoints.begin();
   for (int i = 0; aPIt != anUpdPoints.end(); ++aPIt, ++i) {
-    double aCoord[2] = {aNewPoints[i]->x(), aNewPoints[i]->y()};
-    const std::list<ParameterWrapperPtr>& aParams = (*aPIt)->parameters();
-    std::list<ParameterWrapperPtr>::const_iterator aParIt = aParams.begin();
-    for (int j = 0; aParIt != aParams.end(); ++j, ++aParIt)
-      (*aParIt)->setValue(aCoord[j]);
+    std::shared_ptr<GeomDataAPI_Point2D> aPnt2D =
+        std::dynamic_pointer_cast<GeomDataAPI_Point2D>((*aPIt)->baseAttribute());
+    aPnt2D->setValue(aNewPoints[i]);
   }
 }