▼V Reference
52 Find a task or a name
53 Modules to require
54 Scenes and sampling
55 Scene states
56 Animation requests
57 Native model details
58 Visuals
59 Geometry
60 Number Lines and Coordinate Decorations
61 Point Markers, Scatter Plots, and Filled Areas
62 Probability and Statistical Diagrams
63 Calculus lessons
64 Colors
65 Slides
66 Slide command-line tools
67 Source Programs and Authored Timelines
68 Interactive Preview and Inspection
69 Preview controls and diagnostics
70 Projects and Final Rendering
71 Project execution and cache details
72 Pict Renderer Protocol
73 3D reference map
74 3D:   Objects, groups, and paths
75 3D:   Cameras and projection
76 3D:   Views inside a Scene
77 3D:   Animating 3D objects
78 3D:   Animating the 3D camera
79 3D:   Cuts, caps, and section measurements
80 3D:   Supplementary surface, section, and annotation bindings
81 3D:   Cuts, sections, and numerical volume
82 3D:   Vectors
83 3D:   Linear maps and rotations
84 3D:   Affine transforms
85 3D:   Bounds, rays, and planes
86 3D:   Spatial maps and homotopies
87 3D:   Materials and lights
88 3D:   Lighting inspection
89 3D:   Shadow descriptors and stable bounds
90 3D:   Finite-light animation
91 3D:   Software finite-light evaluation
92 3D:   Colour space and final output
93 3D:   Relations and geometric annotations
94 3D:   Projected labels
95 3D:   Textured billboards
96 3D:   Spatial curves and vector diagrams
97 3D:   Spatial anchors and label layout
98 3D:   Anchors and projected labels
99 3D:   Parametric surfaces and calculus
100 3D:   Adaptive, trimmed, and implicit surfaces
101 3D:   Constructive solids
102 3D:   Surface constructors and queries
103 3D:   Meshes
104 3D:   Triangle topology
105 3D:   Polygonal faces
106 3D:   Deterministic convex hulls
107 3D:   Polyhedral duals
108 3D:   Schlegel diagrams and polyhedral nets
109 3D:   Conservative mesh correspondence
110 3D:   Topology-safe mesh matching
111 3D:   Checking and repairing mesh orientation
112 3D:   Clipping, sections, and transparency
113 3D:   Prepared spatial ODE trajectories and vector fields
114 3D:   Seeds and streamline sets
115 3D:   Poincare sections and return maps
116 3D:   Equilibria and local linearization
117 3D:   Flow maps and volume change
118 3D:   Drawing and inspecting trajectories
119 3D:   Reading prepared trajectories
120 3D:   Drawing vector fields and particles
121 3D:   Trajectory display
122 3D:   Spatial inspection and exact picking
123 3D:   Retained renderer backends
124 3D:   Compiled geometry and instances
125 3D:   Frame requests and results
126 3D:   Software rendering and statistics
127 3D:   Optional Racket/  Open  GL backend
128 Experimental Derived Visuals
129 Source Package Hygiene
On this page:
spatial-dependency?
spatial-visual-dependency
spatial-value-dependency
spatial-camera-dependency
spatial-relation
spatial-relation?
spatial-relation-dependencies
spatial-relation-structure
spatial-relation-cacheability
spatial-relation-context?
spatial-relation-context-spatial-ref
spatial-relation-context-spatial-world-transform
spatial-relation-context-spatial-position
spatial-relation-context-value-ref
spatial-relation-context-camera
segment-between3d
line-between3d
arrow-between3d
plane-through3d
normal-at3d
distance-segment3d
distance-dimension3d
angle-marker3d
right-angle-marker3d
dihedral-angle3d
normal-marker3d
coordinate-tripod3d
9.3

93 3D: Relations and geometric annotations🔗ℹ

3D reference map · First 3D picture

Spatial relations provide derived geometry without a mutable per-frame updater. A spatial-relation is a spatial Visual declaration with a concrete template, an explicit list of inputs, and a resolver. During a regular scene sample, Animate first samples ordinary spatial and camera animation, then resolves spatial relations inside each view3d, then renders the spatial viewport, and finally resolves projected labels as ordinary two-dimensional Visuals. This order means a label may use the resolved position of a relation result, while ordinary 2D layout can still use the label.

The three dependency declarations make a resolver’s inputs inspectable:

procedure

(spatial-dependency? value) → boolean?

  value : any/c
Recognizes a declared spatial relation dependency.

procedure

(spatial-visual-dependency target) → spatial-dependency?

  target : spatial-path?
Declares a relative or view-rooted path to a spatial Visual.

procedure

(spatial-value-dependency target) → spatial-dependency?

  target : symbol?
Declares one immutable named Scene value.

procedure

(spatial-camera-dependency view-id) → spatial-dependency?

  view-id : symbol?
Declares the camera of one owning view3d.

procedure

(spatial-relation template 
  [#:depends-on dependencies 
  #:structure structure 
  #:cache-key cache-key] 
  resolver) 
 → spatial-relation?
  template : spatial-visual?
  dependencies : (listof spatial-dependency?) = null
  structure : (or/c 'root-only 'fixed) = 'root-only
  cache-key : any/c = #f
  resolver : procedure?
Creates a semantic spatial Visual. resolver accepts a spatial-relation-context? and the transform-free local template, and must return concrete spatial geometry with the template’s ID. Its outer transform and opacity remain independently animatable.

A 'root-only relation may change all of its internal structure and can only be addressed at its own root path. A 'fixed relation must return the template’s exact child-ID tree, so a descendant is addressable. Generic resolver procedures are intentionally not cross-process-cacheable; supply a stable #:cache-key to declare an explicit cache identity.

procedure

(spatial-relation? value) → boolean?

  value : any/c
Recognizes a semantic spatial relation.

procedure

(spatial-relation-dependencies relation)

 → (listof spatial-dependency?)
  relation : spatial-relation?
Returns the declared inputs.

procedure

(spatial-relation-structure relation)

 → (or/c 'root-only 'fixed)
  relation : spatial-relation?
Returns the declared structural policy.

procedure

(spatial-relation-cacheability relation)

 → (or/c 'explicit-key 'disabled)
  relation : spatial-relation?
Reports whether the relation has an explicit stable cache key.

The resolver context is read-only and accepts only declared inputs.

procedure

(spatial-relation-context? value) → boolean?

  value : any/c
Recognizes a spatial relation resolver context.

procedure

(spatial-relation-context-spatial-ref context 
  target) 
 → spatial-visual?
  context : spatial-relation-context?
  target : spatial-path?
Resolves a declared relative or rooted target.

procedure

(spatial-relation-context-spatial-world-transform context 
  target) 
 → affine3?
  context : spatial-relation-context?
  target : spatial-path?
Returns a declared target’s sampled world transform.

procedure

(spatial-relation-context-spatial-position context    
  target) → vec3?
  context : spatial-relation-context?
  target : spatial-path?
Returns a declared target’s sampled world origin.

procedure

(spatial-relation-context-value-ref context    
  target) → any/c
  context : spatial-relation-context?
  target : symbol?
Reads a declared immutable named Scene value.
Reads the declared camera of the owning view.

An undeclared access is an authoring error. Relations resolve lazily with one cache for the sampled viewport; a cycle reports complete paths rooted at the owning view, such as '(world links ab).

The following constructors describe common spatial relationships:

procedure

(segment-between3d from    
  to    
  #:id id    
  [#:color color    
  #:width width    
  #:opacity opacity]) → spatial-relation?
  from : spatial-path?
  to : spatial-path?
  id : symbol?
  color : any/c = "slategray"
  width : positive-real? = 2
  opacity : real? = 1
Produces a finite semantic segment between the current world origins of two declared targets.

procedure

(line-between3d from    
  to    
  #:id id    
  [#:padding padding    
  #:color color    
  #:width width    
  #:opacity opacity]) → spatial-relation?
  from : spatial-path?
  to : spatial-path?
  id : symbol?
  padding : nonnegative-real? = 10
  color : any/c = "slategray"
  width : positive-real? = 2
  opacity : real? = 1
Produces the displayed portion of the infinite line through two current origins.

procedure

(arrow-between3d from    
  to    
  #:id id    
  [#:color color    
  #:width width    
  #:tip-size tip-size    
  #:opacity opacity]) → spatial-relation?
  from : spatial-path?
  to : spatial-path?
  id : symbol?
  color : any/c = "slategray"
  width : positive-real? = 2
  tip-size : positive-real? = 1/4
  opacity : real? = 1
Produces a segment with a small semantic arrow head at to.

procedure

(plane-through3d first    
  second    
  third    
  #:id id    
  [#:color color    
  #:opacity opacity]) → spatial-relation?
  first : spatial-path?
  second : spatial-path?
  third : spatial-path?
  id : symbol?
  color : any/c = "lightskyblue"
  opacity : real? = 1
Produces a double-sided triangular plane through three current origins.

procedure

(normal-at3d target    
  normal    
  #:id id    
  [#:length length    
  #:color color    
  #:width width    
  #:tip-size tip-size    
  #:opacity opacity]) → spatial-relation?
  target : spatial-path?
  normal : vec3?
  id : symbol?
  length : positive-real? = 1
  color : any/c = "darkmagenta"
  width : positive-real? = 2
  tip-size : positive-real? = 1/4
  opacity : real? = 1
Produces a directed normal marker from a target’s current origin.

procedure

(distance-segment3d from    
  to    
  #:id id    
  [#:color color    
  #:width width    
  #:opacity opacity]) → spatial-relation?
  from : spatial-path?
  to : spatial-path?
  id : symbol?
  color : any/c = "darkgoldenrod"
  width : positive-real? = 2
  opacity : real? = 1
Produces a semantically named finite distance segment.

procedure

(distance-dimension3d from    
  to    
  #:id id    
  [#:offset offset    
  #:color color    
  #:width width    
  #:tip-size tip-size    
  #:opacity opacity]) → spatial-relation?
  from : spatial-path?
  to : spatial-path?
  id : symbol?
  offset : vec3? = (vec3 0 1/3 0)
  color : any/c = "darkgoldenrod"
  width : positive-real? = 2
  tip-size : positive-real? = 1/6
  opacity : real? = 1
Produces extension segments and a two-ended dimension line. The offset is an explicit world-space vector, so the mark retains mathematical meaning under camera motion.

procedure

(angle-marker3d first    
  vertex    
  second    
  #:id id    
  [#:radius radius    
  #:samples samples    
  #:color color    
  #:width width    
  #:opacity opacity]) → spatial-relation?
  first : spatial-path?
  vertex : spatial-path?
  second : spatial-path?
  id : symbol?
  radius : positive-real? = 1/3
  samples : exact-integer? = 12
  color : any/c = "darkorange"
  width : positive-real? = 2
  opacity : real? = 1
Produces the smaller arc from first through vertex to second. The three current points must remain non-collinear.

procedure

(right-angle-marker3d first    
  vertex    
  second    
  #:id id    
  [#:size size    
  #:color color    
  #:width width    
  #:opacity opacity]) → spatial-relation?
  first : spatial-path?
  vertex : spatial-path?
  second : spatial-path?
  id : symbol?
  size : positive-real? = 1/3
  color : any/c = "darkorange"
  width : positive-real? = 2
  opacity : real? = 1
Produces a three-segment corner following the two current rays. It is square when the rays are perpendicular; it deliberately does not silently assert that an animated non-right configuration is right.

procedure

(dihedral-angle3d axis-from    
  axis-to    
  first-face-point    
  second-face-point    
  #:id id    
  [#:radius radius    
  #:samples samples    
  #:color color    
  #:width width    
  #:opacity opacity]) → spatial-relation?
  axis-from : spatial-path?
  axis-to : spatial-path?
  first-face-point : spatial-path?
  second-face-point : spatial-path?
  id : symbol?
  radius : positive-real? = 1/3
  samples : exact-integer? = 12
  color : any/c = "darkorange"
  width : positive-real? = 2
  opacity : real? = 1
Produces a signed smaller arc around the ordered hinge, using one off-axis point from each incident face. Face points on the hinge and coincident face directions are rejected when the relation resolves.

procedure

(normal-marker3d target    
  normal    
  #:id id    
  [#:length length    
  #:color color    
  #:width width    
  #:tip-size tip-size    
  #:opacity opacity]) → spatial-relation?
  target : spatial-path?
  normal : vec3?
  id : symbol?
  length : positive-real? = 1
  color : any/c = "darkmagenta"
  width : positive-real? = 2
  tip-size : positive-real? = 1/4
  opacity : real? = 1
The fixed-child-tree annotation spelling of normal-at3d. The supplied normal is a world direction.

procedure

(coordinate-tripod3d target    
  #:id id    
  [#:length length    
  #:width width    
  #:tip-size tip-size    
  #:x-color x-color    
  #:y-color y-color    
  #:z-color z-color    
  #:opacity opacity]) → spatial-relation?
  target : spatial-path?
  id : symbol?
  length : positive-real? = 1
  width : positive-real? = 2
  tip-size : positive-real? = 1/4
  x-color : any/c = "firebrick"
  y-color : any/c = "forestgreen"
  z-color : any/c = "royalblue"
  opacity : real? = 1
Produces three current-origin arrows for the fixed world x, y, and z directions.