Comments (3)
Ok I think I know what is happening.
Since the current implementation doesn't handle rotation it gives the impression of filling along the diagonal first but the packer just doesn't do that.
The packer is working as intended, is just it can't deal with an unsorted input very well in this particular case, the rectpack2D
uses a function that tries different input sortings to maximize the packing efficiency.
There is some weird input data out there...
from rectangle-pack.
Thanks for looking into this!
Since the current implementation doesn't handle rotation it gives the impression of filling along the diagonal first but the packer just doesn't do that.
I'd be happy to review a PR that adds rotation support. If you only need 2D rotation then we would just need Z-axis rotation support.
the rectpack2D uses a function that tries different input sortings to maximize the packing efficiency.
rectangle-pack
intentionally gives the user control of the heuristics used when packing.
We take in two functions that allow you to control how things are placed.
If you want to try multiple algorithms, you can just run multiple pack multiple times with different passed in heuristic functions.
Lines 139 to 140 in de824b1
To match rectpack2d
you would run rectangle-pack
six times so that you could compare using the 6 different algorithms that rectpack2d
uses (the user would need to provide the algorithm themself. I would also be open to a PR that exposes common heuristics)
rectangle-pack/src/box_size_heuristics.rs
Lines 10 to 13 in 99774a4
rectangle-pack/src/bin_section.rs
Lines 27 to 42 in de824b1
After you ran it six times you would need to compare the 6 to see which was packed the tightest.
This part isn't possible yet, but I'd be happy to review a PR that implements it.
https://github.com/chinedufn/rectangle-pack#stats-on-how-the-bins-were-packed
Thanks for opening this issue! Let me know if you're interested in any of the above and I'd be happy to provide any guidance needed on how to implement it.
Cheers!
from rectangle-pack.
hi chinedufn! Thanks for writing this crate, but I'm going in another direction.
from rectangle-pack.
Related Issues (4)
- Add license files HOT 1
- no_std support HOT 2
- version 0.2.1 has a breaking change HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rectangle-pack.