title: matlab: area under overlapping circles
body: <p>I have a question to you... </p>
  
  <p>Imagine square with size A x A. Now lets simulate circles with diameter of d, randomly distributed within this square, something like on the image below (in this case d's are the same, but its not the rule, they might be also randomly distributed within some range like d1 to d2). </p>
  
  <p><img src="https://i.stack.imgur.com/EiOQO.jpg" alt="simulation example"></p>
  
  <p>Lets say that circles are described in matrix as:</p>
  
  <pre><code>circles(1, :) = [x, y, d]; 
  circles(2, :) = [x, y, d]; 
  ...and so on
  </code></pre>
  
  <p>where <code>x</code>, <code>y</code> are coordinates, <code>d</code> is diameter. Now the question is, how to simulate this circles, until given crowding parameter <code>c</code> is reached? <code>c</code> is simply defined as: <code>c = yellow area / square area (in this case A^2)</code>. </p>
  
  <p>And the second thing - lets say that everything is simulated and I want to check if some coordinate (x,y) is within or outside yellow area... How to do it? I was doing it by checking if my (x,y) is within area of each circle (but its getting more difficult when instead of circles I use i.e. round shape rectangles), one by one, but there must be some better way of doing it. 
  Thanks for help : )</p>