Archived

This topic is now archived and is closed to further replies.

amish1234

triangle/plane intersection points

Recommended Posts

I am making a BSP system. As you know, triangles have to be split along the plane of another triangle. I know how to tell if a triangle is spanning a plane, but how can I tell where it intersects? Sleeping might be a good idea now. Proceeding on a brutal rampage is the obvious choice.

Share this post


Link to post
Share on other sites
Intersect the edges of the triangle. Each edge can be expressed as

P = P0 + t * (P1 - P0)

where P0 and P1 are two vertices. Plug the components in the plane equation and solve for t.

Cédric

Share this post


Link to post
Share on other sites
It''s a parametric equation. t is a scalar value. Breaking the equaiton into components yield:

x = x0 + t * (x1 - x0)
y = y0 + t * (y1 - y0)
z = z0 + t * (z1 - z0)

These are all known quantities except t. Use them in the plane equation to find the intersection point of the line and the plane.

Note that if t is not comprised between 0 and 1, then the point is not part of the line segment.

Cédric

Share this post


Link to post
Share on other sites
Sorry, but I really don''t understand what you are saying. For clarity, lets follow this diagram:

| | /|P1
| | / |
| I1|/ |
| /| |
y| / | |
| P0/__|___|P2
| |I2
| |
|___________________
x

P1, P2, and P3 make up the triangle. The vertical line is the plane, and I1 and I2 are the intersection points. How can I find the coordinates of I1 and I2?
Are you suggesting starting at P1 or P2, making a parametric that moves it to P0, and using the plane equation to find the value of t? Please give me an example. Thank you.

Proceeding on a brutal rampage is the obvious choice.

Share this post


Link to post
Share on other sites
Ok. I''ll try to be clearer

The idea is to test each and every edge (line) of the triangle to see if it collides with the plane. There are three lines:
P0-P1
P1-P2
P2-P0

For example, with P0-P1, any point on the line can be represented as a linear interpolation between P0-P1. Hence,

P = P0 + t * (P1 - P0)

If 0 < t < 1, then P is somewhere between P1 and P0. This is a vectorial equation, so there are three components. We can substitute them in the plane equation:

Ax + By + Cz + D = 0
A(P0.x + t * (P1.x - P0.x)) + B(P0.y + t * ... = 0

Isolate t. Once you have it, you know that, if t>1 or t<0, the edge doesn''t intersect the plane. Else, you can find the intersection point by replacing t in the original equation.

Hope this helps,

Cédric

Share this post


Link to post
Share on other sites