mirror of
https://github.com/yglukhov/rect_packer
synced 2026-01-02 08:34:43 +00:00
No description
| .gitignore | ||
| LICENSE | ||
| README.md | ||
| rect_packer.nim | ||
| rect_packer.nimble | ||
rect_packer 
Simple algorithm for packing rects into a bigger rect.
Usage
import rect_packer
let p = newPacker(1024, 1024)
let sizesToPack = [ (100, 100), (50, 50), (100, 50) ]
for i, s in sizesToPack:
let res = p.pack(s[0].int32, s[1].int32)
echo "Rect ", i, " coords: ", res
Output:
Rect 0 coords: (x: 0, y: 0)
Rect 1 coords: (x: 100, y: 0)
Rect 2 coords: (x: 150, y: 0)