Find if two triangles intersect in 3D environment

  • Thread starter Thread starter NotASmurf
  • Start date Start date
  • Tags Tags
    3d Triangles
Click For Summary
To determine if two triangles intersect in a 3D environment, start by obtaining the equations of the planes containing the triangles. Compute the line of intersection of these planes using the cross product of their normals to find the direction, and then solve for a point on the line by setting one coordinate to zero. Check for intersection points of this line with each triangle; if either triangle misses, they do not overlap. If both triangles intersect, define intervals from the intersection points and check for overlap to confirm if the triangles intersect. Special cases, such as parallel planes or coinciding triangles, should be accounted for in the algorithm.
NotASmurf
Messages
150
Reaction score
2
Hey all, I need to know when two triangles intersect in a 3D environment, given the 3 points. Any help apreciate have been stuck on this for a long time,
 
Mathematics news on Phys.org
NotASmurf said:
Hey all, I need to know when two triangles intersect in a 3D environment, given the 3 points. Any help apreciate have been stuck on this for a long time,
It is a tedious process.
Step one. Get the equations of the planes containing the triangles.
Step two. Compute the line of intersection of these planes.
Step three. Find the points of intersection of this line with each of these triangles. If either miss you are done, since the triangles can't overlap.
Step four. These intersection points define a pair of intervals (one for each triangle). If the intervals overlap, the triangles overlap along this overlap interval. Otherwise they do not overlap.
 
mathman said:
Step two. Compute the line of intersection of these planes.
How does one do that? I know gettign the cross product of the normals will get the direction but How would one find a point on both? if there's an algorithmic way that woudl be great as this is for a program I am writing.
 
NotASmurf said:
How does one do that? I know gettign the cross product of the normals will get the direction but How would one find a point on both? if there's an algorithmic way that woudl be great as this is for a program I am writing.
Take the two equations for the planes. Arbitrarily set one coordinate to 0. Now you have 2 equations in 2 unknown coordinates. Solving will give you the other 2 coordinates for that point.
 
Are you given three points per each triangle? ie six points total?

Also are you finding IF they intersect or WHERE they intersect?

You know that the triangles exist on specific planes, and that planes stretch to infinity. One way to determine if the triangles DO NOT intersect is to determine if the normal vectors of each triangle-plane are parallel. If the normal vectors are not parallel, then the triangles might intersect. At which point, you need to determine if the lines/vectors formed by the sides of any triangle intersect the area of the other triangle.

For coding purposes/idiot proofing a special circumstance you might want to keep in mind is if the distance between the planes and or triangles is zero... which means you're analyzing the same area.
 
NotASmurf said:
How does one do that? I know gettign the cross product of the normals will get the direction but How would one find a point on both? if there's an algorithmic way that woudl be great as this is for a program I am writing.
If you intend to write a computer code, you must take care of special cases. The planes may be parallel. The line of intersection may be constant in one or two coordinates.
 
Here is a little puzzle from the book 100 Geometric Games by Pierre Berloquin. The side of a small square is one meter long and the side of a larger square one and a half meters long. One vertex of the large square is at the center of the small square. The side of the large square cuts two sides of the small square into one- third parts and two-thirds parts. What is the area where the squares overlap?

Similar threads

  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 59 ·
2
Replies
59
Views
34K
  • · Replies 38 ·
2
Replies
38
Views
4K
Replies
1
Views
2K
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K