Repository navigation
Fix false intersections for coplanar triangles with collinear edges - #113
Open
clintmorris229 wants to merge 1 commit into
Open
clintmorris229 wants to merge 1 commit into
clintmorris229 wants to merge 1 commit into
Conversation
edge_edge_test computed its cross products in float. For collinear edges, rounding left small equal values in f, d and e that passed the general-case check as a crossing, so coplanar triangles that don't touch were reported as intersecting and IsManifold flagged valid meshes (SarahWeiii#89). Compute the test in at least double so these rounding errors are negligible.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #89.
edge_edge_test, used bycoplanar_tri_tri, computed its cross products in float. For two collinear edges,f,dandeshould be 0, but rounding left small, equal values (e.g. all ≈ −2.3e-10). Those passed the general-case check as a crossing at the edges' endpoints. The collinear branch, which would correctly find no overlap, only runs afterwards, with an absolute tolerance smaller than the noise. As a result,TriangleIntersects::trianglereported intersections between coplanar triangles that don't touch, andIsManifoldflagged valid meshes as self-intersecting, triggering unnecessary preprocessing. Which inputs trigger it depends on FMA contraction: the example in #89 fails only with FMA; the one below fails only without.This change computes the edge-edge test in at least double. For float inputs, that makes rounding errors in
f,dandenegligible, so collinear and nearly collinear edges are classified correctly. Double inputs are unchanged.Repro (returns
1 1before,0 0after):Testing, against an exact 2D reference, with and without
-mfma -ffp-contract=fast: