9.3
111 3D: Checking and repairing mesh orientation
3D reference map · First 3D picture
struct
(struct mesh3d-duplicate-triangle ( first-triangle-index duplicate-triangle-index winding) #:transparent) first-triangle-index : exact-nonnegative-integer? duplicate-triangle-index : exact-nonnegative-integer? winding : (or/c 'same 'reversed)
Records a later triangle that has the same three indexed vertices as an earlier
one, independent of cyclic rotation.
struct
(struct mesh3d-analysis ( vertex-count triangle-count edge-count degenerate-triangles duplicate-triangles boundary-edges boundary-loops nonmanifold-edges inconsistent-winding-edges connected-components isolated-vertices signed-component-volumes watertight? orientable? consistently-wound?) #:transparent) vertex-count : exact-nonnegative-integer? triangle-count : exact-nonnegative-integer? edge-count : exact-nonnegative-integer? degenerate-triangles : vector? duplicate-triangles : vector? boundary-edges : vector? boundary-loops : vector? nonmanifold-edges : vector? inconsistent-winding-edges : vector? connected-components : vector? isolated-vertices : vector? signed-component-volumes : vector? watertight? : boolean? orientable? : boolean? consistently-wound? : boolean?
An immutable, deterministic report over indexed geometry. Edge records retain
first-triangle encounter order; components and loops retain source-index order.
Degeneracy uses a tolerance proportional to the mesh’s squared extent rather
than one universal world-coordinate epsilon.
procedure
(analyze-mesh3d mesh) → mesh3d-analysis?
mesh : mesh3d?
Computes topology
and geometric diagnostics without changing mesh.
procedure
(mesh3d-validate mesh) → mesh3d-analysis?
mesh : mesh3d?
An explicit alias
for analyze-mesh3d. Mesh construction remains cheap and does not
implicitly run this potentially expensive analysis.
struct
(struct mesh3d-orientation-report ( initial-analysis final-analysis flipped-triangle-indices outward?) #:transparent) initial-analysis : mesh3d-analysis? final-analysis : mesh3d-analysis? flipped-triangle-indices : vector? outward? : boolean?
An immutable explanation of
an explicit orientation repair. Per-vertex normals are authored attributes and
are not silently regenerated by repair.
procedure
(mesh3d-orient-consistently mesh)
→
mesh3d? mesh3d-orientation-report? mesh : mesh3d?
Returns a replacement mesh with each manifold adjacent pair oppositely wound,
or raises for degenerate, non-manifold, or parity-conflicting input.
procedure
(mesh3d-orient-outward mesh)
→
mesh3d? mesh3d-orientation-report? mesh : mesh3d?
Additionally makes every closed, orientable, nonzero-volume component
outward-facing. Open, non-manifold, non-orientable, and zero-volume components
fail explicitly because they have no unambiguous outside.
procedure
mesh : mesh3d?
Returns
deterministic pairs of non-adjacent faces whose local AABBs overlap. This is a
broad-phase candidate query, not a narrow-phase proof of intersection.