Give a computer the corners of a polygon, in order, and ask for its area. The obvious plan is to triangulate — split the shape into triangles, find each triangle's area, add them up. It works, but it is fiddly: you need to choose a triangulation, handle concave corners, and keep signs straight.
There is a shortcut. Walk around the vertices in order, multiply each by the next , subtract the reverse product, and add it all up. Divide by two and you have the exact area — no triangulation, no case analysis, just arithmetic on the coordinates you already have.
It is called the shoelace formula because the crisscross pattern of multiplications, written out on paper, looks like laces threading through a shoe's eyelets. That visual mnemonic hides a genuinely elegant piece of mathematics: a sum of cross products that also tells you, for free, which way the polygon turns.
Comments
Loading comments...