I use the line tool to draw shapes like convex and concave polygons - what's
the best way to calculate the area of each of these? I don't want to
re-invent the wheel and I bet there are many ways... Is anybody willing to
share their insights?
OK - this is easy actually.
So long as the shapes do not have lines which cross you are all set.
What you want to do is to go around the polygon and calculate the area
of trapazoids from each line segment down to the X axis. You go all
the way around and while the trapazoids from line segments at the top
will have area including area totally under the polygon, the
trapazoids at the bottom will cancel this out.
So Formula for each trapzoid is : Width * Average Height
(X2-X1) * (Y2+Y1) / 2
Make sure you take absolute value at the end - this way you don't
need to worry about going clockwise vs counterclockwise around
polygon.
I hope this is helpful.
Best wishes on your project
* * Please include a copy of this message with your reply
-----
Jeff Bennett
jeff @ Bennet-Tec.Com
* Bennet-Tec Information Systems, Inc
* 50 Jericho Tpk, Jericho, NY 11753
* Phone 516 997 5596, Fax - 5597
*
WWW.Bennet-Tec.Com
RELIABLE Component Software
and Custom Software Development Services
* Expert Systems * Text Processing
* Databases * Interactive Web Sites
* Diagramming, Drawing, Hotspot Graphics
* Data Input & Data Presentation Systems
* Desktop Windows, Tablets, Pocket PCs
TList(tm) / ALLText(tm) / MetaDraw(tm) / Web Signature(tm)
=================== ===================