fast_mesh_fields/lib.rs
1//! Field kernels for meshes stored in [`fast_mesh_store`]: signed distances
2//! from points to a mesh, accelerated by its [`fast_mesh_bvh`] BVH and the
3//! closest-point query of [`fast_mesh_query`].
4//!
5//! - [`SignData`] holds what decides the sign of a distance for one mesh. It is
6//! built once per mesh revision by [`SignData::build`] in a [`SignMode`], and
7//! [`SignData::status`] reports the mesh's topology (closed or open,
8//! consistently oriented or not, non-manifold vertices, zero-area
9//! triangles) so that an application can warn about doubtful signs.
10//! [`SignData::winding_number`] gives the generalized winding number, fast
11//! in [`SignMode::Winding`] (Barill et al. 2018).
12//! - [`signed_distances`] writes, for every point, its distance to the mesh:
13//! positive outside (in front of the surface), negative inside (behind it),
14//! zero on it, and `+∞` beyond `max_distance`.
15//! - [`signed_distances_multi`] does the same against several [`Target`]
16//! meshes, each with its own placement, and keeps per point the smallest
17//! value and the target it came from.
18//!
19//! - [`color_of`] turns a field value into an RGBA8 colour under a
20//! [`ColorRule`] ([`Colormap`], range, optional centre, out-of-range rules).
21//!
22//! Everything works in the mesh's local `f32` coordinates. Kernels allocate
23//! only while building [`SignData`], never per point (with the `parallel`
24//! feature, large batches of points also get one buffer per chunk).
25//!
26//! With the `parallel` feature, [`SignData::build`] and large batches of
27//! [`signed_distances`] and [`signed_distances_multi`] run on rayon's pool.
28//! Every value is the same, bit for bit, with the feature on or off and for
29//! any thread count.
30
31mod color;
32mod curvature;
33mod distance;
34mod error;
35mod geom;
36mod multi;
37mod sign;
38#[cfg(test)]
39mod test_util;
40mod thickness;
41mod winding;
42
43pub use color::{ColorRule, Colormap, OutOfRange, color_of};
44pub use curvature::curvatures;
45pub use distance::signed_distances;
46pub use error::{FieldsError, Result};
47pub use multi::{Target, signed_distances_multi};
48pub use sign::{SignBuild, SignData, SignMode, SignStatus};
49pub use thickness::thicknesses;