feat(fold): @ folds execute — dual creasePattern + foldedForm output (Plan B-2b) #10
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "v0.9-fold-eval"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Plan B-2b — the slice where
@actually folds. Wires the B-2a primitives into a stateful evaluator and emits a dual-frame FOLD file. Design:docs/superpowers/specs/2026-06-29-fold-evaluator-output-design.md.Eval.eval_foldedthreads aFold_statefrominit_square, resolving every reference against the current folded state: a bare axiom subdivides the face set (a precrease), an@axiom reflects the moving side and restacks (fold_with_records).moving .ppicks the side (defaulted to the moved point for@map .a onto .b);crossresolves a table intersection to a material paper point via the single-face rule (ambiguous in a folded overlap → error).Fold_emit.to_json_foldedbuilds the planar graph directly from the faces and emits two frames:creasePattern(frame 0, paper coords) andfoldedForm(file_frames[0], table coords,frame_inherit,faceOrders). Mountain/valley is derived per crease edge from the orientation-parity rule, so a fold through a stack produces the correct alternating M/V (the accordion).faceOrderssigns followrefs/foldformat.md. Everything stays exact inNum; floats appear only at JSON serialization.beloch foldnow routes through this path for every program. The old crease-line emit is gone;Eval.eval/Planarize/Facesstay as a tested standalone path (a later cleanup may retire them). Crease names/provenance are preserved inbeloch:edges.75/75 tests green, including a quarter-fold e2e asserting the accordion mountain and a 4-layer
faceOrdersset. Screenshots (this PR's new examples) below.Out of scope (later slices):
flip/rotate,unfold, maneuvers, non-flat angles, the topmost-layer reference rule, the bespoke animation client.Screenshots of this PR's fold examples — crease pattern (frame 0, paper coords) and the folded state (
foldedFormframe, rendered with the newfold2svg --folded). Flat folds stack layers in the same plane, so the folded view shows the silhouette, not the individual layers.fold-half.bel— fold the right half onto the left (one valley crease at x=½).fold-quarter.bel— two folds to a quarter; the second accordions across two layers (one valley, one mountain).complex-fold.bel— build the bottom-edge midpoint (.mid = cross --b --v), then fold it onto.d; the flap swings out past the original square.multiple-folds.bel— diagonal fold, then a half fold, then cross two creases on the folded stack (resolves on the top layer, Q2-B).