Skip to content

Commit

Permalink
add plausibility for self-intersectin check to filter out false-posit…
Browse files Browse the repository at this point in the history
…ives
  • Loading branch information
wwmayer committed Aug 8, 2016
1 parent aa2da87 commit 8d3e5a3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Mod/Mesh/App/Core/Elements.cpp
Expand Up @@ -808,6 +808,18 @@ 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];

// 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 plausability check is to verify that the intersection points
// are inside the bounding boxes of both triangles.
Base::BoundBox3f box1 = this->GetBoundBox();
if (!box1.IsInBox(rclPt0) || !box1.IsInBox(rclPt1))
return 0;

Base::BoundBox3f box2 = rclFacet.GetBoundBox();
if (!box2.IsInBox(rclPt0) || !box2.IsInBox(rclPt1))
return 0;

// Note: The algorithm delivers sometimes false-positives, i.e. it claims
// that the two triangles intersect but they don't. It seems that this bad
// behaviour occurs if the triangles are nearly co-planar
Expand Down

0 comments on commit 8d3e5a3

Please sign in to comment.