Graphics Reference
In-Depth Information
Area of a polygon
The area of a polygon can be computed as a sum of the signed areas of simple elements. In the two-
dimensional case, the signed area under each edge of the polygon can be summed to form the area
(
Figure B.15
). The area under an edge is the average height of the edge times its width (
Eq. B.31
,
where
subscripts are computed modulo
n þ
1).
X
n
ð
y
i
þ y
iþ
1
Þ
Area
¼
ð
x
iþ
1
x
i
Þ
2
i¼
1
(B.31)
2
X
n
i¼
1
1
¼
ð
y
i
x
iþ
1
y
iþ
1
x
i
Þ
The area of a polygon can also be computed by using each edge of the polygon to construct a tri-
angle with the origin (
Figure B.16
). The signed area of the triangle must be used so that edges directed
Positive area
Negative area
Q
FIGURE B.15
Computing the area of a polygon.
B
A
E
C
D
Q
Area of polygon (
A
,
B
,
C
,
D
,
E
) Area of Triangle (
Q
,
A
)
Area of Triangle(
Q
,
B
)
Area of Triangle(
Q
,
C
)
Area of Triangle(
Q
,
D
)
Area of Triangle(
Q
,
E
)
FIGURE B.16
The area of a two-dimensional polygon: the edges are labeledwith letters, triangles are constructed fromeach edge to
Search WWH ::
Custom Search