u_nesting_d3/
lib.rs

1//! # U-Nesting 3D
2//!
3//! 3D bin packing algorithms for the U-Nesting spatial optimization engine.
4//!
5//! This crate provides box-based 3D packing with collision detection
6//! and various placement algorithms.
7//!
8//! ## Features
9//!
10//! - Box geometry with 6-orientation support
11//! - Multiple placement strategies (Layer, GA, BRKGA, SA, Extreme Point)
12//! - Mass and stacking constraints
13//! - Configurable orientation constraints (Any, Upright, Fixed)
14//! - Spatial indexing for fast collision queries
15//!
16//! ## Quick Start
17//!
18//! ```rust
19//! use u_nesting_d3::{Geometry3D, Boundary3D, Packer3D, Config, Strategy, Solver};
20//! use u_nesting_d3::geometry::OrientationConstraint;
21//!
22//! // Create boxes
23//! let box1 = Geometry3D::new("box1", 100.0, 50.0, 30.0)
24//!     .with_quantity(10)
25//!     .with_orientation(OrientationConstraint::Upright);
26//!
27//! // Create container
28//! let container = Boundary3D::new(500.0, 400.0, 300.0);
29//!
30//! // Configure and solve
31//! let config = Config::new()
32//!     .with_strategy(Strategy::ExtremePoint)
33//!     .with_spacing(1.0);
34//!
35//! let packer = Packer3D::new(config);
36//! let result = packer.solve(&[box1], &container).unwrap();
37//!
38//! println!("Placed {} boxes, utilization: {:.1}%",
39//!     result.placements.len(),
40//!     result.utilization * 100.0);
41//! ```
42//!
43//! ## Orientation Constraints
44//!
45//! ```rust
46//! use u_nesting_d3::{Geometry3D, geometry::OrientationConstraint};
47//!
48//! // Any orientation (6 rotations)
49//! let any = Geometry3D::new("b1", 10.0, 20.0, 30.0)
50//!     .with_orientation(OrientationConstraint::Any);
51//!
52//! // Upright only (2 rotations, height preserved)
53//! let upright = Geometry3D::new("b2", 10.0, 20.0, 30.0)
54//!     .with_orientation(OrientationConstraint::Upright);
55//!
56//! // Fixed (no rotation)
57//! let fixed = Geometry3D::new("b3", 10.0, 20.0, 30.0)
58//!     .with_orientation(OrientationConstraint::Fixed);
59//! ```
60//!
61//! ## Mass Constraints
62//!
63//! ```rust
64//! use u_nesting_d3::{Geometry3D, Boundary3D};
65//!
66//! let heavy_box = Geometry3D::new("heavy", 50.0, 50.0, 50.0)
67//!     .with_mass(10.0)
68//!     .with_quantity(5);
69//!
70//! let container = Boundary3D::new(200.0, 200.0, 200.0)
71//!     .with_max_mass(100.0);
72//! ```
73
74pub mod boundary;
75pub mod brkga_packing;
76pub mod extreme_point;
77pub mod ga_packing;
78pub mod geometry;
79pub mod packer;
80pub mod physics;
81pub mod sa_packing;
82pub mod spatial_index;
83pub mod stability;
84
85// Re-exports
86pub use boundary::Boundary3D;
87pub use geometry::Geometry3D;
88pub use packer::Packer3D;
89pub use physics::{PhysicsConfig, PhysicsResult, PhysicsSimulator};
90pub use spatial_index::{Aabb3D, SpatialEntry3D, SpatialIndex3D};
91pub use stability::{
92    PlacedBox, StabilityAnalyzer, StabilityConstraint, StabilityReport, StabilityResult,
93};
94pub use u_nesting_core::{Config, Error, Placement, Result, SolveResult, Solver, Strategy};