位置,而像Exposé中位置、Expos

2023-09-11 02:21:47 作者:被自己萌哭了

有谁知道一种方法来定位矩形,以最适合某个地区?该矩形可以放大到一定限度,但他们应该保持它们的比例。 我基本上是要重建的Mac OSExposé功能: 图片

Does anyone know a way to locate rectangles to best fit a certain area? The rectangles can be scaled up to a certain limit, but they should keep their proportions. I basically want to rebuild Mac OS' Exposé: Picture

谢谢, eWolf

推荐答案

这个问题是NP难,但这只是为最佳解决方案。我猜你真正想要的是,只是看起来不错的解决方案。

The problem is NP Hard, but that is only for the optimal solution. What I guess you really want is a solution that just looks good.

所以我建议找算法,使数据看起来不错。有一次,我想布局的照片为的DeepZoom作曲家,我试图回收图绘制力相互作用的算法。 http://en.wikipedia.org/wiki/Force-based_algorithms

So I suggest looking for algorithms that make data look good. Once I wanted to layout pictures for the DeepZoom Composer and I tried to recycle a graph drawing force-interaction based algorithm. http://en.wikipedia.org/wiki/Force-based_algorithms

它的工作非常出色,甚至600百矩形,你就必须与模拟的细节发挥。

It worked really well even for 600 hundred rectangles, you just have to play with the details of the simulation.

如何的距离计算出来的? 您使用的吸引力和排斥力哪些功能怎么样? 在多少重叠你打算接受吗?

唯一的问题我解决不了全部,是矩形围成一个圆圈的形状,而不是一个大的矩形形状,这是很自然的,当你在模拟物理。但是,您可以解决与精心放置辅助动力源。

The only problem I could not solve entirely, was that the rectangles formed a circle shape, rather then a big rectangle shape, which is natural when you are simulating physics. But you can work around that with carefully placed auxiliary force sources.