From 11f89dd6416a6708060fa55d4a290394581157b9 Mon Sep 17 00:00:00 2001 From: Ajinkya Dahale Date: Tue, 31 Aug 2021 11:11:11 -0400 Subject: [PATCH] [Mesh] Skip false positive tests for coplanar self-intersections Fixes issue #4732. Within the code, a different algorithm is used for intersection checks when faces are found to be coplanar. That algorithm does not return the "intersection line", which is used to remove false-positives. This however results in false-negatives. --- src/Mod/Mesh/App/Core/Elements.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Mod/Mesh/App/Core/Elements.cpp b/src/Mod/Mesh/App/Core/Elements.cpp index 23e9ef6f2df8..2775fd8d30eb 100644 --- a/src/Mod/Mesh/App/Core/Elements.cpp +++ b/src/Mod/Mesh/App/Core/Elements.cpp @@ -988,6 +988,12 @@ int MeshGeomFacet::IntersectWithFacet (const MeshGeomFacet& rclFacet, rclPt0.x = isectpt1[0]; rclPt0.y = isectpt1[1]; rclPt0.z = isectpt1[2]; rclPt1.x = isectpt2[0]; rclPt1.y = isectpt2[1]; rclPt1.z = isectpt2[2]; + // Note: tri_tri_intersect_with_isection() does not return line of + // intersection when triangles are coplanar. See tritritest.h:18 and 658. + // So rclPt* may be garbage values and we cannot continue. + if (coplanar) + return 2; // equivalent to rclPt0 != rclPt1 + // With extremely acute-angled triangles it may happen that the algorithm // claims an intersection but the intersection points are far outside the // model. So, a plausibility check is to verify that the intersection points