mesh_geometry/lib.rs
1#![cfg_attr(not(feature = "std"), no_std)]
2#![deny(missing_docs)]
3
4//! # mesh-geometry
5//!
6//! High-performance, no_std-compatible geometry primitives and metrics for spatially discrete meshes.
7//!
8//! ## Features
9//! - Core types: `Point2`, `Point3`, `Vec2`, `Vec3` with arithmetic, dot/cross, and conversion utilities.
10//! - Cell metrics: triangle/quad area, centroids, tetrahedron/hexahedron volume, face normals, projected area.
11//! - Geometry queries: point-in-polygon, ray-triangle intersection, point-to-cell distance.
12//! - Advanced utilities: Jacobians, AABB, 3D affine transforms.
13//! - `no_std` compatible (default: `std` enabled).
14//! - Comprehensive documentation and examples.
15//!
16//! ## Example: Compute Cell Volumes
17//!
18//! ```rust
19//! use mesh_geometry::{Point3};
20//! use mesh_geometry::tetrahedron_volume;
21//!
22//! let a = Point3::new(0.0, 0.0, 0.0);
23//! let b = Point3::new(1.0, 0.0, 0.0);
24//! let c = Point3::new(0.0, 1.0, 0.0);
25//! let d = Point3::new(0.0, 0.0, 1.0);
26//! let vol = tetrahedron_volume(a, b, c, d);
27//! assert!((vol - 1.0_f64/6.0_f64).abs() < 1e-12_f64);
28//! ```
29//!
30//! More examples: see [examples/](https://github.com/tmathis720/mesh-geometry/tree/main/examples) and the [README](https://github.com/your-org/mesh-geometry#examples).
31//!
32//! ## Documentation
33//! - [docs.rs/mesh-geometry](https://docs.rs/mesh-geometry)
34//!
35//! ## License
36//! MIT
37
38/// Prelude for ergonomic imports (core types, traits, and utilities).
39pub mod prelude;
40pub use prelude::*;
41
42/// Float trait alias for generic float support.
43pub mod float;
44pub use float::Float;
45
46/// 2D/3D point types and constructors.
47pub mod point;
48
49/// 2D/3D vector types and operations.
50pub mod vec;
51
52/// Cell metrics: area, centroid, volume, normals, polygon, prism
53pub mod metrics;
54pub use metrics::{
55 triangle_area, quad_area,
56 triangle_centroid, quad_centroid, tetrahedron_centroid, hexahedron_centroid,
57 tetrahedron_volume, hexahedron_volume,
58 face_normal, projected_area,
59 polygon_area, polygon_centroid,
60 prism_volume, prism_centroid,
61};
62
63/// Geometry queries: point-in-polygon, ray-triangle, distance, etc.
64pub mod queries;
65
66/// 3D affine transforms.
67pub mod transforms;
68
69/// Advanced utilities: Jacobians, AABB, etc.
70pub mod utils;
71pub use utils::{jacobian, aabb};