Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!psuvax1!gatech!rebel!didsgn!allan From: allan@didsgn.uucp (didsgn) Newsgroups: comp.graphics Subject: Re: Need an algorithm to calculate area of polygons Keywords: Polygon, algorithm Message-ID: Date: 5 Oct 89 21:08:17 GMT References: <484@ctycal.UUCP> Organization: Digital Design Incorporated Lines: 32 ingoldsb@ctycal.COM (Terry Ingoldsby) writes: >This is probably a trivial problem, and one that has been much >discussed, but I need an algorithm that will calculate (quickly) >the area of an arbitrary polygon. It would be *nice* if it could >handle objects that include arcs, instead of lines for the edges of >the `polygon'. I have to be able to handle complicated cases like > *--------------------------* > | *________________| > | | > | *_______* > | / > *_____* / > / / It's hard to draw diagonal lines! > */------* >Sorry if this is trivial or has been discussed ad nauseum before. If this is an image that has been stored in "pixel"-type memory, and not just a list of coordinates (i.e. given an arbitrary shape, determine the area of the shape), then I have a very simple approach that works fairly quickly (it depends on the length of the outside perimeter). As a side benifit, the perimeter of the object and knowledge as to whether it is a hole or an object is also given. If you're interested, I forward the details to anyone interested. -- Allan G. Schrum | Sign it? Without reading the fine print? Digital Design, Inc. |----------------------------------------- 3060 Business Park Drive | (404) 447-0274 Norcross, GA 30071 | ...!gatech!rebel!didsgn!allan