Algorithm for fitting 2D polygons in an area?
Is there a standard for this? Algorithm name?
Say: I have 10 polygons of different sizes. I have an area of specific size.
I want to know how to fill the most polygons in that area, and how they are fitted.
Note: Polygon开发者_StackOverflow社区s may be rotated depending on the restriction set.
One possible name is a Packing Problem. It is related to the Knapsack Problem. These problems tend to be NP-hard, and many require heuristics. If you can constrain the allowed forms of polygons and of the area, there may exist a more efficient algorithm for your special case.
You can have a look at "Dancing Links" in Wikipedia for Donald Knuth's solution to the exact cover problem - which includes tiling - your question can be looked at as a tiling problem
IF (that's a big if) all your polygons were rectangles, and the area into which they are to fit is also a rectangle, then this would be called bin-packing, Google will overwhelm you with information about this. If they're not then I guess that you are looking for a variant of bin-packing, and I guess some more that you are into an NP problem for which 'try and test' is about the best algorithm around.
精彩评论