97 3D: Spatial anchors and label layout
3D reference map · First 3D picture
Spatial annotations use immutable anchor3d? descriptors. vertex-anchor3d, edge-anchor3d, face-anchor3d, curve-anchor3d, surface-anchor3d, and bounds/origin anchors resolve after every spatial transformation into a resolved-anchor3d world point, normal/tangent when available, source path, and stable provenance identity. Parametric surface anchors—including generated adaptive and trimmed surfaces—expose evaluated normals and u-tangents after their complete world transform. A surface-pick-anchor3d carries an immutable exact pick provenance; this makes an implicit surface’s interpolated normal available without pretending it owns a UV tangent frame.
procedure
(surface-pick-anchor3d pick) → anchor3d?
pick : surface-pick3d?
label3d uses such an anchor while retaining its content as a crisp ordinary 2D Visual. label-placement3d and layout-labels3d provide a deterministic, pure direct-mode candidate layout in output pixels. The outer scene compositor resolves and measures all projected labels for a sampled frame before it positions any one label, then consumes that one batched direct layout without re-rendering the viewport. prepare-label-layout3d optionally computes an immutable dynamic-programming candidate table for a declared finite frame grid, applying explicit movement and switching penalties without relying on the previously displayed frame. Equal-priority labels retain declaration order, and equal-cost candidates retain the declared preferred-direction order.
procedure
(prepare-scene-label-layout3d scene #:frames frames [ #:view view-id #:fps fps #:camera camera #:supersample supersample #:switch-penalty switch-penalty #:movement-penalty movement-penalty]) → prepared-label-layout3d? scene : scene? frames : (listof exact-nonnegative-integer?) view-id : (or/c #f symbol?) = #f fps : exact-positive-integer? = 30 camera : (or/c #f camera?) = #f supersample : exact-positive-integer? = 1 switch-penalty : nonnegative-real? = 0 movement-penalty : nonnegative-real? = 0
Current limitations: prepared tables are explicit render inputs rather than a default project-render policy, and a table applies only to the source-frame grid and viewport raster for which it was measured. Core world-space dimensions, angle markers, normal markers, and coordinate tripods are fixed-structure spatial relations, but they do not yet supply automatic formula labels or camera-facing screen sizing. Leaders are fixed one-pixel grey 2D paths and are attached for top-level projected labels; they intentionally do not claim 3D occlusion or textured styling. The executable anchor probe is "examples/3d/anchor-aware-labels.rkt".
An example is "examples/3d/sphere-plane-section.rkt".