Problem:
Input: The line L is given as input in the form of two end points.
The input for triangle T is given in the form of three points (its three
vertices v0, v1 and v2).
Output: We return the type of intersection (see the list below)
and the vertices or the edges involved.
proper intersection
no intersection
intersection at a vertex
intersection on an edge
coplanar and no intersection
coplanar and intersection at vertex
intersection through two edges
intersection contains an edge
intersection through one vertex and an edge
Representation:
We use the plucker coordinates to solve
this problem. We compute the side-operator
of the line L with the three oriented lines e1(v0 to v1), e2(v1 to
v2) and e3(v2 to v0) supporting the edges of the triangle.
S1 = side-operator(L,e1)
S2 = side-operator(L,e2)
S3 = side-operator(L,e3)
Different possible cases:
1) The triangle and the lines are not coplanar
|
||
|
||
|
||
|
||
2) The triangle and the lines are coplanar,
then
S1 = S2 = S3 = 0 Let p be a point not coplanar with the triangle T. Let T1, T2 and T3 denote the triangle (v0,v1,p), (v1,v2,p) and (v2,v0,p). Notice that the line and the triangle Ti are not coplanar.The following cases are solved by intersecting the line L and the triangles Ti , as in case 1 |
||
|
||
|
||
|
||
|
||
|
Code:
The code can be found here.
Prepared by Anoop Pant (anoop.pant@mailcity.com)
Contact : hazel.everett@loria.fr, sylvain.lazard@loria.fr,sylvain.petitjea@loria.fr
Last modified : 18/8/2001