Open
Conversation
The algorithm didn't work for the following 2 intersecting triangles:
float triangle1_pts[3][3]={{0,1000,0},{0,1000,1000},{1000,1000,1000}};
float triangle1_norm[3];
getNormal(triangle1_pts[0],triangle1_pts[1],triangle1_pts[2],triangle1_norm);
struct FACE* triangle1=makePolygonFace(3,triangle1_norm,triangle1_pts);
float triangle2_pts[3][3]={{375,775,625},{375,1025,625},{625,1025,625}};
float triangle2_norm[3];
getNormal(triangle2_pts[0],triangle2_pts[1],triangle2_pts[2],triangle2_norm);
struct FACE* triangle2=makePolygonFace(3,triangle2_norm,triangle2_pts);
result=classifyTriangleIntersect(triangle1,triangle2);
printf("Triangle1-Triangle2 Intersection Test Result: %d\n",result);
if (result)
triangleIntersectionPoints(triangle1,triangle2);
From in the paper: Let i,j,k,l be the intersection points of L with edges p1 r1, p1 q1, p2 q2, p2 r2 Also gives an accurate intersection line for triangle1: x: 0, y: 1000, z: 0 x: 0, y: 1000, z: 1000 x: 1000, y: 1000, z: 1000 triangle2: x: 375, y: 775, z: 375 x: 375, y: 1025, z: 375 x: 625, y: 1025, z: 375
Author
|
Another fix: From in the paper: Also gives an accurate intersection line for |
Swapping and rotating cannot be done at the same time. As you didn't put vertex 0 correct on the face2 yet, you cannot be sure to swap 1 and 2.
Author
|
Swapping and rotating cannot be done at the same time. As you didn't put vertex 0 correct on the face2 yet, you cannot be sure to swap 1 and 2. |
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.
The algorithm didn't work for the following 2 intersecting triangles: