Area of an irregular $n$-gon

179 Views Asked by At

Given the coordinates for the vertices of an irregular polygon, is there a formula to calculate its area?

For example, if the coordinates given are $(0,0), (0,5), (1,5), (1,1), (5,1), (5,0)$ then the area is $9$. Is there a formula which takes in arbitrary vertices and spits out their area?

2

There are 2 best solutions below

0
On BEST ANSWER

You want the shoelace formula: if a polygon has vertices $(x_1,y_1),\dots,(x_n,y_n)$, then its (signed) area is given by $$ \frac{1}{2}\sum_{i=1}^n (x_i y_{i+1}-x_{i+1}y_i) $$ where all index arithmetic is performed modulo $n$.

0
On

You might want to check out Pick's theorem. It's not exactly what you described, but you should be able to use it to construct some sort of program which takes the vertices as input and outputs the area.