算法需要一个矩形范围内均匀分布的矩形矩形、范围内、算法、均匀

2023-09-11 03:57:18 作者:感谢毁我熱情

我在寻找一种算法,可以帮助较大的矩形内分配不同大小的矩形,同时尽量减少重叠的。

I am looking for an algorithm that can help distribute different sized rectangles within a larger rectangle while minimizing overlapping.

我已经看过装箱算法,但他们似乎尽量减少空间矩形之间的量(在我的情况下,所有的被包装将是正方形的项目)。

I have looked at bin packing algorithms, but they seem to minimize the amount of space between rectangles (in my case the all of the items being packed will be squares).

我想我要最大限度地发挥所有的广场和外矩形边框之间的距离。

I guess I want to maximize the distance between all squares and the border of the outer rectangle.

下面是什么,我试图做一个例子:

Here is an example of what I am trying to do:

推荐答案

如果你收拾他们尽可能紧,使用类似的此处描述,那么一个扩展均匀涂抹于目标外接矩形搭配?

What if you packed them as tightly as possible, using an algorithm like the one described here, then expanded evenly to match the target enclosing rectangle?

举例来说,假设您可包3矩形上方成 3×2 框,你的外包装箱为 7X5 。将做好的载体从箱子里中心到每个矩形的中心,并通过乘以x分量(7/3),并通过y分量(5/2 ),而这使得新中心。

For example, say you can pack the 3 rectangles above into a 3x2 box, and your outer box is 7x5. Then take the vector from the center of the box to the center to each rectangle, and multiply the x component by (7/3), and the y component by (5/2), and that gives the new center.

 
精彩推荐
图片推荐