Area from coordinates
The shoelace formula computes the area of any simple polygon directly from its vertex coordinates, with no need to decompose it into triangles by hand.
The cross product sum
Walk the vertices in order. For each edge from one vertex to the next, accumulate the cross product of the two position vectors. Sum these contributions around the whole boundary, then take half the absolute value.
- The name comes from the crisscross pattern of multiplications.
- Each term is the signed area of a triangle from the origin.
The sign is a bonus
Before taking the absolute value, the sign of the sum reveals the winding direction.
- A positive total means counterclockwise vertex order.
- A negative total means clockwise order.
This orientation check is handy for normalizing polygons and for point in polygon routines.
Requirements
The polygon must be simple, meaning its edges do not cross themselves. Self intersecting polygons return a blend of positive and negative regions rather than a meaningful single area.
Key idea
The shoelace formula sums cross products of consecutive vertices and halves the result for the area, while the sign of that sum reveals whether the polygon is wound clockwise or counterclockwise.