Polygons: Planar, Closed, and Simple
Definitions
A polygon is a planar figure bounded by a closed chain of line segments (edges) connecting an ordered sequence of vertices. Three properties are critical for the algorithms in this module:
Planar
The polygon lies in a 2D flat plane that is infinite in both directions. On a non-planar surface (e.g. a sphere), “inside” vs “outside” is ambiguous: a closed polygon boundary divides the surface into two finite regions, and either could be labelled “inside.”
On a planar surface, the polygon’s boundary separates a finite region (inside) from an infinite region (outside).
Closed
A closed polygon has an edge from its last vertex back to its first, forming a complete loop. An open polygon does not enclose any area, so “inside” and “outside” are not defined.
Example: the letter O is closed and encloses area; the letter C is open and does not.
Simple
A simple polygon has no self-intersections; edges meet only at vertices and nowhere else.
Other Classifications
- Convex polygon: All interior angles . Any line segment connecting two interior points lies entirely inside the polygon. A convex polygon’s interior is the intersection of the half-planes defined by each edge.
- Star-shaped polygon: There exists at least one point from which the entire polygon is visible.
- Monotone polygon: For some direction (typically horizontal), every line perpendicular to that direction intersects the polygon in at most one connected segment.
Representation
A polygon is represented as an ordered list of vertices , with edges for and for a closed polygon.
The order can be clockwise (CW) or counter-clockwise (CCW). Many algorithms assume CCW order.
Area: The Shoelace Formula
For a simple polygon with vertices in order, the signed area is:
where .
- : vertices are ordered counter-clockwise
- : vertices are ordered clockwise
- : degenerate (collinear vertices or self-intersecting)
The absolute value gives the polygon’s area.
Worked Example
Triangle with vertices , , in CCW order:
The actual area of this right triangle is . The positive sign confirms CCW order.
Degenerate Cases
- Collinear points: three consecutive vertices lying on a straight line produce zero contribution from the middle vertex. This can be simplified by removing the middle vertex.
- Zero area: if the points form a line rather than a shape, the shoelace sum is zero.
Summary
| Property | Meaning |
|---|---|
| Planar | Lies in a 2D flat plane |
| Closed | Last vertex connects to first |
| Simple | No self-intersections |
| Convex | All line segments between interior points stay inside |
| Shoelace formula | |
| Signed area sign | = CCW, = CW |
| Time for area |