58.15 Graph Helpers and Traced Paths
These helpers construct axes-aware graph annotations and areas from numeric procedures. Tangents are numerical approximations, not symbolic derivatives. traced-path is driven by an explicit phase value and reconstructs its sampled history without depending on previously rendered frames.
See also Function, Parametric, and Data Plots, ODE Trajectories and Streamlines.
58.15.1 Coordinate and Calculus Helpers
Coordinate and calculus helpers construct static, axes-aware teaching diagrams. They evaluate numeric procedures during construction and return ordinary immutable Visuals or points. For an animated construction, place one of these calls inside derived-visual and rebuild it from the sampled parameter value.
procedure
(graph-point axes function x) → vec2?
axes : axes-visual? function : (procedure-arity-includes/c 1) x : finite-real?
The result is a point, not a rendered marker.
procedure
(graph-label axes function x label #:id id [ #:offset offset #:font-size font-size #:color color]) → text-visual? axes : axes-visual? function : (procedure-arity-includes/c 1) x : finite-real? label : string? id : symbol? offset : vec2? = (vec2 1/5 1/5) font-size : finite-real? = 1/4 color : any/c = "black"
procedure
(vertical-line-to-graph axes function x #:id id [ #:baseline baseline #:opacity opacity #:stroke stroke #:stroke-width stroke-width]) → path-visual? axes : axes-visual? function : (procedure-arity-includes/c 1) x : finite-real? id : symbol? baseline : finite-real? = 0 opacity : opacity? = 1 stroke : any/c = "gray" stroke-width : (and/c finite-real? (>=/c 0)) = 2
procedure
(horizontal-line-to-graph axes function x #:id id [ #:baseline baseline #:opacity opacity #:stroke stroke #:stroke-width stroke-width]) → path-visual? axes : axes-visual? function : (procedure-arity-includes/c 1) x : finite-real? id : symbol? baseline : finite-real? = 0 opacity : opacity? = 1 stroke : any/c = "gray" stroke-width : (and/c finite-real? (>=/c 0)) = 2
procedure
(tangent-line axes function x #:id id [ #:dx dx #:length length #:opacity opacity #:stroke stroke #:stroke-width stroke-width]) → path-visual? axes : axes-visual? function : (procedure-arity-includes/c 1) x : finite-real? id : symbol? dx : (and/c finite-real? (>/c 0)) = 1/100 length : (and/c finite-real? (>/c 0)) = 2 opacity : opacity? = 1 stroke : any/c = "crimson" stroke-width : (and/c finite-real? (>=/c 0)) = 3
procedure
(secant-line axes function x dx #:id id [ #:opacity opacity #:stroke stroke #:stroke-width stroke-width]) → path-visual? axes : axes-visual? function : (procedure-arity-includes/c 1) x : finite-real? dx : (and/c finite-real? (not/c zero?)) id : symbol? opacity : opacity? = 1 stroke : any/c = "darkorange" stroke-width : (and/c finite-real? (>=/c 0)) = 3
procedure
(secant-slope-group axes function x dx #:id id [ #:opacity opacity #:secant-stroke secant-stroke #:guide-stroke guide-stroke #:stroke-width stroke-width #:marker-radius marker-radius]) → group-visual? axes : axes-visual? function : (procedure-arity-includes/c 1) x : finite-real? dx : (and/c finite-real? (not/c zero?)) id : symbol? opacity : opacity? = 1 secant-stroke : any/c = "darkorange" guide-stroke : any/c = "gray" stroke-width : (and/c finite-real? (>=/c 0)) = 3 marker-radius : (and/c finite-real? (>/c 0)) = 1/10
procedure
(area-under-graph axes function #:id id [ #:x-min x-min #:x-max x-max #:baseline baseline #:sample-count sample-count #:opacity opacity #:fill fill #:stroke stroke #:stroke-width stroke-width]) → path-visual? axes : axes-visual? function : (procedure-arity-includes/c 1) id : symbol? x-min : (or/c finite-real? false/c) = #f x-max : (or/c finite-real? false/c) = #f baseline : finite-real? = 0 sample-count : (and/c exact-integer? (>=/c 2)) = 101 opacity : opacity? = 2/5 fill : any/c = "cornflowerblue" stroke : any/c = #f stroke-width : (and/c finite-real? (>=/c 0)) = 0
procedure
(area-between-curves axes first-function second-function #:id id [ #:x-min x-min #:x-max x-max #:sample-count sample-count #:opacity opacity #:fill fill #:stroke stroke #:stroke-width stroke-width]) → path-visual? axes : axes-visual? first-function : (procedure-arity-includes/c 1) second-function : (procedure-arity-includes/c 1) id : symbol? x-min : (or/c finite-real? false/c) = #f x-max : (or/c finite-real? false/c) = #f sample-count : (and/c exact-integer? (>=/c 2)) = 101 opacity : opacity? = 2/5 fill : any/c = "mediumpurple" stroke : any/c = #f stroke-width : (and/c finite-real? (>=/c 0)) = 0
procedure
(riemann-rectangles axes function #:id id [ #:x-min x-min #:x-max x-max #:count count #:baseline baseline #:opacity opacity #:fill fill #:stroke stroke #:stroke-width stroke-width]) → path-visual? axes : axes-visual? function : (procedure-arity-includes/c 1) id : symbol? x-min : (or/c finite-real? false/c) = #f x-max : (or/c finite-real? false/c) = #f count : exact-positive-integer? = 8 baseline : finite-real? = 0 opacity : opacity? = 2/5 fill : any/c = "seagreen" stroke : any/c = "darkgreen" stroke-width : (and/c finite-real? (>=/c 0)) = 1
58.15.2 Deterministic Traced Paths
procedure
(traced-path phase position #:id id [ #:start-time start-time #:sample-count sample-count #:trail-length trail-length #:dissipate? dissipate? #:minimum-opacity minimum-opacity #:opacity opacity #:stroke stroke #:stroke-width stroke-width]) → derived-visual? phase : (or/c symbol? scene-parameter?) position : (-> derived-context? finite-real? vec2?) id : symbol? start-time : finite-real? = 0 sample-count : (and/c exact-integer? (>=/c 2)) = 121
trail-length : (or/c false/c (and/c finite-real? (>=/c 0))) = #f dissipate? : boolean? = #f minimum-opacity : opacity? = 0 opacity : opacity? = 1 stroke : any/c = "crimson" stroke-width : (and/c finite-real? (>=/c 0)) = 3
With trail-length, the interval instead begins at the larger of start-time and current phase minus that length. With dissipate?, the resolved trace is an ordinary group of consecutive path segments whose opacity rises from minimum-opacity to opacity; otherwise it is one ordinary path Visual. No automatic tracking of arbitrary Visual motion or adaptive/discontinuity sampling is attempted.