Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Implement maxrects packer #10

Merged
merged 14 commits into from
Jul 13, 2019
Merged

Implement maxrects packer #10

merged 14 commits into from
Jul 13, 2019

Conversation

happenslol
Copy link
Member

@happenslol happenslol commented Jun 28, 2019

This implements the MAXRECTS algorithm (using the best short side fit heuristic), as detailed in the paper A thousand ways to pack the bin by Jukka Jylänki. Since this code was ported pretty much directly from the CPP version, there's probably still improvements that can be made here and there, both in readability and safety.

To facilitate more complicated algorithms, the interface has been changed to allow returning multiple sprite sheets instead of just one, and adding options for a packer. The simple packer will behave exactly the same, and will output an arbitrarily big spritesheet as the first element.

What's still missing:

  • Some tests to make sure this always behaves as we want it to
  • A good CLI interface to use maxrects
  • More documentation
  • Bump version

sheep/src/pack/maxrects.rs Outdated Show resolved Hide resolved
sheep/src/pack/maxrects.rs Outdated Show resolved Hide resolved
sheep/src/pack/maxrects.rs Outdated Show resolved Hide resolved
sheep/src/pack/maxrects.rs Outdated Show resolved Hide resolved
sheep/src/lib.rs Outdated Show resolved Hide resolved
@happenslol
Copy link
Member Author

bors r+

bors bot added a commit that referenced this pull request Jul 13, 2019
10: Implement maxrects packer r=happenslol a=happenslol

This implements the MAXRECTS algorithm (using the best short side fit heuristic), as detailed in the paper [A thousand ways to pack the bin](https://github.com/juj/RectangleBinPack) by Jukka Jylänki. Since this code was ported pretty much directly from the CPP version, there's probably still improvements that can be made here and there, both in readability and safety.

To facilitate more complicated algorithms, the interface has been changed to allow returning multiple sprite sheets instead of just one, and adding options for a packer. The simple packer will behave exactly the same, and will output an arbitrarily big spritesheet as the first element.

What's still missing:

- [x] Some tests to make sure this always behaves as we want it to
- [x] A good CLI interface to use maxrects
- [x] More documentation
- [x] Bump version

Co-authored-by: Hilmar Wiegand <me@hwgnd.de>
@bors
Copy link
Contributor

bors bot commented Jul 13, 2019

Build succeeded

@bors bors bot merged commit 0f51e9d into master Jul 13, 2019
@happenslol happenslol deleted the implement-maxrects-packer branch July 13, 2019 20:53
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants