Expand description
Rust Crate for 3-dimensional packing of boxes optimally along x, y or z, or all three axis.
§Example
let mut my_boxes = vec![
Box3D::from_xyz_whl(0,0,0,100,200,300,1,0),
Box3D::from_xyz_whl(0,0,0,100,200,300,2,0),
Box3D::from_xyz_whl(0,0,0,100,200,300,3,0)
];
// Create our packer instance
let mut my_instance = PackerInstance::new(
&mut my_boxes, // Our boxes
Vector3D::<u64>::new(500, 0, 500), // Our container size
true, // Allow rotations
(false, true, false), // Minimize height only
&Sorting::descending_volume // Our initial sorting heuristic
);
// Pack all 3 boxes
for _ in 0..3 {
match my_instance.pack_next() {
Err(error) => println!("Error: {}", error),
Ok(()) => {}
}
}
println!("{:#?}", my_instance.boxes());Modules§
- box3d
- 3-dimensional box
- sorting
- Sorting functions used by PackerInstance
- vector3d
- 3-dimensional vector
Structs§
- Packer
Instance - Example
Type Aliases§
- Hash
SetFnv - Hash Set using fnv: an implementation of the Fowler–Noll–Vo hash function.
- Minimize
- Minimize tuple