If the discriminant (the term under the square root)
is positive there are two intersections, if it is 0 there is
one tangency, and if it is negative there are no intersections
The Normal:
\(2(\bs{p} - \bs{c})\)
Ray-Triangle Intersection
Recall:
The three (not colinear) vertices of a triangle
\(\bs{r}, \bs{s}, \bs{r} \in \mathbb{R}^3\)
define a plane with barycentric coordinates
\(\bs{p}(\rho, \sigma, \tau) = \rho \bs{r} +
\sigma \bs{s} + \tau \bs{t}\) in which
\(\rho + \sigma + \tau = 1\)
Using the Paramters:
The point is in the interior if and only if all three
parameters are in \((0, 1)\)
The point is on an edge if and only if two
parameters are in \((0, 1)\) and one is 0
The point is a vertex if and only if one
parameter is in \((0, 1)\) and two are 0
Substituting the parametric form of the ray,
\(\bs{o} + t \bs{d}\), for \(\bs{p}\) yields:
\(\bs{o} + t \bs{d} = \bs{r} +
\sigma (\bs{s} - \bs{r}) + \tau (\bs{t} - \bs{r})\)
Using the Paramters:
The point is in the interior if and only if
\(\sigma > 0\), \(\tau > 0\), and
\((\sigma + \tau) \lt 1\)
Ray-Triangle Intersection (cont.)
Solving:
This is three linear equations in three
unknowns (\(\sigma\), \(\tau\), and \(t\))