3 ms·
the area enclosed by a simple closed curve is the determinant of the co-ordinates in order (including the last pair being the same as the first pair to close it
by airbreather 5y ago
the area enclosed by a simple closed curve is the determinant of the co-ordinates in order (including the last pair being the same as the first pair to close it) divided by -2, the answer will be positive clockwise and negative anti-clockwise
the clockwise/anti clockwise is very handy as it allows an annulus to be excised from an area bounded by another simple closed curve
if, from the enclosing curve, you go into the annulus and out again on a co-incident line then this is zero area and you can take the determinant all in one hit and get areas of complex combinations of shapes.
this is extremely handy in so many ways, eg "is this point in side this shape?" - add the point into the co-ord list and see if the area increases or decreases
you need to be a little clever where you put the point in the order of the coord list, good start is to find two nearest consecutive neighbours