100 3D: Adaptive, trimmed, and implicit surfaces
3D reference map · First 3D picture
Adaptive, trimmed, and implicit surface constructors all lower to the same immutable indexed surface record returned by surface3d-local-mesh. The record preserves vertex and triangle provenance as well as a topology key, while renderer caches remain outside authored values.
Surfaces implement gen:surface3d. The protocol deliberately separates local geometry from the authored spatial envelope: surface3d-local-mesh always has identity placement and full opacity, while surface3d->mesh3d restores the surface’s transform and opacity for standalone use. A surface-domain3d owns any executable retained-domain predicate; the serializable surface-diagnostics3d value never embeds that procedure.
adaptive-parametric-surface3d accepts the same parameterization shape as parametric-surface3d, but samples it on a deterministic dyadic quadtree. Its position, normal-angle, and maximum-edge-length tolerances are camera independent. Neighbouring cells are conformed before lowering, so their shared edge vertices are identical rather than merely close.
trimmed-parametric-surface3d accepts signed surface-trim fields in parameter space, or an explicit Boolean field made with trim-field3d, trim-and3d, trim-or3d, and trim-not3d. A list remains conjunction for the simple case. Its trim classifier samples each adaptive cell’s corners, side midpoints, and centre before requesting a split, rather than imposing a fixed global lattice on every planar trimmed surface. It clips the retained adaptive triangles and shares edge/trim intersections by canonical keys. Consequently surface3d-domain-contains? and surface3d-position-at? can distinguish a point in the original parameter box from one outside its trim. Root refinement uses deterministic bisection for true sign crossings.
implicit-surface3d currently uses deterministic fixed-grid marching tetrahedra. It canonicalizes exact iso vertices, uses an author gradient when supplied (otherwise bounded one-sided finite differences), and reports extraction-boundary crossings. Its #:on-invalid policy may raise, skip invalid cells, or use bounded local subdivision before recording unresolved cells in diagnostics. This API does not provide adaptive octree implicit extraction.
procedure
(trim-expression3d? value) → boolean?
value : any/c
procedure
(trim-field3d field [ #:keep keep] #:id id #:tolerance tolerance) → trim-expression3d? field : procedure? keep : (or/c 'positive 'negative) = 'positive id : symbol? tolerance : positive?
procedure
(surface-trim field [ #:keep keep] #:id id #:tolerance tolerance) → trim-expression3d? field : procedure? keep : (or/c 'positive 'negative) = 'positive id : symbol? tolerance : positive?
procedure
(trim-and3d first rest ...) → trim-expression3d?
first : trim-expression3d? rest : trim-expression3d?
procedure
(trim-or3d first rest ...) → trim-expression3d?
first : trim-expression3d? rest : trim-expression3d?
procedure
(trim-not3d expression) → trim-expression3d?
expression : trim-expression3d?
Current trim limitations: Nine samples are a conservative local discovery rule, not a proof that an arbitrarily tiny component between all sample positions will be found. Compound trim provenance identifies its source field deterministically, but reconstructed named boundary loops are not yet exposed as a separate surface value.
implicit-surface3d samples a finite scalar field within a declared axis-aligned box and extracts one level set with deterministic marching tetrahedra. It shares lattice-edge intersections, estimates normals from central field differences, and records whether the surface touches the box boundary. The extractor uses a fixed resolution; it does not adapt its 3D cells. view3d-surface-pick uses the ordinary CPU BVH hit and attaches the retained triangle provenance: barycentrically interpolated (vector u v) parameters for parametric surfaces and the source cube/ tetrahedron record for implicit ones. It does not claim a separate analytic implicit intersection solver.
Adaptive and trimmed parametric surfaces retain their evaluator and parameter domain as well as their lowered mesh. Therefore surface-anchor3d can provide a deterministic local finite-difference tangent/normal frame for those surfaces. An implicit surface has no invented UV coordinate. Instead, surface-pick-anchor3d converts one immutable surface-pick3d into an anchor: it resolves the current barycentric mesh point and interpolated normal, while truthfully leaving the tangent unavailable.
procedure
(reveal-surface-u target) → any/c
target : spatial-path?
procedure
(reveal-surface-v target) → any/c
target : spatial-path?
procedure
(transform-surface3d target destination) → any/c
target : spatial-path? destination : surface3d?
An example is "examples/3d/tangent-plane.rkt".