lumen_geometry/lib.rs
1//! # Lumen Geometry
2//!
3//! Mathematical models for tubular anatomical structures.
4//!
5//! This crate provides pure math primitives for generating and querying
6//! the geometry of hollow organs like the colon, bronchi, and intestines.
7//! It has no game engine dependencies and can be used for:
8//!
9//! - Medical education and visualization
10//! - Surgical simulation
11//! - Anatomy research tools
12//! - Game development
13//!
14//! ## Core Concepts
15//!
16//! - **Lumen**: The interior space of a tubular organ (from Latin "light" or "opening")
17//! - **Centerline**: A parametric curve defining the path through the organ
18//! - **t-parameter**: Position along the curve, normalized to [0.0, 1.0]
19//! - **Haustra**: Pouch-like segments in the colon wall
20//!
21//! ## Quick Start
22//!
23//! ```rust
24//! use lumen_geometry::colon::{ColonCurve, ColonConfig};
25//! use lumen_geometry::TubularCurve; // Trait for position_at, tangent_at, etc.
26//!
27//! // Create a colon with default anatomical parameters
28//! let config = ColonConfig::default();
29//! let colon = ColonCurve::new(&config);
30//!
31//! // Query positions along the centerline
32//! let rectum = colon.position_at(0.0); // Entry point
33//! let mid_transverse = colon.position_at(0.5);
34//! let cecum = colon.position_at(1.0); // End (appendix area)
35//!
36//! // Get wall position including haustra bulges
37//! let wall_point = colon.wall_position_at(0.3, std::f32::consts::PI);
38//! ```
39//!
40//! ## Anatomical Accuracy
41//!
42//! The colon model follows real anatomy:
43//!
44//! ```text
45//! Hepatic Flexure ─┐ ┌─ Splenic Flexure
46//! │ │
47//! Ascending ───────┤ ├─── Descending
48//! │ │
49//! Cecum ───────────┘ │
50//! │
51//! Transverse ──┴─── Sigmoid ─── Rectum
52//! ```
53//!
54//! Each segment has characteristic:
55//! - **Length**: How much of the total path it occupies
56//! - **Radius**: Lumen diameter varies by section
57//! - **Curvature**: Flexures are sharp bends; other sections are gentler
58//! - **Haustra**: Pouch frequency and depth vary by region
59
60pub mod colon;
61mod curve;
62mod segment;
63
64pub use curve::TubularCurve;
65pub use segment::AnatomicalSegment;
66
67/// Re-export glam types for convenience.
68pub mod math {
69 pub use glam::{Quat, Vec3};
70}