Expand description
§3D Planar B-Rep Boolean & Healing Kernel
Standalone 3D Stratified Tolerance Complex (polystrata) for 3D Planar Boundary-Representation
(B-Rep) solids with zero external dependencies.
§4-Stage Coupled 3D Stratified Tolerance Complex Architecture
- Stage 0 & 1 — 3D Normalization, Carrier Plane Clustering, & Locus Injection:
Centers the 3D bounding box at
(0, 0, 0), clusters coplanar input faces into canonical carrier planesπ_c = (O_c, U_c, V_c, N_c, d_c), and injects all input face boundary loops plus all 1D plane-plane intersection chordsL_{ab} = π_a ∩ π_binto a single global 3D(0, 1)-stratum graph(Vert3D, Edge3D). - Stage 2 — Coupled 3D 0-Stratum & 1-Stratum Fixpoint Consolidation:
Iteratively merges overlapping 3D vertex balls (
r_max-capped), contracts micro-edges, propagates affine plane incidence (u, v ∈ π_c ⟹ (u, v) ∈ π_c), splits 3D & co-carrier 2D T-junctions and segment intersections, and projects vertices onto their incident carrier planes via regularized 3×3 quadric minimization inside each vertex ball. - Stage 3 — Combinatorial 2-Stratum (
∂₂) & 3-Stratum (∂₃) Cellular Extraction:- Stage 3a (
∂₂): On each carrier planeπ_c, wires consolidated 3D edges into planar half-edge cycles to extract minimal 2DFacePatch3Dsheets with exact integer surface winding jumpsΔw_b(f_m). - Stage 3b (
∂₃): Strips open degree-1 flaps (∂₂2-core) and radially sorts incident face patches around every 3D edgeeby dihedral angleθaroundt_e, uniting the two CoFaces bounding each dihedral wedge into closed 3D Volume CellsS_v(∂₂ ∘ ∂₃ ≡ 0).
- Stage 3a (
- Stage 4 — Volume Cell Winding Classification,
b₂ = ∂₃ · c₃, & Option B Planarity: Classifies each 3D Volume CellS_vonce, extracts surviving boundary patches wherekeep(S_back) != keep(S_front), cancels internal coplanar seams, simplifies global 3D degree-2 collinear vertices, and splits any high-tolerance warped face along boundary-vertex diagonals into strictly planar triangles (Option B).
Structs§
- BRep
Result3D - Result of a 3D Planar B-Rep Boolean or healing operation.
- Face3D
- A planar 3D face consisting of one counter-clockwise (
CCW) outer loop (viewed from outside along the outwardnormal) and zero or more clockwise (CW) interior hole loops. - Kernel
Options - Configuration options for the 3D Stratified Tolerance Complex kernel.
- Point2D
- A 2D point in double-precision (
f64) carrier-plane coordinates. - Point3D
- A 3D point in double-precision (
f64) world coordinates. - Solid3D
- A 3D Planar B-Rep solid (or multi-shell collection) represented as a set of oriented planar faces.
Enums§
- Boolean
Op - Standard 2-body Boolean operation selector.
- Winding
Rule - Winding rule used to classify the interior of each input solid from its signed winding number
w:
Functions§
- clip
- Dispatch a 3D Boolean operation by
BooleanOp. - clip_3d
- Dispatch a 3D Boolean operation by
BooleanOp. - compute_
newell_ normal - Compute the unit normal of a 3D polygon loop via Newell’s method.
- difference
- Compute the 3D Boolean difference (
A \ B) of two planar B-Rep solids. - difference_
3d - Compute the 3D Boolean difference (
A \ B) of two planar B-Rep solids. - execute_
brep - Execute a custom N-body 3D Boolean predicate over the consolidated 3D cellular complex.
- execute_
brep_ 3d - Core 3D Planar B-Rep Boolean and healing execution engine.
- heal
- Heal a single 3D planar face soup / self-intersecting polyhedron into a watertight 2-manifold B-Rep.
- heal_3d
- Heal a single 3D planar face soup / self-intersecting polyhedron into a watertight 2-manifold B-Rep.
- intersect
- Compute the 3D Boolean intersection (
A ∩ B) of two planar B-Rep solids. - intersect_
3d - Compute the 3D Boolean intersection (
A ∩ B) of two planar B-Rep solids. - solid_
winding_ number - Evaluate the 3D generalized winding number
w(p)of aSolid3Dat query pointp. - triangulate_
face - Triangulate a 3D planar face (
outer+holes) via 2D ear-clipping on its carrier plane. - triangulate_
face_ 3d - Triangulate a 3D planar face (
Face3D) into oriented 3D triangles[a, b, c]matchingface.normal. - union
- Compute the 3D Boolean union (
A ∪ B) of two planar B-Rep solids. - union_
3d - Compute the 3D Boolean union (
A ∪ B) of two planar B-Rep solids. - wasm_
brep3d_ alloc_ input - wasm_
brep3d_ execute - Op codes: 0 = Union (A ∪ B) 1 = Intersect (A ∩ B) 2 = Difference (A \ B) 3 = Xor (A ⊕ B) 4 = Heal (Solid 0)
- wasm_
brep3d_ get_ out_ area - wasm_
brep3d_ get_ out_ coords_ len - wasm_
brep3d_ get_ out_ coords_ ptr - wasm_
brep3d_ get_ out_ edge_ count - wasm_
brep3d_ get_ out_ face_ count - wasm_
brep3d_ get_ out_ face_ normals_ ptr - wasm_
brep3d_ get_ out_ loop_ count - wasm_
brep3d_ get_ out_ loop_ meta_ ptr - wasm_
brep3d_ get_ out_ triangles_ len - wasm_
brep3d_ get_ out_ triangles_ ptr - wasm_
brep3d_ get_ out_ unmatched_ he_ count - wasm_
brep3d_ get_ out_ vertex_ count - wasm_
brep3d_ get_ out_ volume - xor
- Compute the 3D Boolean symmetric difference (
A ⊕ B) of two planar B-Rep solids. - xor_3d
- Compute the 3D Boolean symmetric difference (
A ⊕ B) of two planar B-Rep solids.