RtIntersectionLineTriangle
tests for the intersection of a line with a triangle, and if found,
returns the parametric distance to the intersection along the
line.
This function returns TRUE if the line, specified at the
starting point lineStart (RwV3d) and a lineDelta (RwV3d) defining the displacement
vector, intersects with the triangle (RwV3d).
The lineDelta parameter is used to reduce calculation
overheads when processing a large number of triangles and can be
obtained from RwV3dSub(lineDelta, &line.end,
&line.start).
This function also takes another parameter, distance,
which will hold the parametric distance to the intersection if an
intersection was found.
This function use backface culling which means:
- the order of the triangle vertices is very important
- you will need to make two calls for two-sided tests
- Parameters:
-
lineStart |
Line start vertex |
lineDelta |
Line displacement vector |
v0 |
Triangle vertex 0 |
v1 |
Triangle vertex 1 |
v2 |
Triangle vertex 2 |
distance |
On return, contains parameteric distance to intersection |
- Returns:
- Returns TRUE if an intersection is found, or FALSE
otherwise.
|