Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Triangle-Plane intersection equations??

Name: Anonymous 2006-11-27 23:43

Given a triangle with 3 vertices v1, v2, and v3, is there a way to tell if it intersects a given infinite plane Q with usual plane properties <a, b, c, d>?  And, if so, how to get the finite line where the finite triangle and infinite plane intersect?  I know how to get the ray from where two planes intersect, but not so certain about when a plane intersects with a finite surface like a triangle.

No, this isn't homework.  It's for a game where 3D models intersect on a 2D gameplay space, and I'm experimenting with certain collision detection systems -- in this case, testing against a set of lines derived from the 2D gameplay board intersecting with all of the game models.  But that involves a plane intersecting triangles and getting the line where they intersect, and that I don't know how to do.

Name: Anonymous 2006-11-28 7:36

1) find two vectors on your plane Q.  just find 2 points on it and subtract a 3rd on it from each.
call them q1, q2

2) for each v1, v2, v3
calculate the determinant of the matrix
[ q1 ]  where the vectors
[ q2 ]  are used as rows
[ vi ]  and vi is v1, v2, or v3

3) take note of the sign, if it changes, youve crossed or intersected.

****
if that doesnt work, since im attempting to generalize point line intersection in 2d, so it might not be right, try taking just one point on the plane, call it q, and finding the vectors
v1 - q
v2 - q
v3 - q

and calculating the determinant of of the matrix where those 3 vectors are the rows, and watch for a sign change

***

i'm thinking one should work since the determinant gives you oriented volume of the parallelepiped formed by the vectors, and, as the triangle moves, itll change the volume as well as possibly the sign.  id suggest trying this and just watching the value as it moves around without crossing the plane, and then make it cross the plane and see if it happens.

Name: Anonymous 2006-12-01 16:51

HEY DID IT WORK?

Name: Anonymous 2006-12-01 17:36

lets divide by zero!

Name: Anonymous 2006-12-01 17:45

Yay! Division by zero! Zero ring or not!

Name: Anonymous 2006-12-01 18:17

let N be your plane's normal vector and P be any point on your plane and V1,V2,V3 be your triangles vertexes
find N.(V1-P), N.(V2-P), and N.(V3-P)  (.=dot product)
If they all have the same sign then the triangle didn't intersect, otherwise it did.  If one of them is zero then a vertex of your triangle lies on the plane.  Anyway, this might be a little faster than >>2's method.

Don't change these.
Name: Email:
Entire Thread Thread List