简体   繁体   中英

Circle In Rectangle Packing Algorithm

I need a packing algorithm that fits a set of circles of varying radii, if the circles fit, in a rectangle. I've seen various pages on Wikipedia and other sites, but the implementation itself is either too complicated or simply a mathematical theorem, neither of which I have the experience or knowledge to utilize.

Someone asked this question , which is sort of the inverse--I need circles in rectangles not vice versa, and I would prefer Java, not MATLAB, though I suppose if necessary I could port it.

Thanks!

EDIT:

I don't need to find the smallest rectangle in which the circles would fit, I just need to know if the circles would fit within a given rectangle with specified dimensions.

Google: algorithm, pack circles in rectangle http://www.jstor.org/stable/4102107 Shows up right underneath this stack overflow question. The jstor.org paper spells out a greedy circles in rectangle packing algorithm.

This problem is appears heavily related to bin packing and so I suspect it is NP-hard. So unfortunately I don't think there's a good algorithm for solving this efficiently (aka non-brute force).

I don't even think there's a good, simple, greedy way of approaching it.

There have been many research papers written on the subject though if you have access to them. Here is one: http://www.sciencedirect.com/science/article/pii/S0377221707004274

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM