Skip to content

ADR-0005 — Parametric pipeline: numbers → maths → SVG ​

Status: Accepted

Context ​

The user types numbers (integers). A simple, understandable and cheap chain of transformations to the displayed SVG is needed.

Decision ​

One-way chain in 4 stages:

StageLayerContentNumber type@kind
1. Inputinteraction/interface valuesintegersprocedure
2. Modelmodel/declarative description (corners, sizes, radii, operands)integersdomain
3. Evaluationgeometry/computed geometry: segments + arcsfloatsgeometry
4. Outputio/, render/d string of the <path>, then DOMtextformat, procedure

Rules:

  • The SVG is an output, never a source of truth. The DOM is never read back to know the geometry.
  • Hit-testing, snapping, intersections: computed on stage 3, not on the DOM.
  • Recomputed on demand, only for modified shapes (memoization by identifier + version).

Consequences ​

  • Negligible computation cost for symbols of a few dozen vertices.
  • math/ and geometry/ layers testable without a browser.
  • Changing the output format (Canvas, PDF) only affects stage 4.

References ​

ADR-0002, ADR-0003