» Help

How to calculate the area of a polygon


The signed area can be computed in linear time by a simple sum. The key formula is this: If the coordinates of vertex v_i are x_i and y_i, twice the signed area of a polygon is given by:

2 A( P ) = sum_{i = 0}^{n - 1} (x_i y_{i + 1} - y_i x_{i + 1})

Here n is the number of vertices of the polygon. A rearrangement of terms in this equation can save multiplications and operate on coordinate differences, and so may be both faster and more accurate:

2 A( P ) = sum_{i = 0}^{n - 1} ((x_i + x_{i + 1}) (y_{i + 1} - y_i))

To find the area of a planar polygon not in the x-y plane, use:

2 A(P) = abs(N . (sum_{i = 0}^{n - 1} (v_i × v_{i + 1})))

where N is a unit vector normal to the plane. The '.' represents the dot product operator, the '×' represents the cross product operator, and abs() is the absolute value function.

Original resource: The Delphi Pool
Author: Unknown
Added: 2013-04-09
Last updated: 2013-04-09

« Return to contents »