Combined area of overlapping circles
I'm sure there is a clever algorithm, but here's a dumb one to save having to look for it;
- put a bounding box around the circles;
- generate random points within the bounding box;
- figure out whether the random point is inside one of the circles;
- compute the area by some simple addition and division (proportion_of_points_inside*area_of_bounding_box).
Sure it's dumb, but:
- you can get as accurate an answer as you want, just generate more points;
- it will work for any shapes for which you can calculate the inside/outside distinction;
- it will parallelise beautifully so you can use all your cores.
Find all circle intersections on the outer perimeter (e.g. B,D,F,H on the following diagram). Connect them together with the centres of the corresponding circles to form a polygon. The area of the union of the circles is the area of the polygon + the area of the circle slices defined by consecutive intersection points and the circle center in between them. You'll need to also account for any holes.