Area of a Polygon
Andrew Myers
andru at electron.lcs.mit.edu
Tue Feb 5 05:46:18 AEST 1991
In article <Feb.3.19.12.39.1991.10354 at pilot.njin.net> psomu at 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
More information about the Comp.sys.sgi
mailing list