I'm looking for an algorithm to calculate the area of various shapes (created out of basic shapes such as circles, rectangles, etc...). There are various possibilities such as the area of 2 circles, 1 triangular and 1 square (intersections possible). As you can see this gets quite complicated and requires a numeric solution.
Of course, there are various special cases which can be calculated without any problems, but just as there are simple cases, there are also complex structures.
The only thing which comes to my mind is to write an algorithm which fills these geometrical structures with small squares and sums them up, but maybe there are already some smarter solutions.
Maybe I could also put the whole geometrical shape in a rectangle, and approximate the outlines of my shapes, and then calculate the area outside of my shape, and afterwards subtract the calculated area from the area of the rectangle.
I'm quite confident that these methods would work; it's just a matter of efficiency.