Here is the image what i'm trying to do.
I want to calculate the area of pink area. As you can see the circles have the same radius and their positions are known.
I've already tried calculating intersecting area of two circles and just do: fullArea - intersectArea / 2
. But this doesn't working on more than two circles because intersection areas might overlap how you can see on image.
So basically i need to calculate intersection of intersections. Or what? Also i have much more than 3 circles but i don't think that it matters.
I need this to calculate the area of circle that i scratched. Basically i have big circle for scratch and many inside when scratching. A have to calculate if small circles occupy more than 75 percent of big.
The calculations have to be done in computer program.
Answer
You are given as input, a large number of circles (e.g., possibly as many as $25$) in the $xy$-plane, of equal radius.
The common radius is specified, as well as the locations of the centers, presumably with all numerical values given in decimal format.
The goal is to compute the area of the portion of some specified disk (the pink disk) which does not intersect the union of the other disks.
Assuming the locations of the centers is arbitrary, with no pattern known in advance, I think the best approach is to approximate the area via a simulation.
Here is an outline . . .
Let $r$ be the given radius, and let $(h,k)$ be the center of the pink disk.
Start by bounding the pink disk, as tight as possible, in a square $S$ of side length $2r$, given algebraically by
\begin{cases}
h-r \le \;x\; \le h+r\\[4pt]
k-r \le \;y\; \le k+r\}\\
\end{cases}
Next, initialize a variable $w=0$.
Loop $n$ times, where $n$ is large, say $n=10^6$.
In each iteration:
- Choose a uniformly random point $P\in S$.$\\[2pt]$
- Determine algebraically whether or not $P$ is in the pink disk. If $P$ is not in the pink disk, skip to the next iteration.
- Set a variable overlap=false.$\\[2pt]$
- In an inner loop, for each disk $D$ other than the pink disk, determine algebraically whether or not $P\in D$. If $P\in D$, set overlap=true, and exit the inner loop.$\\[2pt]$
- Back in the main loop, if overlap is false, set $w=w+1$.$\\[2pt]$
When the loop is complete:
- The approximate area of the (visible) pink region is $\bigl({\large{\frac{w}{n}}}\bigr)(4r^2)$.
No comments:
Post a Comment