u_geometry/lib.rs
1//! Domain-agnostic computational geometry library.
2//!
3//! Provides fundamental geometric primitives (2D and 3D), transformations,
4//! polygon operations, collision detection, and spatial indexing for the
5//! U-Engine ecosystem.
6//!
7//! # Modules
8//!
9//! - **`primitives`**: Core types — `Point2`, `Vector2`, `Segment2`, `AABB2`,
10//! `Point3`, `Vector3`, `AABB3`
11//! - **`polygon`**: Polygon operations — area, centroid, convex hull, winding
12//! - **`transform`**: Rigid transformations — `Transform2D`, `Transform3D`
13//! - **`robust`**: Numerically robust geometric predicates (Shewchuk)
14//! - **`collision`**: collision detection — SAT for convex polygons, exact
15//! overlap for concave simple polygons (`polygons_intersect`), AABB overlap
16//! (2D and 3D)
17//! - **`minkowski`**: Minkowski sum and NFP for convex polygons
18//! - **`spatial_index`**: Linear-scan spatial indices for 2D and 3D AABB queries
19//!
20//! # Architecture
21//!
22//! This crate sits at Layer 2 (Algorithms) in the U-Engine ecosystem.
23//! It contains no domain-specific concepts — nesting, packing, scheduling, etc.
24//! are all defined by consumers at higher layers.
25//!
26//! # References
27//!
28//! - de Berg, Cheong, van Kreveld, Overmars (2008), "Computational Geometry"
29//! - Shewchuk (1997), "Adaptive Precision Floating-Point Arithmetic"
30//! - O'Rourke (1998), "Computational Geometry in C"
31//! - Ericson (2005), "Real-Time Collision Detection"
32
33pub mod collision;
34pub mod minkowski;
35pub mod offset;
36pub mod polygon;
37pub mod primitives;
38pub mod robust;
39pub mod spatial_index;
40pub mod transform;
41
42#[cfg(feature = "wasm")]
43pub mod wasm;
44
45/// Re-exports of nalgebra types commonly used with this crate.
46///
47/// Consumers can import these directly instead of adding a separate
48/// `nalgebra` dependency, ensuring version consistency across the ecosystem.
49pub mod nalgebra_types {
50 pub use nalgebra::{
51 Isometry2, Isometry3, Point2 as NaPoint2, Point3 as NaPoint3, RealField, Rotation2,
52 Rotation3, UnitQuaternion, Vector2 as NaVector2, Vector3 as NaVector3,
53 };
54}