Polygon

In geometry, a polygon is a plane figure made up of line segments connected to form a closed polygonal chain.

The segments of a closed polygonal chain are called its edges or sides. The points where two edges meet are the polygon's vertices or corners. An n-gon is a polygon with n sides; for example, a triangle is a 3-gon.

A simple polygon is one which does not intersect itself. More precisely, the only allowed intersections among the line segments that make up the polygon are the shared endpoints of consecutive segments in the polygonal chain. A simple polygon is the boundary of a region of the plane that is called a solid polygon. The interior of a solid polygon is its body, also known as a polygonal region or polygonal area. In contexts where one is concerned only with simple and solid polygons, a polygon may refer only to a simple polygon or to a solid polygon.

A polygonal chain may cross over itself, creating star polygons and other self-intersecting polygons. Some sources also consider closed polygonal chains in Euclidean space to be a type of polygon (a skew polygon), even when the chain does not lie in a single plane.

A polygon is a 2-dimensional example of the more general polytope in any number of dimensions. There are many more generalizations of polygons defined for different purposes.

Etymology
The word polygon derives from the Greek adjective πολύς (polús) 'much', 'many' and γωνία (gōnía) 'corner' or 'angle'. It has been suggested that γόνυ (gónu) 'knee' may be the origin of gon.

Number of sides
Polygons are primarily classified by the number of sides.

Convexity and intersection
Polygons may be characterized by their convexity or type of non-convexity:
 * Convex: any line drawn through the polygon (and not tangent to an edge or corner) meets its boundary exactly twice. As a consequence, all its interior angles are less than 180°. Equivalently, any line segment with endpoints on the boundary passes through only interior points between its endpoints. This condition is true for polygons in any geometry, not just Euclidean.
 * Non-convex: a line may be found which meets its boundary more than twice. Equivalently, there exists a line segment between two boundary points that passes outside the polygon.
 * Simple: the boundary of the polygon does not cross itself. All convex polygons are simple.
 * Concave: Non-convex and simple. There is at least one interior angle greater than 180°.
 * Star-shaped: the whole interior is visible from at least one point, without crossing any edge. The polygon must be simple, and may be convex or concave. All convex polygons are star-shaped.
 * Self-intersecting: the boundary of the polygon crosses itself. The term complex is sometimes used in contrast to simple, but this usage risks confusion with the idea of a complex polygon as one which exists in the complex Hilbert plane consisting of two complex dimensions.
 * Star polygon: a polygon which self-intersects in a regular way. A polygon cannot be both a star and star-shaped.

Equality and symmetry

 * Equiangular: all corner angles are equal.
 * Equilateral: all edges are of the same length.
 * Regular: both equilateral and equiangular.
 * Cyclic: all corners lie on a single circle, called the circumcircle.
 * Tangential: all sides are tangent to an inscribed circle.
 * Isogonal or vertex-transitive: all corners lie within the same symmetry orbit. The polygon is also cyclic and equiangular.
 * Isotoxal or edge-transitive: all sides lie within the same symmetry orbit. The polygon is also equilateral and tangential.

The property of regularity may be defined in other ways: a polygon is regular if and only if it is both isogonal and isotoxal, or equivalently it is both cyclic and equilateral. A non-convex regular polygon is called a regular star polygon.

Miscellaneous

 * Rectilinear: the polygon's sides meet at right angles, i.e. all its interior angles are 90 or 270 degrees.
 * Monotone with respect to a given line L: every line orthogonal to L intersects the polygon not more than twice.

Properties and formulas
Euclidean geometry is assumed throughout.

