Expand description
Mesh boolean operations on triangle meshes.
Provides robust boolean operations (union, intersection, difference) on closed triangle meshes using:
- Triangle-triangle intersection detection — Möller’s separating axis test and segment/plane clipping.
- Contour extraction — intersection curves between two meshes.
- Surface splitting — re-triangulation of intersected faces.
- Inside/outside classification — generalised winding number.
- Co-planar triangle handling — projection-based merging.
- Mesh stitching — combining split surfaces into a watertight result.
- Result cleanup — degenerate triangle removal, vertex welding.
Structs§
- Intersection
Segment - An intersection segment between two meshes.
- Mesh
Stats - Compute mesh quality statistics.
- Simple
Mesh - A simple indexed triangle mesh using
[f64;3]vertices.
Enums§
- Mesh
Boolean Op - Boolean operation type.
- TriTri
Result - Result of a triangle-triangle intersection test.
Functions§
- classify_
triangles - Classify each triangle of a mesh as inside or outside another mesh.
Returns a boolean per triangle:
true= inside. - cleanup_
mesh - Full cleanup: weld, remove degenerates, remove unused.
- compute_
mesh_ stats - Compute statistics for a mesh.
- euler_
characteristic - Compute the Euler characteristic: V - E + F.
- extract_
intersection_ contours - Extract all intersection segments between two meshes.
- is_
inside - Classify whether a point is inside a closed mesh.
- is_
inside_ ray - Parity-based inside test using ray casting.
- is_
watertight - Check if a mesh is watertight (every edge shared by exactly 2 triangles).
- mesh_
boolean - Perform a mesh boolean operation.
- ray_
mesh_ intersection_ count - Count ray-mesh intersections for parity-based inside/outside.
- ray_
triangle_ intersect - Möller–Trumbore ray–triangle intersection.
Returns
Some(t)wheretis the ray parameter at intersection. - remove_
degenerate_ triangles - Remove degenerate triangles (zero-area or duplicate vertex indices).
- remove_
unused_ vertices - Remove unreferenced vertices and compact the index buffer.
- split_
triangle_ by_ plane - Split a triangle by a plane defined by (normal, point_on_plane). Returns (front_triangles, back_triangles) as vertex lists.
- stitch_
meshes - Combine two meshes into one, re-indexing the second mesh’s triangles.
- triangle_
triangle_ intersection - Test if two triangles intersect using Möller’s method.
- weld_
vertices - Weld vertices that are closer than
tolerance. Returns a new mesh with merged vertices. - winding_
number - Compute the generalised winding number of a closed mesh at point
p.