From 9ba9d933ec63ba4d5521df7710e5d3374ac036f7 Mon Sep 17 00:00:00 2001 From: azv Date: Wed, 31 Aug 2016 10:44:59 +0300 Subject: [PATCH] Fix fail on the Fillet unit test --- src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp index 059e6b005..d0f503aba 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Solver.cpp @@ -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(); -- 2.39.2