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.
5//!
6//! # Modules
7//!
8//! - **`primitives`**: Core types — `Point2`, `Vector2`, `Segment2`, `AABB2`,
9//! `Point3`, `Vector3`, `AABB3`
10//! - **`polygon`**: Polygon operations — area, centroid, convex hull, winding
11//! - **`transform`**: Rigid transformations — `Transform2D`, `Transform3D`
12//! - **`robust`**: Numerically robust geometric predicates (Shewchuk)
13//! - **`collision`**: collision detection — SAT for convex polygons, exact
14//! overlap for concave simple polygons (`polygons_intersect`), AABB overlap
15//! (2D and 3D)
16//! - **`minkowski`**: Minkowski sum and NFP for convex polygons
17//! - **`spatial_index`**: Linear-scan spatial indices for 2D and 3D AABB queries
18//!
19//! # Architecture
20//!
21//! This crate is a general-purpose geometry layer: it contains no
22//! domain-specific concepts — nesting, packing, scheduling and the like are
23//! defined by whatever consumes it.
24//!
25//! # References
26//!
27//! - de Berg, Cheong, van Kreveld, Overmars (2008), "Computational Geometry"
28//! - Shewchuk (1997), "Adaptive Precision Floating-Point Arithmetic"
29//! - O'Rourke (1998), "Computational Geometry in C"
30//! - Ericson (2005), "Real-Time Collision Detection"
31
32pub mod collision;
33pub mod minkowski;
34pub mod offset;
35pub mod polygon;
36pub mod primitives;
37pub mod robust;
38pub mod spatial_index;
39pub mod transform;
40
41#[cfg(feature = "wasm")]
42pub mod wasm;
43
44/// Re-exports of nalgebra types commonly used with this crate.
45///
46/// Consumers can import these directly instead of adding a separate
47/// `nalgebra` dependency, ensuring version consistency across the ecosystem.
48pub mod nalgebra_types {
49 pub use nalgebra::{
50 Isometry2, Isometry3, Point2 as NaPoint2, Point3 as NaPoint3, RealField, Rotation2,
51 Rotation3, UnitQuaternion, Vector2 as NaVector2, Vector3 as NaVector3,
52 };
53}
54
55// The README's Rust examples are the first code most users copy, so they are
56// compiled and run with the doc-tests. Without this they were checked by
57// nothing.
58#[cfg(doctest)]
59#[doc = include_str!("../README.md")]
60pub struct ReadmeDoctests;