I want to create datapoints which form non overlapping circle shapes; so far I was able to generate randomly distributed circles but without considering the non-overlapping feature. How can I implement that these circles do not overlap while creating for example 2 (number_circles = 2) of them?
Asked
Active
Viewed 653 times
0
-
How many circles and how dense will you have? If the density is not too high, a simple brutal force approach (placing randomly circle one-by-one, for the new circle checking overlap with all already placed circles) should work – Jan Stránský Sep 22 '20 at 22:26
-
for the first step 2 circles without overlapping are enough; but in further stages I want to easily extend the number. The density is relatively high since the boundaries in x,y- direction are max = 10 and the radii are max = 2 @JanStránský – jeffs Sep 22 '20 at 22:42
-
Have a look at [a matlab solution](https://stackoverflow.com/questions/36177195/non-overlapping-randomly-located-circles) – Jan Stránský Sep 22 '20 at 22:55
-
Do you need all the circles fully inside the region, or just the center inside is ok? – Jan Stránský Sep 22 '20 at 23:30
1 Answers
1
Draw N centers randomly. For every center compute the distance to the nearest neighbor and assign half that distance as the radius (or a little less). This will ensure no overlap.
Note that you said nothing about the desired distribution of radii and this answer only fulfills the non-overlap constraint.