In comp.lang.pascal.delphi.misc message <a306d243-b288-4b1d-a5a0-6b214de
Post by PGHi,
I have a series of approx. 40 points (x,y) that make up an irregular
shape.
Is there a simple library / function that I can call that will
calculate the enclosed area of this shape?
If you can pick one point within or on the edge of the area from which
the points appear everywhere concave (approximate example, the Isle of
Wight - Newport, but not Yarmouth or either side of Cowes), then you can
draw imaginary lines from that point to each of the 40 (or 39),
splitting it up into triangles. The area of a triangle is easy enough,
for example by Root s s-a s-b s-c, and you can add them all together.
Everywhere concave is in fact too strong; the need is to be able to see
all of the inside of the border from the point. Otherwise, there will
have to be subtractions.
There will probably be a better way, and that probably does not matter.
Google for area of a many-point irregular polygon soon finds
http://en.wikipedia.org/wiki/Polygon which gives sufficient answers for
most cases.
--
(c) John Stockton, nr London UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
<http://www.merlyn.demon.co.uk/> TP/BP/Delphi/&c., FAQqy topics & links;
<http://www.merlyn.demon.co.uk/clpb-faq.txt> RAH Prins : c.l.p.b mFAQ;
<ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip> Timo Salmi's Turbo Pascal FAQ.