- #1
NotASmurf
- 150
- 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,
It is a tedious process.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,
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.mathman said:Step two. Compute the line of intersection of these planes.
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.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.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.
To determine if two triangles intersect in a 3D environment, you will need to use a mathematical formula called the Moller-Trumbore intersection algorithm. This algorithm takes the coordinates of the two triangles and calculates the intersection point, if any. If the intersection point falls within the boundaries of both triangles, then they intersect.
You will need the coordinates of all three points for each triangle. This includes the x, y, and z coordinates for each point. You will also need the normal vector for each triangle, which is a vector that is perpendicular to the surface of the triangle. This information is used in the Moller-Trumbore algorithm to calculate the intersection point.
Yes, it is possible for two triangles to intersect at multiple points. This can happen if the triangles are not coplanar, meaning they do not lie on the same plane. In this case, the triangles can intersect at different points along their edges or even at multiple points within their boundaries.
If the two triangles are parallel, they will never intersect. This is because parallel lines in a 3D environment never cross each other. In this case, the Moller-Trumbore algorithm will return a null value, indicating that there is no intersection point.
Yes, there are a few special cases where the Moller-Trumbore algorithm may not accurately determine if two triangles intersect. These include when the two triangles are coplanar, when one triangle is completely contained within the other, and when the two triangles share an edge but do not intersect at any other points. In these cases, additional checks may be needed to accurately determine if the triangles intersect.