U-Nesting 2D
2D nesting algorithms for the U-Nesting spatial optimization engine.
This crate provides polygon-based 2D nesting with NFP (No-Fit Polygon) computation and various placement algorithms.
Features
- Polygon geometry with holes support
- Multiple placement strategies (BLF, NFP-guided, GA, BRKGA, SA)
- Convex hull and convexity detection
- Configurable rotation and mirroring constraints
- NFP-based collision-free placement
- Spatial indexing for fast queries
Quick Start
use ;
// Create geometries
let rect = rectangle
.with_quantity
.with_rotations_deg;
// Create boundary
let boundary = rectangle;
// Configure and solve
let config = new
.with_strategy
.with_spacing;
let nester = new;
let result = nester.solve.unwrap;
println!;
Geometry Creation
use Geometry2D;
// Rectangle
let rect = rectangle;
// Circle (approximated)
let circle = circle;
// L-shape
let l_shape = l_shape;
// Custom polygon
let custom = new
.with_polygon
.with_quantity;