Fit elements into box

走远了吗. 提交于 2019-12-11 20:51:07

问题


I want to achieve the effect shown in the images attached. Given certain items, fit them into a shape (box or something else), with the option to resize the items or not.

I know there has to be some algorithm related, but I don't know where to start looking.

Any keyword, wikipedia article, or pdf will be welcome.


回答1:


The problem, as NKamrath pointed out, was Bin packing problem, but more commonly refered to Texture Packing. Here are the resources I gathered:

  • http://en.wikipedia.org/wiki/Bin_packing_problem
  • http://www.blackpawn.com/texts/lightmaps/default.html
  • http://www.gamedev.net/topic/392413-rectangle-packing/
  • http://clb.demon.fi/projects/rectangle-bin-packing
  • http://clb.demon.fi/projects/more-rectangle-bin-packing
  • http://clb.demon.fi/files/RectangleBinPack.pdf


来源:https://stackoverflow.com/questions/11790287/fit-elements-into-box

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!