Angles
Any polygon has as many corners as it has sides. Each corner has several angles. The two most important ones are:
 * Interior angle – The sum of the interior angles of a simple n-gon is (n − 2) × π radians or (n − 2) × 180 degrees. This is because any simple n-gon ( having n sides ) can be considered to be made up of (n − 2) triangles, each of which has an angle sum of π radians or 180 degrees. The measure of any interior angle of a convex regular n-gon is $$\left(1-\tfrac{2}{n}\right)\pi$$ radians or $$180-\tfrac{360}{n}$$ degrees. The interior angles of regular star polygons were first studied by Poinsot, in the same paper in which he describes the four regular star polyhedra: for a regular $$\tfrac{p}{q}$$-gon (a p-gon with central density q), each interior angle is $$\tfrac{\pi(p-2q)}{p}$$ radians or $$\tfrac{180(p-2q)}{p}$$ degrees.
 * Exterior angle – The exterior angle is the supplementary angle to the interior angle. Tracing around a convex n-gon, the angle "turned" at a corner is the exterior or external angle. Tracing all the way around the polygon makes one full turn, so the sum of the exterior angles must be 360°. This argument can be generalized to concave simple polygons, if external angles that turn in the opposite direction are subtracted from the total turned. Tracing around an n-gon in general, the sum of the exterior angles (the total amount one rotates at the vertices) can be any integer multiple d of 360°, e.g. 720° for a pentagram and 0° for an angular "eight" or antiparallelogram, where d is the density or turning number of the polygon.

Area


In this section, the vertices of the polygon under consideration are taken to be $$(x_0, y_0), (x_1, y_1), \ldots, (x_{n - 1}, y_{n - 1})$$ in order. For convenience in some formulas, the notation $(x_{n}, y_{n}) = (x_{0}, y_{0})$ will also be used.

Simple polygons
If the polygon is non-self-intersecting (that is, simple), the signed area is
 * $$A = \frac{1}{2} \sum_{i = 0}^{n - 1}( x_i y_{i + 1} - x_{i + 1} y_i) \quad \text {where } x_{n}=x_{0} \text{ and } y_n=y_{0}, $$

or, using determinants
 * $$16 A^{2} = \sum_{i=0}^{n-1} \sum_{j=0}^{n-1} \begin{vmatrix} Q_{i,j} & Q_{i,j+1} \\

Q_{i+1,j} & Q_{i+1,j+1} \end{vmatrix}, $$ where $$ Q_{i,j} $$ is the squared distance between $$(x_i, y_i)$$ and $$(x_j, y_j).$$

The signed area depends on the ordering of the vertices and of the orientation of the plane. Commonly, the positive orientation is defined by the (counterclockwise) rotation that maps the positive $x$-axis to the positive $y$-axis. If the vertices are ordered counterclockwise (that is, according to positive orientation), the signed area is positive; otherwise, it is negative. In either case, the area formula is correct in absolute value. This is commonly called the shoelace formula or surveyor's formula.

The area A of a simple polygon can also be computed if the lengths of the sides, a1, a2, ..., an and the exterior angles, θ1, θ2, ..., θn are known, from:
 * $$\begin{align}A = \frac12 ( a_1[a_2 \sin(\theta_1) + a_3 \sin(\theta_1 + \theta_2) + \cdots + a_{n-1} \sin(\theta_1 + \theta_2 + \cdots + \theta_{n-2})] \\

{} + a_2[a_3 \sin(\theta_2) + a_4 \sin(\theta_2 + \theta_3) + \cdots + a_{n-1} \sin(\theta_2 + \cdots + \theta_{n-2})] \\ {} + \cdots + a_{n-2}[a_{n-1} \sin(\theta_{n-2})] ). \end{align}$$ The formula was described by Lopshits in 1963.

If the polygon can be drawn on an equally spaced grid such that all its vertices are grid points, Pick's theorem gives a simple formula for the polygon's area based on the numbers of interior and boundary grid points: the former number plus one-half the latter number, minus 1.

In every polygon with perimeter p and area A , the isoperimetric inequality $$p^2 > 4\pi A$$ holds.

For any two simple polygons of equal area, the Bolyai–Gerwien theorem asserts that the first can be cut into polygonal pieces which can be reassembled to form the second polygon.

The lengths of the sides of a polygon do not in general determine its area. However, if the polygon is simple and cyclic then the sides do determine the area. Of all n-gons with given side lengths, the one with the largest area is cyclic. Of all n-gons with a given perimeter, the one with the largest area is regular (and therefore cyclic).

Regular polygons
Many specialized formulas apply to the areas of regular polygons.

The area of a regular polygon is given in terms of the radius r of its inscribed circle and its perimeter p by
 * $$A = \tfrac{1}{2} \cdot p \cdot r.$$

This radius is also termed its apothem and is often represented as a.

The area of a regular n-gon in terms of the radius R of its circumscribed circle can be expressed trigonometrically as:
 * $$A = R^2 \cdot \frac{n}{2} \cdot \sin \frac{2\pi}{n} = R^2 \cdot n \cdot \sin \frac{\pi}{n} \cdot \cos \frac{\pi}{n}$$

The area of a regular n-gon inscribed in a unit-radius circle, with side s and interior angle $$\alpha,$$ can also be expressed trigonometrically as:
 * $$A = \frac{ns^{2}}{4}\cot \frac{\pi}{n} = \frac{ns^{2}}{4}\cot\frac{\alpha}{n-2} = n \cdot \sin \frac{\alpha}{n-2} \cdot \cos \frac{\alpha}{n-2}.$$

Self-intersecting
The area of a self-intersecting polygon can be defined in two different ways, giving different answers:
 * Using the formulas for simple polygons, we allow that particular regions within the polygon may have their area multiplied by a factor which we call the density of the region. For example, the central convex pentagon in the center of a pentagram has density 2. The two triangular regions of a cross-quadrilateral (like a figure 8) have opposite-signed densities, and adding their areas together can give a total area of zero for the whole figure.
 * Considering the enclosed regions as point sets, we can find the area of the enclosed point set. This corresponds to the area of the plane covered by the polygon or to the area of one or more simple polygons having the same outline as the self-intersecting one. In the case of the cross-quadrilateral, it is treated as two simple triangles.

Centroid
Using the same convention for vertex coordinates as in the previous section, the coordinates of the centroid of a solid simple polygon are
 * $$C_x = \frac{1}{6 A} \sum_{i = 0}^{n - 1} (x_i + x_{i + 1}) (x_i y_{i + 1} - x_{i + 1} y_i), $$
 * $$C_y = \frac{1}{6 A} \sum_{i = 0}^{n - 1} (y_i + y_{i + 1}) (x_i y_{i + 1} - x_{i + 1} y_i).$$

In these formulas, the signed value of area $$A$$ must be used.

For triangles ($n = 3$), the centroids of the vertices and of the solid shape are the same, but, in general, this is not true for $n > 3$. The centroid of the vertex set of a polygon with $n$ vertices has the coordinates
 * $$c_x=\frac 1n \sum_{i = 0}^{n - 1}x_i,$$
 * $$c_y=\frac 1n \sum_{i = 0}^{n - 1}y_i.$$

Generalizations
The idea of a polygon has been generalized in various ways. Some of the more important include:
 * A spherical polygon is a circuit of arcs of great circles (sides) and vertices on the surface of a sphere. It allows the digon, a polygon having only two sides and two corners, which is impossible in a flat plane. Spherical polygons play an important role in cartography (map making) and in Wythoff's construction of the uniform polyhedra.
 * A skew polygon does not lie in a flat plane, but zigzags in three (or more) dimensions. The Petrie polygons of the regular polytopes are well known examples.
 * An apeirogon is an infinite sequence of sides and angles, which is not closed but has no ends because it extends indefinitely in both directions.
 * A skew apeirogon is an infinite sequence of sides and angles that do not lie in a flat plane.
 * A polygon with holes is an area-connected or multiply-connected planar polygon with one external boundary and one or more interior boundaries (holes).
 * A complex polygon is a configuration analogous to an ordinary polygon, which exists in the complex plane of two real and two imaginary dimensions.
 * An abstract polygon is an algebraic partially ordered set representing the various elements (sides, vertices, etc.) and their connectivity. A real geometric polygon is said to be a realization of the associated abstract polygon. Depending on the mapping, all the generalizations described here can be realized.
 * A polyhedron is a three-dimensional solid bounded by flat polygonal faces, analogous to a polygon in two dimensions. The corresponding shapes in four or higher dimensions are called polytopes. (In other conventions, the words polyhedron and polytope are used in any dimension, with the distinction between the two that a polytope is necessarily bounded. )

