I often need to arrange layers or files in minimal space on a 100cm wide document, heigth doesn't matter.
I'm curious if anyone know a tool which can do something like this in attachement, or know is it possible with JavaScript?
Auto Arrange
Auto Arrange
- Attachments
-
- script_question.jpg (198.28 KiB) Viewed 9723 times
- Jaroslav Bereza
- Posts: 38
- Joined: Tue Dec 27, 2016 7:22 pm
Re: Auto Arrange
Do you want only recangles or any shapes? Can you rotate shapes?
Re: Auto Arrange
all I use are files or raster layers but all of them are rectangles, squares etc. I used shapes in my attachement as an idea. Yes, rotation is main problem, because it can drastically improve space reduction.
Re: Auto Arrange
This problem is called "bin packing" and is NP-complete, meaning (simplified) that if you want the optimal result you have (for the moment) try all permutations - of which there are an exponential amount of. Thus, for large numbers of rectangles this problem becomes intractable.
You can resort to heuristics, of which there are quite a few. I can send you one if you like, feel free to send me a private message.
You can resort to heuristics, of which there are quite a few. I can send you one if you like, feel free to send me a private message.
- Jaroslav Bereza
- Posts: 38
- Joined: Tue Dec 27, 2016 7:22 pm
Re: Auto Arrange
You don't need reinvent wheel. Just try already made tool in JS.
https://github.com/jakesgordon/bin-packing
https://www.google.cz/search?rlz=1C1GGR ... CIBF2YcYJg
https://github.com/jakesgordon/bin-packing
https://www.google.cz/search?rlz=1C1GGR ... CIBF2YcYJg