0 Members and 2 Guests are viewing this topic.
X1 Y1X2 Y2X3 Y3X4 Y4X5 Y5X1 Y1
X1 Y1Y1*X2 / X2 Y2 \ X1*Y2Y2*X3 / X3 Y3 \ X2*Y3 Y3*X4 / X4 Y4 \ X3*Y4Y4*X5 / X5 Y5 \ X4*Y5Y5*X1 / X1 Y1 \ X5*Y1______ ______SumLeft SumRight
There is a really amazing algorithm for finding the area of ANY closed shape, not just triangles, if you know the coordinates of all the verticies. For instance, take any pentagon with verticies (X1,Y1) through (X5,Y5). You can find the area by listing the pairs clockwise and making the first point appear at the end too:Code: [Select]X1 Y1X2 Y2X3 Y3X4 Y4X5 Y5X1 Y1Then you multiply diagonally down on each side and find the sums of those 2 columns:Code: [Select] X1 Y1Y1*X2 / X2 Y2 \ X1*Y2Y2*X3 / X3 Y3 \ X2*Y3 Y3*X4 / X4 Y4 \ X3*Y4Y4*X5 / X5 Y5 \ X4*Y5Y5*X1 / X1 Y1 \ X5*Y1______ ______SumLeft SumRightThe area of the shape is simply the difference of these 2 sums: |SumLeft - SumRight|It even works if the lines pass through each other or the shape has holes in it.
Ah yes, I could be wrong, but I think I recall something like that done to find an approximate value for Pi
stuff
Or, use Hero's formula: Area = the square root of ( s (s-a) (s-b) (s-c) ) when a, b, and c are the three sides and s is the semi-perimeter ( 1/2(a+b+c) )
Quote from: ztrumpet on January 11, 2011, 05:32:30 pmOr, use Hero's formula: Area = the square root of ( s (s-a) (s-b) (s-c) ) when a, b, and c are the three sides and s is the semi-perimeter ( 1/2(a+b+c) )There's also a formula for cyclic quadrilaterals: area=sqrt(s-a)(s-b)(s-c)(s-d) where s=(a+b+c+d)/2 and a,b,c, and d are the side lengths of the cyclic quadrilateral.