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.

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.