是否有一个C ++源/ lib下解决2D斌用矩形仓(不是正方形)和旋转包装?正方形、矩形、有一个、不是

2023-09-11 03:06:17 作者:柚子味的诗

正如标题已经说我需要的C / C ++源$ C ​​$ C或者说我可以用它来解决装箱问题,二维矩形,其中容器也是长方形,长方形也正在旋转90°图书馆°的角度,以适应更好。我已经把所有必需的值,所以我不需要在网上包装算法。

As the title already says I need C/C++ sourcecode or a library that I can use to solve the Bin Packing problem with 2D rectangular shapes where the bin is also rectangular and the rectangles are also being rotated by 90° angles to fit better. I already have all required values, so I need no online packing algorithm.

我只找到一个lib,与方形bin和处理不旋转这是不是真的够有效满足我的需求。

I only found a lib that deals with a square bin and without rotation which is not really efficient enough for my needs.

我真的AP preciate什么C / C ++处理矩形箱​​和旋转。

I would really appreciate anything C/C++ handling a rectangular bin and rotation.

感谢。

PS:此计算所需的时间是不重要的,只是其结果是

PS: The required time for the calculation is not important, only the result is.

PPS:它必须是C或C ++,而我没有发现搜索有用的东西计算器...

PPS: It has to be C or C++, and I didn't find anything useful searching stackoverflow...

推荐答案

http://clb.demon.fi/files/RectangleBinPack.pdf是关键。这是二维装箱的的参考。

http://clb.demon.fi/files/RectangleBinPack.pdf is key. That is the reference on 2d bin packing.

您也许可以修改的算法之一在那里,以满足您的需要。我怀疑轮换是必要的,算法是pretty的先进的,因为它们。

You might be able to modify one of the algorithms in there to satisfy your need. I doubt the rotation is needed, the algorithms are pretty advanced as they are.

不妨再张贴这个是如何实现的例子该MaxRects算法。

Might as well post this again as an example of how to implement the MaxRects algorithm.

您可能将不得不作出的修改是在算法,选择下一个矩形时使用的顶部。只要有它也看矩形的不同取向以及通过整个列表循环。

The modification you would probably have to make is at the top of the algorithm, when selecting the next rectangle to use. Simply have it also look at the different orientation of the rectangles along with cycling through the whole list.