]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Workaround to check false-positive conflicting constraints during fillet operation...
authorazv <azv@opencascade.com>
Thu, 24 Nov 2016 12:15:06 +0000 (15:15 +0300)
committerazv <azv@opencascade.com>
Thu, 24 Nov 2016 12:15:06 +0000 (15:15 +0300)
src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp
src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.h

index 9a67936ffbaf2da5e9c7f9ddd6029b0ef631d783..b1097be9716f9cdbf3e34dfe914ffa180eb4478b 100644 (file)
@@ -9,6 +9,22 @@
 
 #include <cmath>
 
+// remove indices of all point-point coincidences from the vector
+static void removePtPtCoincidences(const ConstraintMap& theConstraints, GCS::VEC_I& theVecToClear)
+{
+  ConstraintMap::const_iterator aCIt = theConstraints.begin();
+  for (; aCIt != theConstraints.end(); ++aCIt) {
+    if (aCIt->second != CONSTRAINT_PT_PT_COINCIDENT)
+      continue;
+    GCS::VEC_I::iterator aRIt = theVecToClear.begin();
+    for (; aRIt != theVecToClear.end(); ++aRIt)
+      if (aCIt->first->getTag() == *aRIt) {
+        theVecToClear.erase(aRIt);
+        break;
+      }
+  }
+}
+
 
 PlaneGCSSolver_Solver::PlaneGCSSolver_Solver()
   : myEquationSystem(new GCS::System),
@@ -115,19 +131,8 @@ SketchSolver_SolveStatus PlaneGCSSolver_Solver::solve()
     myEquationSystem->getRedundant(aRedundantLocal);
     aRedundantID.insert(aRedundantID.end(), aRedundantLocal.begin(), aRedundantLocal.end());
     // Workaround: remove all point-point coincidences from list of redundant
-    if (!aRedundantID.empty()) {
-      ConstraintMap::const_iterator aCIt = myConstraints.begin();
-      for (; aCIt != myConstraints.end(); ++aCIt) {
-        if (aCIt->second != CONSTRAINT_PT_PT_COINCIDENT)
-          continue;
-        GCS::VEC_I::iterator aRIt = aRedundantID.begin();
-        for (; aRIt != aRedundantID.end(); ++aRIt)
-          if (aCIt->first->getTag() == *aRIt) {
-            aRedundantID.erase(aRIt);
-            break;
-          }
-      }
-    }
+    if (!aRedundantID.empty())
+      removePtPtCoincidences(myConstraints, aRedundantID);
     // The system with tangent constraints may show redundant constraints
     // if the entities are coupled smoothly.
     // Sometimes tangent constraints are fall to both conflicting and redundant constraints.
@@ -185,8 +190,11 @@ GCS::SolveStatus PlaneGCSSolver_Solver::solveWithoutTangent()
   if (aResult == GCS::Success) {
     GCS::VEC_I aRedundant;
     aSystemWithoutTangent->getRedundant(aRedundant);
-    if (!aRedundant.empty())
-      aResult = GCS::Failed;
+    if (!aRedundant.empty()) {
+      removePtPtCoincidences(myConstraints, aRedundant);
+      if (!aRedundant.empty())
+        aResult = GCS::Failed;
+    }
   }
 
   // additional check that removed constraints are still correct
@@ -196,8 +204,13 @@ GCS::SolveStatus PlaneGCSSolver_Solver::solveWithoutTangent()
     for (; aRemIt != aRemovedTangent.end(); ++aRemIt)
       if (!isTangentTruth(*aRemIt))
         break;
-    if (aRemIt != aRemovedTangent.end())
+    if (aRemIt != aRemovedTangent.end()) {
       aResult = (GCS::SolveStatus)myEquationSystem->solve(myParameters);
+      if (aResult != GCS::Failed) {
+        aSystemWithoutTangent = myEquationSystem;
+        aResult = GCS::Success;
+      }
+    }
   }
 
   if (aResult == GCS::Success)
index 525af68ad7d8cb704964cedf19dcc34d286ada6f..c32d2daf6b55ebc9480067a3d8b6d8cb231f0a94 100644 (file)
@@ -13,6 +13,8 @@
 
 #include <GCS.h>
 
+typedef std::map<GCS::Constraint*, SketchSolver_ConstraintType> ConstraintMap;
+
 /**
  * The main class that performs the high-level operations for connection to the PlaneGCS.
  */
@@ -76,8 +78,6 @@ private:
   bool isTangentTruth(GCS::Constraint* theTangent) const;
 
 private:
-  typedef std::map<GCS::Constraint*, SketchSolver_ConstraintType> ConstraintMap;
-
   GCS::VEC_pD                  myParameters;     ///< list of unknowns
 
   /// list of constraints already processed by the system