preview_scene
Render a declarative scene as a PNG preview before plotting, ensuring the simulated output matches what the Line-us pen will draw on paper.
Instructions
Render a declarative SCENE as a PNG without drawing. Prefer this over preview_paths: a scene is ~50x smaller than the coordinates it compiles to, and draw_scene given the SAME scene provably draws what you previewed.
scene = {"shapes": [ ...shape... ], "fit": [x,y,w,h] (optional, scales the lot)}
There is deliberately NO library of shapes -- a fixed catalogue would handle the
dull cases and send everything interesting back to pasting raw points. Curves are
EXPRESSIONS, so the vocabulary is open:
{"param": {"t": [0, 6.2832, 200],
"x": "33+5.5*cos(t)", "y": "30+5.5*sin(t)", "closed": true}}
is a circle; change the expressions and it is a spiral, rose, lissajous or
harmonograph. Variables: t, plus i and n inside "repeat". Functions: sin cos tan
asin acos atan atan2 sinh cosh tanh exp log sqrt hypot floor ceil fmod degrees
radians abs min max round pow sign clamp lerp; constants pi, tau, e.
Producers (exactly one per shape):
"param" {"t":[start,stop,steps], "x":expr, "y":expr, "closed":bool}
"path" [[u,v], ...] one stroke, the escape hatch
"paths" [[[u,v], ...], ...] several strokes
"text" "a
b", or [{"s":"a","font":"timesr"}, {"s":"b","font":"scriptc"}] with "font", "align" (left|center|right), "leading" (default 1.4) "svg" "..." "doodle" "cat", with "pick" (index), "source" (auto|bundled|web) -- real drawings from Google's Quick, Draw!, single strokes in the order a person drew them. Call doodles() first to SEE the candidates and choose a pick. Modifiers (any producer): "fill" {"hatch":deg, "spacing":mm (default 1.15), "cross":bool, "outline":bool} -- hatching is how you get solid black here "transform" {"translate":[dx,dy], "rotate":deg, "scale":s|[sx,sy], "about":[x,y]} "box"/"fit" [x,y,w,h] scale this shape into a box "repeat" N, with i (0..N-1) and n available in the expressions
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scene | Yes | ||
| simulate | No |