Area of a Polygon

Tom Davis davis at bedlam.esd.sgi.com
Tue Feb 5 03:01:34 AEST 1991



There's a simple formula to find the (signed) area of a polygon.  The
sign will be positive or negative depending on whether the points
describe a counter-clockwise or clockwise polygon, respectively.

Assume the polygon has n points: (x[0], y[0]), (x[1], y[1]), ... (x[n-1], y[n-1]).
For notational convenience, define x[n] = x[0] and y[n] = y[0].  Then the area
is given by:

           n-1
           __
A =       \     (x[i]*(y[i+1] - y[i]) - y[i]*(x[i+1] - x[i]))/2
          /__
          i = 0

I hope this helps.  If you can't remember the formula (I usually can't),
it's just a trivial application of Stokes Theorem, where the surface is
just the x-y plane.



More information about the Comp.sys.sgi mailing list