[comp.graphics] Area of a Polygon

andru@electron.lcs.mit.edu (Andrew Myers) (02/05/91)

In article <Feb.3.19.12.39.1991.10354@pilot.njin.net> psomu@pilot.njin.net (Prabhakar Somu) writes:
>Hi,
>
>   I am trying to find the area of an arbitrarily shaped polygon
>drawn on the overlay plane on a 4D 70GT(running Irix 3.2). 
[...]

    There's no need to use graphics to find the area of a polygon.
    Given Xi, Yi, the area is


    sum from i=1,n with j=i+1 except j=1 when i=n:

	(1/2) (Xj Yi - Xi Yj)

    Of course, the 1/2 can be factored out.

    This will give negative values for clockwise polygons, if I've
    got the signs right, so take the absolute value if appropriate.

Andrew