Graphics Reference
In-Depth Information
P n , we can use the same tech-
nique (see Figure 7.22): We compute the signed area of QP 0 P 1 ,of QP 1 P 2 , ...,
and of QP n P 0 ; the parts of those areas that are outside the polygon cancel, while
the ones inside add up to the correct total area. The final form is
To find the (signed) area of a polygon P 0 P 1 ...
n
area = 1
2
( x i y i + 1
y i x i + 1 ) ,
(7.124)
2
0
i = 0
1
where x n + 1 denotes x 0 (i.e., the indices are taken modulo ( n + 1 ) ).
Figure 7.22: The pale yellow tri-
angle is negatively oriented; the
blue one positively. The next three
will be negative, positive, and
negative, and their signed areas
will sum to give the gray poly-
gon's area.
7.10.4 Normal to a Polygon in Space
A triangle P 0 P 1 P 2 in space has a normal n as we computed earlier, given by n =
( P 1
P 1 ) . We could use this formula to compute the normal to a
polygon in space as well, applying it to three successive vertices. But if these
vertices happen to be collinear, we'll get n = 0 .
A more interesting approach, essentially due to Plücker [Plü68], is based on
projected areas (see Figure 7.23 for an example where the polygon is a triangle):
If one projects the polygon to the xy -, yz -, and zx -planes, one gets three planar
polygons, each of whose areas can be computed; call these A xy , A yz , and A zx .The
normal vector to the polygon is then
P 0 )
×
( P 2
A yz
A zx
A xy
;
(7.125)
this is not generally a unit vector. In fact, its length is the area of the polygon.
Figure 7.23: The gray triangle projects to three triangles, one in each coordinate plane.
The signed areas of the orange, yellow, and blue triangles form the coordinates for the
normal vector to the gray triangle.
 
 
 
Search WWH ::




Custom Search