Graphics Reference
In-Depth Information
Let's also look at the coefficients in Equation 7.112: They are
(
1
−
s
)(
1
−
t
)
,
(
1
−
s
)
t
, and
s
. It's easy to see that for 0
≤
≤
s
,
t
1, all three are positive; summing
them up we get
(
1
−
s
)(
1
−
t
)+(
1
−
s
)
t
+
s
=(
1
−
s
)((
1
−
t
)+
t
)+
s
(7.114)
=(
1
−
s
)+
s
(7.115)
=
1.
(7.116)
(This is good: Combinations of multiple points are only defined when the coeffi-
cients sum to one.) So we can say that the points of the triangle are of the form
α
A
+
β
B
+
γ
C
,
(7.117)
where
α
+
β
+
γ
=
1, and
α
,
β
,
γ ≥
0. Points where
α
=
0 lie on the edge
BC
;
β
=
0 lie on the edge
AC
; points where
γ
=
0 lie on the edge
AB
.
points where
If
P
=
α
A
+
β
B
+
γ
C
, then the numbers
α
,
β
, and
γ
are called the
barycentric
coordinates
of
P
with respect to the triangle
ABC
.
Inline Exercise 7.14:
(a) What are the barycentric coordinates of the midpoint
of the edge
AB
in the triangle
ABC
? (b) What about the centroid?
Inline Exercise 7.15:
Suppose
A
=(
1, 0, 0
)
,
B
=(
0, 1, 0
)
, and
C
=(
0, 0, 1
)
,
and the point
P
of triangle
ABC
has barycentric coordinates
α
,
β
, and
γ
. What
are the 3D coordinates of
P
?
Two other descriptions of the barycentric coordinates of a point in a triangle
are often useful.
• In a nondegenerate triangle
ABC
,the
A
-coordinate of a point
P
is the per-
pendicular distance of
P
from the edge
BC
, scaled so that the
A
-coordinate
of the point
A
is exactly one. There are two ways to see this. The first is to
simply write everything out in terms of coordinates. The other is to realize
that the “perpendicular distance” function and the “
A
-coordinate” function
are both affine functions on the plane, and they agree at three points (
A
,
B
,
and
C
), and this suffices to determine them uniquely.
• From the preceding description, it's easy to see that the area of the triangle
PCB
, being half the product of the length of
BC
and the length of the per-
pendicular from
P
to
BC
, is proportional to that perpendicular length. So
the
A
-coordinate of
P
is proportional to the area of triangle
PBC
. The pro-
portionality constant is exactly the area of
ABC
, that is, the
A
-coordinate
of
P
is
C
P
Area
5
a
B
A
Area
(
PBC
)
Figure 7.16: The point P divides
triangle ABC into three smaller
triangles, whose areas are frac-
tions
α
,
β
,
and
γ
of the whole; the
barycentric coordinates of P are
α
,
β
,
and
γ
,thatis,P
=
α
A
+
β
B
+
γ
C.
ABC
)
.
(7.118)
Area
(
The same proof works for this case. In short, the point
P
provides a nat-
ural partition of the triangle
ABC
into three subtriangles; the fractions of
the area of
ABC
represented by each of these triangles are the barycentric
coordinates of
P
(Figure 7.16).