Generating random positions of irregular polylines and not overlap

As my topic title, I want to get a certain number of random positions of irregular polygons are generated i n a certain range (like rectangle), and the polygons cannot overlap. 

I have formed a  series of closed polylines by randomly the center coordinates of circles and finding point on every circle and sequentially connecting them.

Now, the difficulty is how to keep polylines from overlapping. My GH file have been attached. I think we can add some judgment between lines 53 and 54 of the python code in the GH file. But I have no specific algorithm experience and ideas, please give me some guidance.

random_and_irregular (11.2 KB)

random polygon (11.5 KB)


random_and_irregular (13.0 KB)

if you are used to use python coding then you could solve this in that code, the code is using a fixed 50 for random generation which is your point,BTW the problem is famous enough in stackoverflow for more than 3-dimention array(list) and solved in most efficient way using cKDTree (by a top ten user in that forum) which work perfectly using query_ball_point

without pufferfish:
random_and_irregular (14.3 KB)

Thanks for you generosity help, so NB HHHH! But I need some times to understand your GH file. Besides, I need to control the distribution of the polyline area over the whole region. :grinning:

Thanks for you generosity help! But the battery of remove overlapping circles belongs to the Plug-in of Nautilus, which seems to be a not-free plugin. So I will try to install this plugin and understand your GH file. :grinning:

well, Nautilus is freemium and the “removing overlapping circles” component is free means this script work with no worry, (in addition just a few component marked with dot in Nautilus is paid mostly used for heavy 3d printing,the good news is also those component produce “partly result” and you can see if the result suit your case which help for decide, at the other hand the owner is accessible discourse professional member :blush:)