Naming
The word polygon comes from Late Latin polygōnum (a noun), from Greek πολύγωνον (polygōnon/polugōnon), noun use of neuter of πολύγωνος (polygōnos/polugōnos, the masculine adjective), meaning "many-angled". Individual polygons are named (and sometimes classified) according to the number of sides, combining a Greek-derived numerical prefix with the suffix -gon, e.g. pentagon, dodecagon. The triangle, quadrilateral and nonagon are exceptions.

Beyond decagons (10-sided) and dodecagons (12-sided), mathematicians generally use numerical notation, for example 17-gon and 257-gon.

Exceptions exist for side counts that are easily expressed in verbal form (e.g. 20 and 30), or are used by non-mathematicians. Some special polygons also have their own names; for example the regular star pentagon is also known as the pentagram.

To construct the name of a polygon with more than 20 and fewer than 100 edges, combine the prefixes as follows. The "kai" term applies to 13-gons and higher and was used by Kepler, and advocated by John H. Conway for clarity of concatenated prefix numbers in the naming of quasiregular polyhedra, though not all sources use it.

History
Polygons have been known since ancient times. The regular polygons were known to the ancient Greeks, with the pentagram, a non-convex regular polygon (star polygon), appearing as early as the 7th century B.C. on a krater by Aristophanes, found at Caere and now in the Capitoline Museum.

The first known systematic study of non-convex polygons in general was made by Thomas Bradwardine in the 14th century.

In 1952, Geoffrey Colin Shephard generalized the idea of polygons to the complex plane, where each real dimension is accompanied by an imaginary one, to create complex polygons.

In nature
Polygons appear in rock formations, most commonly as the flat facets of crystals, where the angles between the sides depend on the type of mineral from which the crystal is made.

Regular hexagons can occur when the cooling of lava forms areas of tightly packed columns of basalt, which may be seen at the Giant's Causeway in Northern Ireland, or at the Devil's Postpile in California.

In biology, the surface of the wax honeycomb made by bees is an array of hexagons, and the sides and base of each cell are also polygons.

Computer graphics
In computer graphics, a polygon is a primitive used in modelling and rendering. They are defined in a database, containing arrays of vertices (the coordinates of the geometrical vertices, as well as other attributes of the polygon, such as color, shading and texture), connectivity information, and materials.

Any surface is modelled as a tessellation called polygon mesh. If a square mesh has n + 1 points (vertices) per side, there are n squared squares in the mesh, or 2n squared triangles since there are two triangles in a square. There are (n + 1)2 / 2(n2) vertices per triangle. Where n is large, this approaches one half. Or, each vertex inside the square mesh connects four edges (lines).

The imaging system calls up the structure of polygons needed for the scene to be created from the database. This is transferred to active memory and finally, to the display system (screen, TV monitors etc.) so that the scene can be viewed. During this process, the imaging system renders polygons in correct perspective ready for transmission of the processed data to the display system. Although polygons are two-dimensional, through the system computer they are placed in a visual scene in the correct three-dimensional orientation.

In computer graphics and computational geometry, it is often necessary to determine whether a given point $$P=(x_0,y_0)$$ lies inside a simple polygon given by a sequence of line segments. This is called the point in polygon test.