Graphics Reference
In-Depth Information
clockwise with respect to the origin cancel out edges directed counterclockwise with respect to the
origin. Although this is more computationally expensive than summing the areas under the edges, it
suggests a way to compute the area of a polygon in three-space. In the three-dimensional case, one
of the vertices of the polygon can be used to construct a triangle with each edge, and the three-
dimensional version of the vector equations of Figure B.14 can be used.
B.2.8 The cosine rule
The cosine rule states the relationship between the lengths of the edges of a triangle and the cosine of an
interior angle ( Figure B.17 ). It is useful for determining the interior angle of a triangle when the loca-
tions of the vertices are known.
B.2.9 Barycentric coordinates
Barycentric coordinates are the coordinates of a point in terms of weights associated with other points.
Most commonly used are the barycentric coordinates of a point with respect to vertices of a triangle.
The barycentric coordinates ( u 1 , u 2 , u 3 ) of a point, P , with respect to a triangle with vertices V 1 , V 2 , V 3
are shown in Figure B.18 . Notice that for a point inside the triangle, the coordinates always sum to one.
This can be extended easily to any convex polygon by a direct generalization of the equations.
However, it cannot be extended to concave polygons.
B
A
2
2
2
C
A
B
2 A B cos
2
2
2
A
B
C
cos
2
A
B
C
FIGURE B.17
The cosine rule.
V 1
Area( V 1 , V 2 , V 3 )
u 1
Area( P , V 2 , V 3 )
Area( P , V 3 , V 1 )
u 2
Area( V 1 , V 2 , V 3 )
P
Area( P , V 1 , V 2 )
u 3
V 2
Area( V 1 , V 2 , V 3 )
V 3
P u 1 V 1 u 2 V 2 u 3 V 3
FIGURE B.18
The barycentric coordinates of a point with respect to vertices of a triangle.
 
Search WWH ::




Custom Search