Skip to main content

Crate fast_mesh_fields

Crate fast_mesh_fields 

Source
Expand description

Field kernels for meshes stored in fast_mesh_store: signed distances from points to a mesh, accelerated by its fast_mesh_bvh BVH and the closest-point query of fast_mesh_query.

  • SignData holds what decides the sign of a distance for one mesh. It is built once per mesh revision by SignData::build in a SignMode, and SignData::status reports the mesh’s topology (closed or open, consistently oriented or not, non-manifold vertices, zero-area triangles) so that an application can warn about doubtful signs. SignData::winding_number gives the generalized winding number, fast in SignMode::Winding (Barill et al. 2018).

  • signed_distances writes, for every point, its distance to the mesh: positive outside (in front of the surface), negative inside (behind it), zero on it, and +∞ beyond max_distance.

  • signed_distances_multi does the same against several Target meshes, each with its own placement, and keeps per point the smallest value and the target it came from.

  • color_of turns a field value into an RGBA8 colour under a ColorRule (Colormap, range, optional centre, out-of-range rules).

Everything works in the mesh’s local f32 coordinates. Kernels allocate only while building SignData, never per point (with the parallel feature, large batches of points also get one buffer per chunk).

With the parallel feature, SignData::build and large batches of signed_distances and signed_distances_multi run on rayon’s pool. Every value is the same, bit for bit, with the feature on or off and for any thread count.

Structs§

ColorRule
How a scalar field is turned into colours.
SignBuild
SignData::build cut into steps, so that a caller can yield between them: the mesh’s adjacency and incidence (when not cached), then each pass of the build, a bounded number of elements per step.
SignData
Per-mesh data that decides the sign of a distance, built by SignData::build for one revision of a mesh and one state of its BVH.
SignStatus
What SignData::build found out about a mesh, so that an application can warn when signs are doubtful.
Target
One mesh of signed_distances_multi, with what measuring to it reads.

Enums§

Colormap
A colormap from t in [0, 1] to RGBA8.
FieldsError
Why a field kernel could not run.
OutOfRange
What to show for a value outside the colour range.
SignMode
How the sign of a distance is decided.

Functions§

color_of
The colour of value v under rule.
curvatures
Per-vertex signed mean curvature of mesh: out[v] gets the value for vertex slot v (see the module docs), in 1/local-units. out must hold one entry per vertex slot.
signed_distances
Signed distances from points_in_b (in mesh B’s local coordinates) to mesh B: out[i] gets the value for points_in_b[i].
signed_distances_multi
Signed distances from points to the nearest of several targets, with the target each value came from: out[i] and nearest[i] get the value and the target index for points[i].
thicknesses
Per-vertex wall thickness of mesh: out[v] gets the value for vertex slot v (see the module docs).

Type Aliases§

Result
Result with FieldsError as the error type.