Graphics Reference
In-Depth Information
P
C
R
B
A
Q
Figure 5.24
Intersecting the line through
P
and
Q
against the triangle
ABC
.
v
=[
PQ PA PC
]
w
=[
PQ PB PA
]
If
ABC
is counterclockwise, for
PQ
to pass to the left of the edges
BC
,
CA
, and
AB
the expressions
u
0 (respectively) must be true. Similarly,
when
ABC
is clockwise the scalar triple products must be nonpositive for
PQ
to pass
to the right of the edges. For a double-sided triangle, which is both clockwise and
counterclockwise depending on from which side it is viewed,
PQ
passes on the inside
if all three scalar triple products have the same sign (ignoring zeroes).
For obtaining the intersection point with
ABC
, it can be shown that
u
,
v
, and
w
are
proportional to
u
∗
,
v
∗
, and
w
∗
:
≥
0,
v
≥
0, and
w
≥
u
∗
=
ku
=[
PR PC PB
]
v
∗
=
kv
=[
PR PA PC
]
w
∗
=
kw
=[
PR PB PA
]
,
where
k
.
Here,
u
∗
,
v
∗
, and
w
∗
are proportional to the volumes of the tetrahedra
RBCP
,
RCAP
,
and
RABP
. As these tetrahedra all have the same height (as shown in Section 3.4 on
barycentric coordinates), the volumes are accordingly proportional to the areas of
their base triangles
RBC
,
RCA
, and
RAB
. It follows that
u
∗
,
v
∗
, and
w
∗
(and more
importantly,
u
,
v
, and
w
) therefore can be directly used to compute the barycentric
=
PR
PQ