Skip to main content

Crate polystrata_3d

Crate polystrata_3d 

Source
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

  1. 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 chords L_{ab} = π_a ∩ π_b into a single global 3D (0, 1)-stratum graph (Vert3D, Edge3D).
  2. 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.
  3. 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 2D FacePatch3D sheets 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 edge e by dihedral angle θ around t_e, uniting the two CoFaces bounding each dihedral wedge into closed 3D Volume Cells S_v (∂₂ ∘ ∂₃ ≡ 0).
  4. Stage 4 — Volume Cell Winding Classification, b₂ = ∂₃ · c₃, & Option B Planarity: Classifies each 3D Volume Cell S_v once, extracts surviving boundary patches where keep(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§

BRepResult3D
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 outward normal) and zero or more clockwise (CW) interior hole loops.
KernelOptions
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§

BooleanOp
Standard 2-body Boolean operation selector.
WindingRule
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 a Solid3D at query point p.
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] matching face.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.