困难:二维装箱算法将一个长方形的x,y位置? [英] Difficult: 2d-bin-packing Algorithm to place a rectangle in x,y location?

查看:1943
本文介绍了困难:二维装箱算法将一个长方形的x,y位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个专业的问题..

I have a question for professionals..

我实现2D-装箱算法在画布上。我的任务是把矩形作为最佳的,因为它可以在画布上。

I am implementing 2d-bin-packing algorithm in canvas. My task is to place rectangles as optimal as it can be on a canvas.

下面展示了如何做到这一点: http://incise.org/2d-bin-packing-with -javascript和 - canvas.html

the following shows how to do it: http://incise.org/2d-bin-packing-with-javascript-and-canvas.html

但,它开始与原点。我想告诉算法在那里把一个矩形,并且下一个不被他的上面。

BUT, it starts with the origin. I would like to tell the algorithm where to put a rectangle and that the next one not to be on top of him.

我应该在code可以更改吗?

What should be changed in the code?

有另一种算法来使用呢?

Is there another algorithm to use for it?

谢谢!

推荐答案

我知道一个更好的算法(在紧凑性方面,而不是速度)比你联系到被称为MaxRects。

I know a better algorithm(in terms of compactness, not speed) than the one you linked to is called MaxRects.

是我在C ++中实现它。虽然不是很快,这是非常有效的包装简洁。

This was my implementation of it in C++. While not fast, it was very effective at packing compactly.

是一个PDF讨论和比较各种算法在时间和紧凑性方面。

This is a pdf discussing and comparing all sorts of algorithms in terms of both time and compactness.

编辑:

我扔在一起的图像使用MaxRects包装为例

I threw together an example of an image packed using MaxRects .

这篇关于困难:二维装箱算法将一个长方形的x,y位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