On this page:
math-plan->scene!
prepare-math-plan!
math->visual!
math-plan->pict!
prepared-math-plan?
prepared-math-plan-plan
prepared-math-plan-layouts
prepared-math-plan-schedule
prepared-math-plan-camera
prepared-math-plan-foreground
prepared-math-plan-background
prepared-math-plan-row-gap
prepared-math-plan-max-rows
prepared-math-plan-diagnostics
prepared-layout?
prepared-layout-state
prepared-layout-tokens
prepared-layout-source
prepared-layout-diagnostics
prepared-token?
prepared-token-path
prepared-token-role
prepared-token-text
prepared-token-asset
prepared-token-x
prepared-token-y
prepared-token-width
prepared-token-height
prepared-token-id
default-math-cache-directory

6 Explicit Rendering Adapter🔗ℹ

 (require animate/math/render) package: animate

These functions may load native dependencies and create cached assets. They are not imported by animate/math.

procedure

(math-plan->scene! plan-or-prepared    
  [#:camera camera    
  #:theme theme    
  #:title title    
  #:id id    
  #:cache-directory directory]) → scene?
  plan-or-prepared : (or/c presentation-plan? prepared-math-plan?)
  camera : any/c = #f
  theme : (or/c #f 'light 'dark) = #f
  title : string? = "Mathematical derivation"
  id : symbol? = 'math-lesson
  directory : path-string? = default-math-cache-directory
Prepares when necessary and compiles the lesson into the existing native scene engine.

Accepts a presentation plan or a prepared plan. An unprepared plan is prepared before native scene assembly. Prepared plans capture their camera/theme; supplying inconsistent options is rejected. The result is an ordinary animate scene using existing movement, opacity, presence, and wait operations. Sampling that scene performs no mathematical rewrites, CAS calls, or TeX execution.

procedure

(prepare-math-plan! plan 
  [#:camera camera 
  #:theme theme 
  #:cache-directory cache-directory]) 
 → prepared-math-plan?
  plan : presentation-plan?
  camera : any/c = #f
  theme : symbol? = 'light
  cache-directory : path-string? = default-math-cache-directory
Typesets and measures all checkpoints before native scene construction or sampling.

May load native modules, launch trusted TeX and dvisvgm processes, measure SVG geometry, and write cached assets. Preparation typesets each complete formula; it never independently typesets leaves and guesses their spacing. Layout is fit to the explicit camera or a native default camera. The camera’s visible width must exceed the 7/5-world-unit layout margin. The prepared result stores immutable adapter data; it is not a new mathematical AST.

procedure

(math->visual! state    
  [#:id id    
  #:font-size font-size    
  #:theme theme    
  #:cache-directory directory]) → visual?
  state : math?
  id : symbol? = 'math-snapshot
  font-size : (and/c real? positive?) = 11/20
  theme : (or/c 'light 'dark) = 'light
  directory : path-string? = default-math-cache-directory
Typesets one complete mathematical state and creates an ordinary native group.

Prepares the complete expression and returns a native group of ordered SVG asset references. Cache files must remain available while the resulting Visual is rendered. Font size is measured in world units.

procedure

(math-plan->pict! plan    
  time    
  [#:theme theme    
  #:camera camera    
  #:renderers renderers]) → pict?
  plan : (or/c presentation-plan? prepared-math-plan?)
  time : (and/c real? (>=/c 0))
  theme : (or/c #f 'light 'dark) = #f
  camera : any/c = #f
  renderers : (or/c list? #f) = #f
Renders one sampled native frame using the explicit camera and renderer selection.

Prepares or uses the supplied plan, constructs its native scene, and renders the requested time. The explicit renderer list is passed unchanged to scene-state->pict, along with the keyword camera argument. False selects animate’s default renderer list. False theme retains a prepared plan’s captured theme; an unprepared plan defaults to light. Layout uses the prepared complete-SVG metrics. Custom renderer padding is not remeasured by this conversion, so a renderer that changes extents may need explicitly adjusted layout. This convenience function is effectful; prepare and compile once when sampling many frames.

procedure

(prepared-math-plan? value) → boolean?

  value : any/c
Reports whether its argument is a prepared-math-plan value.

procedure

(prepared-math-plan-plan record) → presentation-plan?

  record : prepared-math-plan?
Returns the plan field: original immutable presentation.

This accessor is pure. It does not copy, reorder, render, or mutate the record.

procedure

(prepared-math-plan-layouts record) → (and/c hash? immutable?)

  record : prepared-math-plan?
Returns the layouts field: checkpoint states to prepared layouts.

This accessor is pure. It does not copy, reorder, render, or mutate the record.

Returns the schedule field: ordered frozen phase schedule.

This accessor is pure. It does not copy, reorder, render, or mutate the record.

procedure

(prepared-math-plan-camera record) → any/c

  record : prepared-math-plan?
Returns the camera field: explicit native camera used during preparation.

This accessor is pure. It does not copy, reorder, render, or mutate the record.

procedure

(prepared-math-plan-foreground record) → string?

  record : prepared-math-plan?
Returns the foreground field: prepared ink color.

This accessor is pure. It does not copy, reorder, render, or mutate the record.

procedure

(prepared-math-plan-background record) → string?

  record : prepared-math-plan?
Returns the background field: prepared background color.

This accessor is pure. It does not copy, reorder, render, or mutate the record.

procedure

(prepared-math-plan-row-gap record) → (and/c real? positive?)

  record : prepared-math-plan?
Returns the row-gap field: measured row separation in world units.

This accessor is pure. It does not copy, reorder, render, or mutate the record.

Returns the max-rows field: visible row limit.

This accessor is pure. It does not copy, reorder, render, or mutate the record.

procedure

(prepared-math-plan-diagnostics record) → (listof string?)

  record : prepared-math-plan?
Returns the diagnostics field: notes in checkpoint order, never hash iteration order.

This accessor is pure. It does not copy, reorder, render, or mutate the record.

procedure

(prepared-layout? value) → boolean?

  value : any/c
Reports whether its argument is a prepared-layout value.

procedure

(prepared-layout-state record) → math?

  record : prepared-layout?
Returns the state field: exact input checkpoint.

This accessor is pure. It does not copy, reorder, render, or mutate the record.

procedure

(prepared-layout-tokens record) → (listof prepared-token?)

  record : prepared-layout?
Returns the tokens field: parts in deterministic drawing order with unique IDs.

This accessor is pure. It does not copy, reorder, render, or mutate the record.

procedure

(prepared-layout-source record) → math-source?

  record : prepared-layout?
Returns the source field: complete source and semantic ranges.

This accessor is pure. It does not copy, reorder, render, or mutate the record.

procedure

(prepared-layout-diagnostics record)

 → (listof (and/c string? immutable?))
  record : prepared-layout?
Returns the diagnostics field: ordered preparation notes.

This accessor is pure. It does not copy, reorder, render, or mutate the record.

procedure

(prepared-token? value) → boolean?

  value : any/c
Reports whether its argument is a prepared-token value.

procedure

(prepared-token-path record)

 → (listof exact-nonnegative-integer?)
  record : prepared-token?
Returns the path field: mathematical owner in one checkpoint.

This accessor is pure. It does not copy, reorder, render, or mutate the record.

procedure

(prepared-token-role record) → symbol?

  record : prepared-token?
Returns the role field: owned mathematical or operator role.

This accessor is pure. It does not copy, reorder, render, or mutate the record.

procedure

(prepared-token-text record) → (and/c string? immutable?)

  record : prepared-token?
Returns the text field: copied complete source fragment.

This accessor is pure. It does not copy, reorder, render, or mutate the record.

procedure

(prepared-token-asset record) → (and/c string? immutable?)

  record : prepared-token?
Returns the asset field: frozen SVG asset reference, not a live renderer.

This accessor is pure. It does not copy, reorder, render, or mutate the record.

procedure

(prepared-token-x record) → real?

  record : prepared-token?
Returns the x field: center coordinate in local y-up world units.

This accessor is pure. It does not copy, reorder, render, or mutate the record.

procedure

(prepared-token-y record) → real?

  record : prepared-token?
Returns the y field: center coordinate in local y-up world units.

This accessor is pure. It does not copy, reorder, render, or mutate the record.

procedure

(prepared-token-width record) → (and/c real? positive?)

  record : prepared-token?
Returns the width field: measured prepared width in world units.

This accessor is pure. It does not copy, reorder, render, or mutate the record.

procedure

(prepared-token-height record) → (and/c real? positive?)

  record : prepared-token?
Returns the height field: measured prepared height in world units.

This accessor is pure. It does not copy, reorder, render, or mutate the record.

procedure

(prepared-token-id record) → symbol?

  record : prepared-token?
Returns the id field: unique prepared/view identity.

This accessor is pure. It does not copy, reorder, render, or mutate the record.

Names the adapter-owned content-addressed SVG cache directory.

The default asset directory is animate-math/svg-v1 under Racket’s preference directory. Treat it as an adapter cache, not a portable source artifact. A production build may pass an explicit cache directory that remains available during rendering.