Percentage of Area of Manifold of Two Circles vs Another?

63 Views Asked by At

Is there a simple algorithm for determining the percentage of area within a circle which is overlapped by the hull formed by two other arbitrarily placed circles, if any? An example of this would be the image below:

example

In this example I'm trying to determine the percentage of the total area of the green circle covered by the hull of the red+blue circles (shown in orange.)

1

There are 1 best solutions below

2
On

Given the three circles with their centers $(a_x,a_y) \; (b_x,b_y) \; (c_x,c_y)$ and radius $r$ we determine the percentage of $C$ covered by the hull of $A$ and $B$ by first calculating the distance $d$ between the line $\overline{AB}$ and $C$:

$$m=\frac{a_y-b_y}{a_x-b_x} \qquad d=\frac{|c_y-m(c_x-a_x)-a_y|}{\sqrt{1+m^2}}$$

We then calculate the percentage with the following integral for $d < 2r$:

$$\frac{1}{\pi} \int_{-r}^r \sqrt{r^2-(x-d)^2} \text{ d}x = \frac{1}{\pi} \left[ \arcsin \left(1-\frac{d}{r} \right)+ \frac{r-d}{r^2} \sqrt{d(2r-d)} \right] + \frac{1}{2}$$

To make sure $C$ is actually between $A$ and $B$ the distance between $C$ and the perpendicular bisector of $\overline{AB}$ needs to be less than half the length of $\overline{AB}$:

$$\frac1{\sqrt{1+\frac{1}{m^2}}} \left( 2c_y-a_y-b_y-\frac{a_x+b_x-2c_x}{m} \right) < \sqrt{(a_x-b_x)^2+(a_y-b_y)^2}$$

Now you just have to iterate over all triples of circles.