Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Distribute objects within a circle [duplicate]

Possible Duplicate:
How to pack squares into circles?

I have a problem where I need to fit a bunch of different sized rectangles within a circle. All the rectangles must fit in the circle without overlapping each other and without overflowing the circle.

Assuming the rectangles can fit inside the circle how would one develop an algorithm to distribute them inside the circle?

All I can think of is to randomly distribute the rectangles over and over and test whether the conditions are met (brute-force).

like image 548
George Reith Avatar asked May 22 '26 07:05

George Reith


1 Answers

It is a classic constraint problem, brute-force is one way to do it but there are other ways that can be better using things such as heuristics to help guide the algorithm to the solution. You would have to look up some constraint programming and bin packing papers on something like Google Scholar for some better algorithms.

Wikipedia has a good overview: http://en.wikipedia.org/wiki/Packing_problem

like image 177
Sean Dawson Avatar answered May 25 '26 16:05

Sean Dawson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!