Assuming a series of points in 2d space that do not self-intersect, what is an efficient method of determining the area of the resulting polygon?
As a side note, this is not homework and I am not looking for code. I am looking for a description I can use to implement my own method. I have my ideas about pulling a sequence of triangles from the list of points, but I know there are a bunch of edge cases regarding convex and concave polygons that I probably won’t catch.
Here is the standard method, AFAIK. Basically sum the cross products around each vertex. Much simpler than triangulation.
Python code, given a polygon represented as a list of (x,y) vertex coordinates, implicitly wrapping around from the last vertex to the first:
David Lehavi comments: It is worth mentioning why this algorithm works: It is an application of Green’s theorem for the functions −y and x; exactly in the way a planimeter works. More specifically:
Formula above =
integral_over_perimeter(-y dx + x dy) =integral_over_area((-(-dy)/dy+dx/dx) dy dx) =2 Area