Area of polygon

Started by
11 comments, last by MButchers 20 years, 2 months ago
you were right , i doubled the triangle ;-)

Advertisement
I think I have a simpler method for finding the area of a polygon in 2D.

For every line (x1,y1)-(x2,y2) calculate (x1-x2)*(y1+y2)/2. Add this up for every line segment. Simple, isn''t it.

I''ll do an example (to check that it works!)
A quadralateral (0,0)-(5,0)-(-2,4)-(-2,-3)-(0,0):
(0,0)-(5,0) (0 - 5)*(0 + 0) = 0
(5,0)-(-2,4) (5 - -2)*(0 + 4) = 28
(-2,4)-(-2,-3) (-2 - -2)*(4 + -3) = 0
(-2,-3)-(0,0) (-2 - 0)*(-3 + 0) = 6
Area = (0 + 28 + 0 + 6)/2 = 17.

Yep, it works. I did choose an example which gave me 0''s, but the method works, with any number of sides. If you go around clockwise, you get the negative result.

If you''re in 3 dimensions, you can''t do this. But chances are if you''ve got a polygon you''ve worked it out in 2D anyway.

Speaking of three dimensions, did you know that Pythagoras'' theorem works for area of a right angled pyramid? The three small sides must all have a right angle, eg a pyramid on the floor, flat against two walls meeting at right angles. The square of the AREAS of the three small sides equal the square of the AREA of the large side, which is diagonal in all 3 directions.

With this in mind, if you are in 3D coords (and if you are your vertices have to be in the plane else it isn''t a proper polygon) you might be able to use this method anyway. Calculate the area looking from the z-direction by ignoring all the z-values. Then get the area looking from the two other directions. Clockwise/anticlockwise won''t matter because you''ll be squaring it anyway. So you square these three areas, add them together, get the square root of the total, and you''ve got the whole area.
The method just presented is the Green''s Theorem. Kudos for figuring this out just by yourself if that is indeed the case!

This topic is closed to new replies.

Advertisement