96 3D: Spatial curves and vector diagrams
3D reference map · First 3D picture
Spatial diagram geometry is finite. A sampled curve’s centreline is separate from its rendering style. A mathematical stroke3d is resolved after projection and can retain a constant pixel width. A tube-style3d creates explicit physical tube geometry whose apparent width changes with the camera. Partial curves, reveals, and curve-following are sampled directly from the complete immutable centreline at the requested scene time; they never use a mutable updater or the preceding frame.
procedure
(stroke3d [ #:color color #:width width #:width-mode width-mode #:cap cap #:join join #:miter-limit miter-limit #:dash dash #:dash-offset dash-offset #:dash-space dash-space #:opacity opacity #:depth-mode depth-mode #:depth-bias depth-bias]) → stroke3d? color : color-spec? = "steelblue" width : positive? = 2 width-mode : (or/c 'screen 'world) = 'screen cap : (or/c 'butt 'square 'round) = 'round join : (or/c 'miter 'bevel 'round) = 'round miter-limit : positive? = 4 dash : (or/c #f list? vector?) = #f dash-offset : finite-real? = 0 dash-space : (or/c 'screen 'world) = width-mode opacity : (real-in 0 1) = 1 depth-mode : (or/c 'test 'always 'hidden) = 'test depth-bias : nonnegative-real? = 1e-5
procedure
(stroke3d-color style) → color-spec?
style : stroke3d?
procedure
(stroke3d-width style) → positive?
style : stroke3d?
procedure
(stroke3d-width-mode style) → (or/c 'screen 'world)
style : stroke3d?
procedure
(stroke3d-cap style) → (or/c 'butt 'square 'round)
style : stroke3d?
procedure
(stroke3d-join style) → (or/c 'miter 'bevel 'round)
style : stroke3d?
procedure
(stroke3d-miter-limit style) → positive?
style : stroke3d?
procedure
(stroke3d-dash style) → (or/c #f vector?)
style : stroke3d?
procedure
(stroke3d-dash-offset style) → finite-real?
style : stroke3d?
procedure
(stroke3d-dash-space style) → (or/c 'screen 'world)
style : stroke3d?
procedure
(stroke3d-opacity style) → (real-in 0 1)
style : stroke3d?
procedure
(stroke3d-depth-mode style) → (or/c 'test 'always 'hidden)
style : stroke3d?
procedure
(stroke3d-depth-bias style) → nonnegative-real?
style : stroke3d?
procedure
(stroke3d-with-color style color) → stroke3d?
style : stroke3d? color : color-spec?
procedure
(stroke3d-with-opacity style opacity) → stroke3d?
style : stroke3d? opacity : (real-in 0 1)
procedure
(tube-style3d [ #:radius radius #:sides sides #:color color]) → tube-style3d? radius : positive? = 1/20 sides : exact-positive-integer? = 8 color : color-spec? = "steelblue"
procedure
(tube-style3d? value) → boolean?
value : any/c
procedure
(tube-style3d-radius style) → positive?
style : tube-style3d?
procedure
(tube-style3d-sides style) → exact-positive-integer?
style : tube-style3d?
procedure
(tube-style3d-color style) → color-spec?
style : tube-style3d?
procedure
(point-style3d [ #:size size #:size-mode size-mode #:color color #:opacity opacity #:depth-mode depth-mode #:depth-bias depth-bias]) → point-style3d? size : positive? = 8 size-mode : (or/c 'screen 'world) = 'screen color : color-spec? = "cornflowerblue" opacity : (real-in 0 1) = 1 depth-mode : (or/c 'test 'always 'hidden) = 'test depth-bias : nonnegative-real? = 1e-5
procedure
(point-style3d? value) → boolean?
value : any/c
procedure
(arrow-style3d [ #:length length #:length-mode length-mode #:width width #:color color #:opacity opacity #:depth-mode depth-mode #:depth-bias depth-bias]) → arrow-style3d? length : positive? = 12 length-mode : (or/c 'screen 'world) = 'screen width : (or/c #f positive?) = #f color : color-spec? = "tomato" opacity : (real-in 0 1) = 1 depth-mode : (or/c 'test 'always 'hidden) = 'test depth-bias : nonnegative-real? = 1e-5
procedure
(arrow-style3d? value) → boolean?
value : any/c
procedure
(point3d position #:id id [#:style style]) → spatial-visual?
position : vec3? id : symbol? style : point-style3d? = (point-style3d)
procedure
(polyline3d points #:id id [ #:style style #:closed? closed? #:transform transform #:opacity opacity]) → curve3d? points : (or/c list? vector?) id : symbol? style : (or/c stroke3d? tube-style3d?) = (stroke3d) closed? : boolean? = #f transform : transform3? = identity-transform3 opacity : (real-in 0 1) = 1
procedure
(parametric-curve3d procedure [ #:range range #:samples samples] #:id id [ #:style style #:closed? closed?]) → curve3d? procedure : procedure? range : (list/c finite-real? finite-real?) = (list 0 1) samples : exact-positive-integer? = 64 id : symbol? style : (or/c stroke3d? tube-style3d?) = (stroke3d) closed? : boolean? = #f
procedure
(tube3d points #:id id [ #:radius radius #:sides sides #:closed? closed?] #:width-mode width-mode) → mesh3d? points : (or/c list? vector?) id : symbol? radius : positive? = 1/20 sides : exact-positive-integer? = 8 closed? : boolean? = #f width-mode : 'world
procedure
(arrow3d from to #:id id [ #:shaft-style shaft-style #:tip-style tip-style]) → group3d? from : vec3? to : vec3? id : symbol? shaft-style : stroke3d? = (stroke3d #:color "tomato") tip-style : arrow-style3d? = (arrow-style3d #:color "tomato")
procedure
(double-arrow3d from to #:id id [ #:shaft-style shaft-style #:tip-style tip-style]) → group3d? from : vec3? to : vec3? id : symbol? shaft-style : stroke3d? = (stroke3d #:color "tomato") tip-style : arrow-style3d? = (arrow-style3d #:color "tomato")
procedure
(with-edges3d mesh [ #:edges edges #:visible visible #:hidden hidden #:crease-angle crease-angle #:surface surface]) → edge-overlay3d? mesh : mesh3d?
edges : (or/c 'explicit 'all 'boundary 'crease 'silhouette 'feature) = 'feature
visible : (or/c #f stroke3d?) = (stroke3d #:color "black" #:width 2) hidden : (or/c #f stroke3d?) = #f crease-angle : finite-real? = (/ pi 6) surface : (or/c 'visible 'depth-only 'none) = 'visible
procedure
(edge-style3d? value) → boolean?
value : any/c
procedure
(edge-overlay3d? value) → boolean?
value : any/c
procedure
(axes3d #:id id [ #:x-range x-range #:y-range y-range #:z-range z-range]) → group3d? id : symbol? x-range : list? = (list -3 3) y-range : list? = (list -3 3) z-range : list? = (list -3 3)
procedure
(coordinate-plane3d plane #:id id) → mesh3d?
plane : (or/c 'xy 'xz 'yz) id : symbol?
procedure
(grid-plane3d plane #:id id) → group3d?
plane : (or/c 'xy 'xz 'yz) id : symbol?
procedure
(basis-vectors3d #:id id) → group3d?
id : symbol?
procedure
(vector-arrow3d vector #:id id) → group3d?
vector : vec3? id : symbol?
procedure
(vector-components3d vector #:id id) → group3d?
vector : vec3? id : symbol?
procedure
(move-along-curve3d target curve [ #:start start #:end end]) → any/c target : spatial-path? curve : spatial-path? start : finite-real? = 0 end : finite-real? = 1
procedure
(orient-along-curve3d target curve [ #:start start #:end end]) → any/c target : spatial-path? curve : spatial-path? start : finite-real? = 0 end : finite-real? = 1
For an already-present curve path, (create '(world curve)), (uncreate '(world curve)), and (show-passing-flash '(world curve)) use the same direct curve sampling. A passing flash adds a temporary coloured tube sliver over its unchanged source curve; it disappears at each clip endpoint. The canonical vector-camera-orbit example is "examples/3d/vector-components.rkt".