From: El Hadi Moussi Date: Wed, 7 Aug 2024 07:48:28 +0000 (+0200) Subject: Use relative tolerance to check a match for the sphere X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f477219f8ef2cccb7096d80a3f3f77c56b06c3f7;p=tools%2Fmedcoupling.git Use relative tolerance to check a match for the sphere --- diff --git a/src/ShapeRecogn/AreasBuilder.cxx b/src/ShapeRecogn/AreasBuilder.cxx index 125c45bdb..e435c5d1e 100644 --- a/src/ShapeRecogn/AreasBuilder.cxx +++ b/src/ShapeRecogn/AreasBuilder.cxx @@ -264,9 +264,7 @@ bool AreasBuilder::doesItMatch(mcIdType areaId, mcIdType nodeId) const (areas->getK1(areaId) + areas->getK2(areaId)) / 2.0); double nodeKmoy = fabs( (nodes->getK1(nodeId) + nodes->getK2(nodeId)) / 2.0); - // TODO: Replace by relative tolerance - isMatching = (kmoy + TOL_MATCH_SPHERE > nodeKmoy) && - (nodeKmoy > kmoy - TOL_MATCH_SPHERE); + isMatching = fabs((nodeKmoy - kmoy) / kmoy) < TOL_MATCH_SPHERE; } break; case PrimitiveType::Cylinder: