Expand description
Rust Crate for 3-dimensional packing of boxes optimally along x, y or z, or all three axis.
§Example
let 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),
];
let mut my_instance = PackerInstance::new(
my_boxes.clone(), // Our boxes
Vector3D::new(500, 0, 500), // Our container size
true, // No rotations
(false, true, false), // Minimize height only
Sorting::descending_volume, // Our initial sorting heuristic
);
// for _ in 0..3 {
// match my_instance.pack_next() {
// Err(error) => println!("Error: {}", error),
// Ok(()) => {}
// }
// }
match my_instance.pack_all() {
Err(errors) => println!("Errors: {:#?}", errors),
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