]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix fail on the Fillet unit test
authorazv <azv@opencascade.com>
Wed, 31 Aug 2016 07:44:59 +0000 (10:44 +0300)
committerazv <azv@opencascade.com>
Wed, 31 Aug 2016 07:44:59 +0000 (10:44 +0300)
src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp

index 059e6b005c379dd8aaa4f712bd729b9bd445c455..d0f503aba13e3b6764d3a917a1b3e8d42978a8a4 100644 (file)
@@ -212,7 +212,7 @@ GCS::SolveStatus PlaneGCSSolver_Solver::solveWithoutTangent()
 bool PlaneGCSSolver_Solver::isTangentTruth(GCS::Constraint* theTangent) const
 {
   static const double aTol = 1e-5;
-  static const double aTol2 = aTol *aTol;
+  double aTol2 = aTol *aTol;
 
   if (theTangent->getTypeId() == GCS::TangentCircumf) {
     GCS::VEC_pD aParams = theTangent->params();
@@ -221,8 +221,9 @@ bool PlaneGCSSolver_Solver::isTangentTruth(GCS::Constraint* theTangent) const
     double aDist2 = dx * dx + dy * dy;
     double aRadSum  = *(aParams[4]) + *(aParams[5]);
     double aRadDiff = *(aParams[4]) - *(aParams[5]);
-    return fabs(aDist2 - aRadSum * aRadSum) <= aTol2 * aDist2 ||
-           fabs(aDist2 - aRadDiff * aRadDiff) <= aTol2 * aDist2;
+    aTol2 *= aDist2 > 1.0 ? aDist2 : 1.0;
+    return fabs(aDist2 - aRadSum * aRadSum) <= aTol2 ||
+           fabs(aDist2 - aRadDiff * aRadDiff) <= aTol2;
   }
   if (theTangent->getTypeId() == GCS::P2LDistance) {
     GCS::VEC_pD aParams = theTangent->params();