Polygon
A polygon (from the Greek poly, for "many", and gwnos, for "angle") is a closed planar path composed of a finite number of straight line segments. The term polygon sometimes also describes the interior of the polygon (the open area that this path encloses) or the union of both. The straight line segments that make up the polygon are called its sides or edges and the points where the sides meet are the polygon's vertices.
| Polygon names | ||
|---|---|---|
| Name | Sides | |
| triangle | 3 | |
| quadrilateral | 4 | |
| pentagon | 5 | |
| hexagon | 6 | |
| heptagon | 7 | |
| octagon | 8 | |
| nonagon or ennagon | 9 | |
| decagon | 10 | |
| hendecagon or undecagon | 11 | |
| dodecagon | 12 | |
| hectagon | 100 | |
| megagon | 106 | |
| googolgon | 10100 | |
The taxonomic classification of polygons is illustrated by the following tree:
Polygon
/ \\
Simple Complex
/ \\
Convex Concave
/
Regular
- A polygon is simple if it is described by a single, non-intersecting boundary; otherwise it is called complex.
- A simple polygon is called convex if it has no internal angles greater than 180° otherwise it is called concave.
- A polygon is called regular if all its sides are of equal length and all its angles are equal.
For example, a square is a regular, cyclic quadrilateral.
We will assume Euclidean geometry throughout.
Any polygon, regular or irregular, complex or simple, has as many angles as it has sides. The sum of the inner angles of a simple n-gon is (n-2)&pi radians (or (n-2)180°), and the inner angle of a regular n-gon is (n-2)π/n radians (or (n-2)180°/n). This can be seen in two different ways:
Properties
The area A of a simple polygon can be computed if the cartesian coordinates (x1, y1), (x2, y2), ..., (xn, yn) of its vertices, listed in order as the area is circulated in counter-clockwise fashion, are known. The formula is
- A = 1/2 · (x1y2 - x2y1 + x2y3 - x3y2 + ... + xny1 - x1yn)
- = 1/2 · (x1(y2 - yn) + x2(y3 - y1) + x3(y4 - y2) + ... + xn(y1 - yn-1))
In computer graphics, it is often necessary to determine whether a given point P = (x0,y0) lies inside a simple polygon given by a sequence of line segments. The following algorithm counts how often a horizontal half-ray starting at P intersects the polygon; that number is odd if and only if P lies inside the polygon.
- Set l := 0 and r := 0
- for each line segment L of the polygon do the following:
- if the y-coordinate of one endpoint of L is less than y0 and the other is greater than or equal to y0, then:
- if P lies in the half plane to the left of L, then set l := l + 1, else set r := r + 1 (*)
- if the y-coordinate of one endpoint of L is less than y0 and the other is greater than or equal to y0, then:
- if both l and r are odd, then P lies inside the polygon; if both l and r are even, then P lies outside the polygon; if one is even and the other is odd, then some error has occurred, e.g. a rounding error or the line segments do not form a closed path.
eps and test in line (*) whether P lies withing eps of L, in which case the algorithm should stop and report "P lies very close to the boundary."If any two simple polygons of equal area are given, then the first can be cut into polygonal pieces which can be reassembled to form the second polygon. This is the Bolyai-Gerwien theorem.
All regular polygons are concyclic, as are all triangles and rectangles (see circumcircle).
The question of which regular polygons can be constructed with ruler and compass alone was settled by Carl Friedrich Gauss when he was 19: A regular n-gon can be constructed with ruler and compass if and only if the odd prime factors of n are distinct prime numbers of the form
See also: geometric shape, polyhedron, polytope, cyclic polygon, synthetic geometry.