brepkit_geometry/sampling/mod.rs
1//! Adaptive and uniform curve/surface sampling.
2//!
3//! # Uniform sampling
4//!
5//! [`sample_uniform`] and [`sample_uniform_with_params`] divide a parameter
6//! range into equal-size steps and evaluate the curve at each step. This is
7//! fast but may under-sample highly curved regions.
8//!
9//! # Deflection-based (adaptive) sampling
10//!
11//! [`sample_deflection`] uses recursive midpoint subdivision: it measures the
12//! perpendicular distance from the true curve point at each interval midpoint
13//! to the straight chord between the interval endpoints. If that distance
14//! (the "sag") exceeds `max_deflection`, the interval is split in two. This
15//! guarantees that every chord's midpoint deviation is within the requested
16//! tolerance.
17//!
18//! # Arc-length parameterized sampling
19//!
20//! [`sample_arc_length`] places `n` points at approximately equal arc-length
21//! spacing. It builds a fine chord-length table (256 segments) and bisects to
22//! find the parameter at each target fraction.
23//!
24//! # Curvature-adaptive sampling
25//!
26//! [`sample_curvature`] subdivides intervals where the product of curvature
27//! and interval arc-length exceeds a tolerance. Produces denser samples in
28//! high-curvature regions of a NURBS curve.
29//!
30//! # Surface grid sampling
31//!
32//! [`surface_grid`] evaluates a regular N×M grid of points over a parametric
33//! surface domain.
34//!
35pub mod arc_length;
36pub mod curvature;
37pub mod deflection;
38pub mod surface;
39pub mod uniform;
40
41pub use arc_length::sample_arc_length;
42pub use curvature::sample_curvature;
43pub use deflection::sample_deflection;
44pub use surface::surface_grid;
45pub use uniform::{sample_uniform, sample_uniform_with_params};