Commit b56cd8779b

b56cd8779b6e52dcce3102223e67414c977aa13d

parent: 44a08ad62a

Verified · cmc

cmc <hello@cleberg.net> · 2026-10-23 02:27 UTC

Plan and spec: decision 0003

The default opening is 20 degrees from flat; reverse folds open the near
side on bend lines, the head nested; the banded pop, the Delaunay mesh,
the pop's cluster rule and tied spine vertices; the short-form sampan
ships and the long form is a known gap; shipped files come from debug
foldc.

Ref #7

Layout: unified · split

docs/superpowers/plans/2026-10-19-fold.md +5 −5
@@ -27,7 +27,7 @@
27- **Steps are authored, never derived from a frame diff.** That includes `instruction`, which is the accessibility label. 27- **Steps are authored, never derived from a frame diff.** That includes `instruction`, which is the accessibility label.
28- **`turnOver` and `rotate` change the coordinates.** Frame n is frame n − 1 rotated about its bounding-box centre; the camera does not move. 28- **`turnOver` and `rotate` change the coordinates.** Frame n is frame n − 1 rotated about its bounding-box centre; the camera does not move.
29- Paper is rigid flat facets hinged at straight creases, except during a step flagged `nonRigid`. No stiffness, self-collision response or crumpling. 29- Paper is rigid flat facets hinged at straight creases, except during a step flagged `nonRigid`. No stiffness, self-collision response or crumpling.
30- **Interpolation (decision 0001, option A).** A step's axes form a tree: an axis may name a parent axis whose motion carries it. Each axis has a window on *t* (default 0…1) and either a linear angle or a solved curve of 257 samples, rebuilt by cubic Hermite interpolation. Steps whose technique has no rigid path — inside and outside reverse folds, sinks — carry `nonRigid: true` and a `pop` record, and move by open, pop, close (decision 0002, Task 7b): the flap opens rigidly to 30° from flat by default, the tip pops through on the render mesh, and the flap closes rigidly. The isometry gate does not apply to the pop; the bound does: at most 10% largest edge strain on the render mesh. A step with no rigid motion that is not a reverse fold or sink stops compilation and goes to the author. 30- **Interpolation (decision 0001, option A).** A step's axes form a tree: an axis may name a parent axis whose motion carries it. Each axis has a window on *t* (default 0…1) and either a linear angle or a solved curve of 257 samples, rebuilt by cubic Hermite interpolation. Steps whose technique has no rigid path — inside and outside reverse folds, sinks — carry `nonRigid: true` and a `pop` record, and move by open, pop, close (decision 0002, Task 7b): the flap opens rigidly to 20° from flat by default (decision 0003; 30° before it), the tip pops through on the render mesh, and the flap closes rigidly. The isometry gate does not apply to the pop; the bound does: at most 10% largest edge strain on the render mesh. A step with no rigid motion that is not a reverse fold or sink stops compilation and goes to the author.
31- Layer order is authored, never computed. Corrections to the compiler's guess live in the fold script. 31- Layer order is authored, never computed. Corrections to the compiler's guess live in the fold script.
32- v1 ships **four** traditional models: the cup, the crane, the sampan and the box (the masu). Every `file_author` is exactly `"Traditional"`, enforced by the validator. 32- v1 ships **four** traditional models: the cup, the crane, the sampan and the box (the masu). Every `file_author` is exactly `"Traditional"`, enforced by the validator.
33- Every shipped model is produced by `foldc` from a committed crease pattern and fold script, and recompiling them reproduces the shipped file (structurally, coordinates within 1e-12). Hand-edited `.fold` files are not shipped. 33- Every shipped model is produced by `foldc` from a committed crease pattern and fold script, and recompiling them reproduces the shipped file (structurally, coordinates within 1e-12). Hand-edited `.fold` files are not shipped.
@@ -1208,7 +1208,7 @@ git commit -m "foldc: compile a fold script and crease pattern into a FOLD seque
1208 1208
1209Decision 0002: an inside reverse fold has no rigid motion with the flap closed. Flagged steps move in three phases on *t*: 1209Decision 0002: an inside reverse fold has no rigid motion with the flap closed. Flagged steps move in three phases on *t*:
1210 1210
12111. **Open**, `[0, phases[0]]`: the flap opens rigidly on its spine from 180° to `openAngle` (default 30°, measured from flat), carrying everything on that side of the spine. The layer nearer the step's viewpoint opens; the other holds. A script field to choose the other layer is added when a model needs it. 12111. **Open**, `[0, phases[0]]`: the flap opens rigidly on its spine from 180° to `openAngle` (default 30°, measured from flat; 20° since decision 0003), carrying everything on that side of the spine. The layer nearer the step's viewpoint opens; the other holds. A script field to choose the other layer is added when a model needs it.
12122. **Pop**, `[phases[0], phases[1]]`: as-rigid-as-possible interpolation on the render mesh, from the open pose to `popped`. Each triangle's rotation is slerped from one pose to the other, the mesh positions are solved by least squares, and the faces that do not move in the step are held. 12122. **Pop**, `[phases[0], phases[1]]`: as-rigid-as-possible interpolation on the render mesh, from the open pose to `popped`. Each triangle's rotation is slerped from one pose to the other, the mesh positions are solved by least squares, and the faces that do not move in the step are held.
12133. **Close**, `[phases[1], 1]`: rigid, on the reverse-fold branch, from `popped` to frame n. `closeAxes` are an ordinary axis tree with solved curves, relative to `popped`. 12133. **Close**, `[phases[1], 1]`: rigid, on the reverse-fold branch, from `popped` to frame n. `closeAxes` are an ordinary axis tree with solved curves, relative to `popped`.
1214 1214
@@ -1218,7 +1218,7 @@ Decision 0002: an inside reverse fold has no rigid motion with the flap closed.
1218- builds `popped` (the reverse-fold branch with the spine held at `openAngle`, solved as in Task 7, starting each other crease at `openAngle`/180 of its travel, as the spike does). Closing the loops does not show which branch was found; a wrong branch is caught by the close reaching frame n's coordinates, the final assignment check and the validator's layer rules; 1218- builds `popped` (the reverse-fold branch with the spine held at `openAngle`, solved as in Task 7, starting each other crease at `openAngle`/180 of its travel, as the spike does). Closing the loops does not show which branch was found; a wrong branch is caught by the close reaching frame n's coordinates, the final assignment check and the validator's layer rules;
1219- builds `closeAxes` (from `popped` to the end frame, with the spine driven and the rest solved); 1219- builds `closeAxes` (from `popped` to the end frame, with the spine driven and the rest solved);
1220- checks `popped` has one position per vertex; 1220- checks `popped` has one position per vertex;
1221- writes `openAngle` and `phases` into the file explicitly: 30° and [⅓, ⅔] are the script's defaults, and the decoder requires both. The validator rejects a pop record with the wrong number of positions, phases outside 0 < p₀ < p₁ < 1, or a non-rigid step without one (`popMalformed`); 1221- writes `openAngle` and `phases` into the file explicitly: 30° (20° since decision 0003) and [⅓, ⅔] are the script's defaults, and the decoder requires both. The validator rejects a pop record with the wrong number of positions, phases outside 0 < p₀ < p₁ < 1, or a non-rigid step without one (`popMalformed`);
1222- measures the pop's strain on the step's render mesh, and fails the step above **10%**. 1222- measures the pop's strain on the step's render mesh, and fails the step above **10%**.
1223 1223
1224Decision 0002 measured 7.9% at 30° and 29% at 60° on this flap, at a mesh spacing of 1/32 of its longer side. Only the inside reverse fold was measured. Outside reverse folds and sinks use the same model until a model of theirs fails the bound; if one does, stop for a decision. 1224Decision 0002 measured 7.9% at 30° and 29% at 60° on this flap, at a mesh spacing of 1/32 of its longer side. Only the inside reverse fold was measured. Outside reverse folds and sinks use the same model until a model of theirs fails the bound; if one does, stop for a decision.
@@ -2155,7 +2155,7 @@ Authoring, not engineering: three crease patterns, three scripts, and a correcti
2155 2155
2156Carried from batch D, to settle before or while authoring these models: a crease on a named crease's line through another layer with a scripted angle other than ±180 is rejected (the masu's 90° walls need its angle derived instead); `curveTooCoarse` is reported where an unreachable scripted angle is the real cause; the cycle computation has no test for several loops sharing axes (the petal fold); `compilePop` does not assert that held faces sit identically in the open pose and `popped`; a flap whose two layers also join through the body (the crane's neck and tail) fails with `noRigidMotion`, because the opening faces are found by cutting only the spine — rule on "that side of the spine" then; `structurallyEqual` must tolerate solver noise in `pop`. From batch E: Notation styles an edge between faces of two sibling axes, or between a carried axis's face and a fixed face, by one axis's turn — check the petal fold's golden for segments of one crease drawn in different styles; a step that unfolds a crease folded in frame n − 1 is drawn as a fold, with no unfold notation — decide it when the crane's petal fold and the sampan need it; occlusion's `cover` assumes faces are not edge-on in the view, which the masu's raised walls may break (R35's revisit). 2156Carried from batch D, to settle before or while authoring these models: a crease on a named crease's line through another layer with a scripted angle other than ±180 is rejected (the masu's 90° walls need its angle derived instead); `curveTooCoarse` is reported where an unreachable scripted angle is the real cause; the cycle computation has no test for several loops sharing axes (the petal fold); `compilePop` does not assert that held faces sit identically in the open pose and `popped`; a flap whose two layers also join through the body (the crane's neck and tail) fails with `noRigidMotion`, because the opening faces are found by cutting only the spine — rule on "that side of the spine" then; `structurallyEqual` must tolerate solver noise in `pop`. From batch E: Notation styles an edge between faces of two sibling axes, or between a carried axis's face and a fixed face, by one axis's turn — check the petal fold's golden for segments of one crease drawn in different styles; a step that unfolds a crease folded in frame n − 1 is drawn as a fold, with no unfold notation — decide it when the crane's petal fold and the sampan need it; occlusion's `cover` assumes faces are not edge-on in the view, which the masu's raised walls may break (R35's revisit).
2157 2157
2158Task 15 ships in two merge requests. The box ships first (batch G). The crane's inside reverse folds have no rigid opening on the real crane — the opening side spans the spine — and the traditional long-form sampan's turn inside out has no rigid motion and no spine; decision 0003 measures bending the opening on the render mesh (the user's choice), and both models ship together after it (batch G2). The short-form sampan, an open tray with flat ends, was authored and set aside for the long form with covered ends. The crane's preliminary-base collapse needs `foldc`'s loop solver to steer the free directions of a degree-6 vertex toward the linear angles, and its narrowed legs need the spine gathered only where it separates the two sides. 2158Task 15 ships in two merge requests. The box ships first (batch G). The crane's inside reverse folds have no rigid opening on the real crane — the opening side spans the spine — and the traditional long-form sampan's turn inside out has no rigid motion and no spine; decision 0003 measured bending the opening and found it does not work with the body held; both models ship together after it (batch G2). Decision 0003: a reverse fold opens rigidly — the whole near side turns about the spine's line, with bend lines (edges on that line through the faces crossing it, `F` in every frame, never creased) — the head opens nested on the body's spine (`openOn`), the pop is the banded slerp at a default of 20° from flat, and the render mesh is a Delaunay triangulation. During a pop, faces inside one near-coplanar cluster are left to the layer order (the author's choice), and the two halves' coincident vertices on the spine line are solved as one. The sampan ships in its short form, an open tray with flat ends; the long form with covered ends has no rigid end state as scripted and is a known gap. Shipped `.fold` files come from debug `swift run foldc`; a release build can differ by up to 9e-7° on steps solved by the loop solver's null-space step. The crane's preliminary-base collapse needs `foldc`'s loop solver to steer the free directions of a degree-6 vertex toward the linear angles, and its narrowed legs need the spine gathered only where it separates the two sides.
2159 2159
2160The crane is deliberately last. It is the model that proves multi-axis petal folds and eight-deep wing stacks work, and by this point the compiler, the renderer and the gestures are all known-good against the cup, so a failure here is an authoring error rather than an ambiguity about which layer is at fault. 2160The crane is deliberately last. It is the model that proves multi-axis petal folds and eight-deep wing stacks work, and by this point the compiler, the renderer and the gestures are all known-good against the cup, so a failure here is an authoring error rather than an ambiguity about which layer is at fault.
2161 2161
@@ -2215,7 +2215,7 @@ Expected: FAIL — only the cup is in the catalogue.
2215 2215
2216- [ ] **Step 3: Author the three models** 2216- [ ] **Step 3: Author the three models**
2217 2217
2218Box and sampan first, then the crane. Neither is shallow: the masu's wall-raising and the sampan's final turn inside out are coupled 3D steps, classified when authored (decision 0002). The classification uses `foldc`'s closure test, the interpenetration check, the validator's layer rules and a look in the app; closure alone can succeed on a branch with the wrong layering. Classify the crane's preliminary base the same way: fold and unfold its diagonals and midlines, then collapse it as one step from the pre-creased square, rather than through squash folds, which have the reverse fold's structure. A step that closes is rigid. One that does not, and is not a reverse fold or sink, stops compilation with `noRigidMotion`. Then stop and ask the author: open, pop, close needs a spine to open on, and an inversion has none. The crane's petal folds are rigid with solved curves (decision 0002, case 7). Its inside reverse folds (neck, tail, head) name their `spine` and use open, pop, close at the default 30°; if one exceeds the 10% bound, its `openAngle` is lowered in the script and the record says why. The bound was measured on a two-layer flap only; the crane's flaps are narrower and several layers deep, so record each flagged step's measured strain, and if opening a flap to its `openAngle` disturbs earlier layers or no `openAngle` meets the bound, stop for a decision. The bird base's crease pattern is the one decision 0002 read from Origami Simulator's flat crane; record that provenance in `docs/authoring/crane.md`. Run `foldc`, then `foldlint`, correcting guessed orderings with script overrides where the interpenetration checker or the validator's layer-order rules object. Check each in the app before committing: the checks prove no facet passes through another and no ordering is impossible, but only your eye tells you the fold reads correctly. 2218Box and sampan first, then the crane. Neither is shallow: the masu's wall-raising and the sampan's final turn inside out are coupled 3D steps, classified when authored (decision 0002). The classification uses `foldc`'s closure test, the interpenetration check, the validator's layer rules and a look in the app; closure alone can succeed on a branch with the wrong layering. Classify the crane's preliminary base the same way: fold and unfold its diagonals and midlines, then collapse it as one step from the pre-creased square, rather than through squash folds, which have the reverse fold's structure. A step that closes is rigid. One that does not, and is not a reverse fold or sink, stops compilation with `noRigidMotion`. Then stop and ask the author: open, pop, close needs a spine to open on, and an inversion has none. The crane's petal folds are rigid with solved curves (decision 0002, case 7). Its inside reverse folds (neck, tail, head) name their `spine` and use open, pop, close at the default 20° (decision 0003); if one exceeds the 10% bound, its `openAngle` is lowered in the script and the record says why. The bound was measured on a two-layer flap only; the crane's flaps are narrower and several layers deep, so record each flagged step's measured strain, and if opening a flap to its `openAngle` disturbs earlier layers or no `openAngle` meets the bound, stop for a decision. The bird base's crease pattern is the one decision 0002 read from Origami Simulator's flat crane; record that provenance in `docs/authoring/crane.md`. Run `foldc`, then `foldlint`, correcting guessed orderings with script overrides where the interpenetration checker or the validator's layer-order rules object. Check each in the app before committing: the checks prove no facet passes through another and no ordering is impossible, but only your eye tells you the fold reads correctly.
2219 2219
2220- [ ] **Step 4: Run tests to verify they pass** 2220- [ ] **Step 4: Run tests to verify they pass**
2221 2221
docs/superpowers/specs/2026-10-19-fold-design.md +5 −3
@@ -321,8 +321,10 @@ unfolds the flap flat and refolds it, which on the crane would undo earlier
321steps on screen. Reverse folds and sinks are flagged `nonRigid` and move in 321steps on screen. Reverse folds and sinks are flagged `nonRigid` and move in
322three phases on *t*: 322three phases on *t*:
323 323
3241. **Open**, rigid: the flap opens on its spine to 30° from flat (authored 3241. **Open**, rigid: the flap opens on its spine to 20° from flat by default
325 per step). 325 (authored per step). Where the flap's near layers run on under another
326 flap, the whole near side turns about the spine's line, with bend lines
327 on that line (decision 0003).
3262. **Pop**: the tip passes from outside the flap to inside it, by 3282. **Pop**: the tip passes from outside the flap to inside it, by
327 as-rigid-as-possible interpolation on a render mesh: frame 0's creases 329 as-rigid-as-possible interpolation on a render mesh: frame 0's creases
328 plus lines every 1/32 of its longer side in each direction. The render 330 plus lines every 1/32 of its longer side in each direction. The render
@@ -624,7 +626,7 @@ The headline bars get mechanical checks rather than judgement:
6243. **The interpolation model for coupled steps.** Settled (decisions 0001 6263. **The interpolation model for coupled steps.** Settled (decisions 0001
625 and 0002): an axis tree with windows and solved curves for rigid steps, 627 and 0002): an axis tree with windows and solved curves for rigid steps,
626 including the petal fold; open, pop, close for reverse folds and sinks, 628 including the petal fold; open, pop, close for reverse folds and sinks,
627 opened to 30° by default, held to 10% strain. 629 opened to 20° by default (decision 0003), held to 10% strain.
6284. **Which boat.** Settled: the sampan (see *Rights*). 6304. **Which boat.** Settled: the sampan (see *Rights*).
6295. **The overlapping-moving-sets rule.** Decision 0001 found no case it 6315. **The overlapping-moving-sets rule.** Decision 0001 found no case it
630 covers that staggered windows and the near-coplanar clusters do not. 632 covers that staggered windows and the near-coplanar clusters do not.