]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Use relative tolerance to check a match for the sphere
authorEl Hadi Moussi <moussi@phimeca.com>
Wed, 7 Aug 2024 07:48:28 +0000 (09:48 +0200)
committerEl Hadi Moussi <moussi@phimeca.com>
Wed, 7 Aug 2024 07:48:28 +0000 (09:48 +0200)
src/ShapeRecogn/AreasBuilder.cxx

index 125c45bdb5c78cba4b91d9751b4c9cf6a244e381..e435c5d1e3baafa0160a45c76edc0b1ce75a2963 100644 (file)
@@ -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: