Lacing around the boundary
The shoelace formula computes the area of any simple polygon from the coordinates of its vertices in order. Picture writing the coordinates in two columns and drawing diagonal lines between them like laces on a shoe. Each crossing pair contributes a product, and the pattern gives the formula its name.
How it works
Walk around the polygon vertex by vertex and accumulate a running sum:
- For each edge, take the cross product of consecutive vertex coordinates.
- Add all these signed terms together.
- Halve the absolute value of the total to get the area.
The signed total before taking the absolute value also reveals orientation: a positive sum means the vertices were listed counterclockwise, a negative sum means clockwise.
Why it is reliable
The method visits each vertex once, so it is linear in the number of vertices. It works for convex and concave shapes alike, as long as the boundary does not cross itself. With integer coordinates every term is exact, which makes the formula a dependable building block inside larger geometry code.
Key idea
Summing the cross products of consecutive vertices and halving the magnitude yields a simple polygon's exact area and its orientation.