| Crates.io | smol-atlas |
| lib.rs | smol-atlas |
| version | 0.1.0 |
| created_at | 2025-11-28 18:33:01.880756+00 |
| updated_at | 2025-11-28 18:33:01.880756+00 |
| description | 2D rectangular bin packing with optional item removal |
| homepage | |
| repository | https://github.com/cijiugechu/smol-atlas |
| max_upload_size | |
| id | 1955849 |
| size | 40,112 |
smol-atlasPack rectangles into a fixed-size 2D atlas with item removal. Uses the Shelf Best Height Fit heuristic; shelves never merge or move, and free spans inside a shelf are tracked to reuse space.
use smol_atlas::Atlas;
let mut atlas = Atlas::new(256, 256);
let a = atlas.add(64, 32).expect("fits");
let b = atlas.add(32, 32).expect("fits");
println!("a at ({}, {})", atlas.item_x(a).unwrap(), atlas.item_y(a).unwrap());
atlas.remove(b);
let c = atlas.add(32, 32).expect("reuses space");
assert_eq!(atlas.item_y(c), atlas.item_y(a)); // likely same shelf