优化布局算法 [英] Optimal Layout Algorithm
问题描述
我实现了一个基于这篇文章中我的ASP.NET应用程序中的CSS精灵设置。
I'm implementing a CSS Sprites setup in my ASP.NET application based on this article..
的http:// weblogs.asp.net/zowens/archive/2008/03/05/css-sprite-for-asp-net.aspx
在部分中的获取精灵了!的......作者说...
In the section "Get the SPRITE already!"... the author says...
唯一真正的一面来,这是你所有的图片都排列垂直。我不太确定这个问题,但大多数其他发电机必须以某种方式行中的图像了垂直和水平的能力。
"The only real down side to this is that all your images are lined up vertically. I'm not quite sure that this matters, but most other generators have the ability to somehow line the images up vertically and horizontally."
我敢肯定,这必须是一个previously解决的问题,所以我的问题是,鉴于矩形的集合,你能有效地奠定了这些政策的最佳方法是什么?(我假设这取决于我的最佳定义,但作为最接近的可能以一个正方形作为开始。(虽然这实际上可能并不是这样。))另外,将需要事先所有矩形或可能这个逐步完成?
I'm sure this must be a previously solved problem so my question is, "Given a collection of rectangles, can you efficiently lay these out in an optimal way?" (I suppose it depends on my definition of optimal, but being the closest possible to a square as a start. (although this may not actually be the case.)) Also, would you need all the rectangles in advance or could this be done progressively?
我不是在寻找一个答案急,在文章的解决方案,工作得非常好。但我希望看到什么是可能的解决办法是什么样子。
I'm not looking for an answer urgently, as the solution in the article works very well. but I'm interested in seeing what a possible solution might look like.
感谢你。
推荐答案
It depends on your definition of "optimal". However, try looking at this and this.
这篇关于优化布局算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!