Fitting circles inside a polygon

Apologies, I don’t have a brain. Can someone please help me figure out a good way to write this function? (or does anyone know where something close to this has already been coded?)

I will be needing to fit 3 specific sizes of circles within pre-defined polygons. (looking to randomly spawn - stack terrain models on top of each other given polygon borderlines I draw on the top of each model) see image example below. Thanks.

@Cedric might have some tricks for this but you might look into general algo for creating texture atlas or best fit in general ?

@JohnK might have some nice tricks as well

I do not know any on the top of my head :frowning:

1 Like

I did a quick research but didn’t find anything.

I would try by an iterative algorithm. Starting with all position with the smallest radius then increasing the radius per position until it collides with another circle.
complexity is O(n2) , do not great if you havce 1000s of positions.