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();
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();