# 0001 — Interpolation model **Status:** decided 2026-10-19 — **option A**. Rigid steps use M2 with per-axis windows on *t*. Steps with no rigid motion are flagged non-rigid and animated by a model Task 0b chooses. Task 0's stop condition was met (the crane's reverse folds have no rigid model that matches the fold); this choice resolves it. **Amended by `0002-non-rigid-steps.md`:** the petal fold is rigid; reverse folds and sinks are flagged and open, pop, close; inversions (the sampan's) and the masu's wall-raising are classified when authored, not flagged in advance. ## Question How does a step's geometry move between its two frames? Specifically, which of these covers each kind of step the four v1 models need: - **M1** — the design as written: disjoint moving sets, each rotated about its crease in the start frame by a linearly interpolated angle. - **M2** — a kinematic tree with solved angle curves: an axis may be carried by another moving face, each axis's angle is a function of *t* (possibly on its own window of *t*), and `foldc` solves the curves so every loop of faces around an interior vertex closes. - **M3** — decomposition into sub-steps, each M1 or M2, on one drag. - **M4** — non-rigid: per-face transforms between solved poses, exact only at the poses. ## Method `spikes/interpolation` (`swift run -c release --package-path spikes/interpolation`). Each case is a crease pattern built in code. Faces are placed by composing rotations about creases along a spanning tree of faces; only creases on the tree carry an angle, and every other crease's angle is measured from the geometry. The **gap** is the largest distance between two copies of one vertex placed through different faces: zero when the paper is whole, the size of the tear otherwise. M1 prescribes every angle; M2 drives one crease and solves the others by damped Gauss–Newton, continued along *t*. Collisions are transversal face–face intersections, ignoring coplanar pairs and boundary contact. ## Results | Case | M1 | M2 / other | Collisions | |---|---|---|---| | 1. Letter fold, both thirds valley, one step | exact (gap 9e-16) | — | flaps meet at 120.2°. Staggered (one flap on *t* 0–0.5, the other on 0.5–1): none | | 2. Letter fold, one valley, one mountain | exact | — | none | | 3. Flat-foldable degree-4 vertex (60°, 80°, 120°, 100°) | tears: gap 1.08–1.38 on a sheet of side 2 | M2 exact (4e-12). Opposite creases pair up; the pairs follow tan(ρ₁/2) = k·tan(ρ₂/2) with k = cos((α+β)/2) / cos((α−β)/2) = 0.3473: at the driven crease's 45°, 90°, 135° the other pair is at 16.4°, 38.3°, 80.0° | — | | 4. Inside reverse fold, two-layer flap, rest of the flap held | — | no rigid motion reaches it with the flap closed (below) | — | | 5. Petal fold of a preliminary base | inconclusive (below) | inconclusive | — | ### Sampling a solved curve `foldc` writes a solved curve as samples. Rebuilding case 3's curves from N + 1 samples and measuring the tear between them (sheet of side 2): | N | linear | cubic Hermite, central-difference tangents | |---|---|---| | 16 | 1.0e-2 | 1.1e-3 | | 32 | 2.5e-3 | 1.2e-4 | | 64 | 6.3e-4 | 1.5e-5 | | 128 | 1.6e-4 | 1.8e-6 | | 256 | 3.9e-5 | 2.3e-7 | Cubic converges about eight times per halving. 257 samples keep the tear under 1e-6 on this sheet; `foldc` checks each curve at four times its sample density and refines a curve that does not. ### Case 4 in detail Sheet 4×2 folded on its spine y = 1; reverse-fold creases from (2, 1) to (3, 0) and (3, 2). Body spine and tip spine start at 180°. - **Flap held closed** (body spine fixed at 180°): the only rigid motion is the tip swinging about the two coincident reverse creases as one closed unit (tip spine stays 180°, the creases go to ∓180°). That ends at the reverse fold's coordinates with the wrong layering — the tip folded over outside, not between the layers. Gap 8e-14. - **Flap free, reverse creases driven:** the solver stays on that same motion. - **Flap free, tip spine driven through 0:** the whole flap unfolds and refolds the other way (body spine follows the tip spine to −180°). Not a reverse fold. - **Two phases:** open the flap completely flat (body and tip spines 180° → 0°), then fold on the reverse-fold branch (tip spine → −180°, body spine and both reverse creases → 180°). Rigid, gap 1e-13. **This is the only rigid path found, and it requires the flap to open fully flat.** - **Forced without opening** (M4, body held, tip spine linear 180° → −180°, one reverse crease least-squares): gap 2.0 on a flap 1 high — the paper tears completely. - **Partial opening** (body spine opens to φ at mid-fold and closes, tip spine linear, least-squares): gap 1.6 at φ = 150°, 1.16 at 120°, 0.73 at 90°, 0.36 at 60°, 0.24 at 30°. A naive schedule; it shows that a partial opening does not make the motion rigid, not the least strain a designed motion could reach. The vertex is degree 4 with a straight pair (the spine) and a mirror pair (the reverse creases). The runs found three families of rigid motion: the spine folding as one line, the tip swinging as a closed unit (only with the spine at 180°), and the reverse-fold branch from the flat sheet. Every path found from the folded flap to the reverse fold passed through the flat sheet. ### Case 5 in detail Superseded by 0002's case 7, which uses the bird base read from Origami Simulator's flat crane and finds the petal fold rigid. The pattern below included creases the bird base does not have. The crease pattern is Origami Simulator's `assets/Bases/birdBase.svg` (midlines, the diagonal the preliminary base folds, eight 22.5° kite creases), made exact, plus the petal hinge between the kite creases' ends. That pattern is not the bird base: - Origami Simulator's file has no petal hinge. Adding the hinge leaves five creases at each kite end, which no flat fold allows. With the inner square added as well, the solver finds a rigid, collision-free motion (gap 1e-15), but tracing points shows the inner layers' corners lifting with the front point. In a petal fold those corners stay down and become the legs. - With Origami Simulator's pattern as given, each kite end is a degree-4 vertex with the same structure as case 4's: a straight pair (the midline) and a mirror pair (the two kite creases), sectors 112.5° and 67.5°. If the petal fold reverses the outer midline segment there, case 4's result applies; if the side flaps swing as closed units, it is rigid. Settling this needs a verified bird-base crease pattern with its mountain and valley assignment (e.g. from Lang, *Origami Design Secrets*). No published FOLD file was found. ### Not measured - The sampan's last step, turning the model inside out. - The masu's wall-raising. ## What this means 1. **M1 is right for independent folds, with one addition:** axes need their own window on *t*. Case 1 shows two flaps of equal reach folding toward each other on one linear parameter always collide; staggering them is clean. 2. **Coupled vertices need M2's solved curves.** Linear angles tear a degree-4 vertex by more than half the sheet. The angles are not choosable — they follow the tan relation — which is more work for `foldc`, not for the author. 3. **Reverse folds have no rigid motion that matches how they are folded.** The rigid path unfolds the flap flat and refolds it. On the crane the neck, tail and head flaps are narrowed, several layers deep; unfolding one flat would undo earlier steps' folds on screen. Not measured on the crane's geometry. 4. **The petal fold is open** pending a verified crease pattern. 5. **The overlapping-moving-sets rule for `krz:faceOrders_midFold` has no case left.** The problem it addressed is a collision (case 1), which ordering cannot fix and staggering does. A staggered second flap arrives on a stack that is already flat, where the end frame's order and the near-coplanar clusters apply. Its other use, the peak order of a `foldAndUnfold`, is unaffected. ## Exit criterion The crane's three inside reverse folds are covered only by M3 with the flap fully unfolded, or by M4 — met. Per the plan, the choice is the author's. ## Options **A. Scoped non-rigid steps (recommended).** Rigid steps use M2 with per-axis windows. Steps whose technique has no rigid path — inside and outside reverse folds, sinks, inversions — are flagged in `krz:step` and animated by a designed non-rigid motion: the flap's layers open partway and the tip swings through, with faces near the vertex allowed to bend. For those steps the isometry gate becomes a stated strain bound, and the interpenetration check still applies. This needs: - a second spike (Task 0b) on a bending model for the reverse fold, to find a strain bound worth promising; - the verified bird-base pattern for case 5; - the sampan's inversion and the masu's wall-raising as cases. It also changes `CLAUDE.md`'s rule that an isometry failure is never a tolerance to widen, for flagged steps only. **B. Rigid via unfolding (M3).** Animate a reverse fold as unfold-flat, then refold. Exact and isometric, but it does not show how a reverse fold is made, and on the crane it unfolds earlier steps on screen. **C. Don't animate those steps.** The step jumps or crossfades. This breaks the anti-goal "a fold that snaps". **D. Drop the crane.** Replace it with a traditional model without reverse folds or sinks. Most traditional animals use reverse folds; the crane is the model most people will open the app for. ## Plan changes made for option A - **Task 0b** (new, before Task 1, batch A2): a model for non-rigid steps and its strain bound, a verified bird base for the petal fold, the sampan's inversion and the masu's wall-raising. Record 0002. - **Task 1:** `AxisRecord` gains `parent: Int?` (the axis whose motion carries it), `window: [Double]?` (its span of *t*, default `[0, 1]`) and `angles: [Double]?` (a solved curve, 257 samples over its window; absent means linear). `StepRecord` gains `nonRigid: Bool`; Task 0b adds what a non-rigid step needs beyond the flag. - **Task 3:** `FoldAxis` carries the same; `readSteps` builds the tree and rejects a parent cycle or a window outside 0…1. - **Task 4:** `positions(at:)` composes rotations down the tree, using each axis's window and curve (cubic Hermite between samples). The isometry sweep adds case 3's vertex, built in code with curves from the closed form. - **Task 6:** a staggered letter fold is clean where the simultaneous one collides. - **Task 7:** `foldc` solves each coupled step's curves by the spike's method and writes them; the script may name a step's driving crease and give creases windows. - **Task 8:** the catalogue's isometry sweep exempts flagged steps, which are held to Task 0b's bound instead. - **Task 2:** unchanged. Removing the overlapping-moving-sets rule (point 5 above) is a separate decision, still open. ## Appendix: spike output `swift run -c release --package-path spikes/interpolation`: ``` ## Case 1 — letter fold, both flaps valley - M1, one linear parameter: max gap 8.88e-16; first collision at t = 0.668 (120.2°) - M1 staggered (left on t 0–0.5, right on 0.5–1): max gap 8.88e-16; first collision none ## Case 2 — letter fold, left valley, right mountain - M1: max gap 8.88e-16; first collision none ## Case 3 — flat-foldable degree-4 vertex, sectors 60°, 80°, 120°, 100° - M1, all four angles linear to the assignment with the odd crease at 0°: max gap 1.38e0 on a sheet of side 2 - M1, all four angles linear to the assignment with the odd crease at 60°: max gap 1.08e0 on a sheet of side 2 - M2, 140° crease driven 0 → 180, 0° and 260° creases solved, 60° crease measured (seed for 0°: −): max gap 4.19e-12; angles (0°, 60°, 140°, 260°) at t = 0.25: 45.0, -16.4, 45.0, 16.4; 0.5: 90.0, -38.3, 90.0, 38.3; 0.75: 135.0, -80.0, 135.0, 80.0; 1: 180.0, -180.0, 180.0, 180.0 - M2, 140° crease driven 0 → 180, 0° and 260° creases solved, 60° crease measured (seed for 0°: +): max gap 4.19e-12; angles (0°, 60°, 140°, 260°) at t = 0.25: 45.0, -16.4, 45.0, 16.4; 0.5: 90.0, -38.3, 90.0, 38.3; 0.75: 135.0, -80.0, 135.0, 80.0; 1: 180.0, -180.0, 180.0, 180.0 - closed form tan(ρ₁/2) = k·tan(ρ₂/2), k = cos((α+β)/2) / cos((α−β)/2) = 0.3473 for α = 60°, β = 80° - solved curves sampled at N + 1 points and interpolated, max gap on a sheet of side 2: N = 16: linear 1.0e-2, cubic 1.07e-3; N = 32: linear 2.49e-3, cubic 1.22e-4; N = 64: linear 6.27e-4, cubic 1.49e-5; N = 128: linear 1.57e-4, cubic 1.83e-6; N = 256: linear 3.92e-5, cubic 2.25e-7 ## Case 4 — inside reverse fold, 4×2 sheet folded on its spine y = 1 - start gap 0. Body spine and tip spine start at 180, reverse creases A (upper layer) and B (lower layer) at 0. Angles below are measured from the geometry and unwrapped, so a value past ±180 means a face went through its neighbour at the hinge. - (a) body held at 180, B → 180.0, A solved (seed +): max gap 8.06e-14; ranges body 180.0…180.0, tip 180.0…180.0, A -180.0…0, B 0…180.0; end body 180.0, tip 180.0, A -180.0, B 180.0 - (a) body held at 180, B → 180.0, A solved (seed −): max gap 8.19e-14; ranges body 180.0…180.0, tip 180.0…180.0, A -180.0…0, B 0…180.0; end body 180.0, tip 180.0, A -180.0, B 180.0 - (b) body free, B → 180.0, body and A solved: max gap 8.19e-14; ranges body 180.0…180.0, tip 180.0…180.0, A -180.0…0, B 0…180.0; end body 180.0, tip 180.0, A -180.0, B 180.0 - (a) body held at 180, B → -180.0, A solved (seed +): max gap 8.14e-14; ranges body 180.0…180.0, tip 180.0…180.0, A 0…180.0, B -180.0…0; end body 180.0, tip 180.0, A 180.0, B -180.0 - (a) body held at 180, B → -180.0, A solved (seed −): max gap 6.37e-14; ranges body 180.0…180.0, tip 180.0…180.0, A 0…180.0, B -180.0…0; end body 180.0, tip 180.0, A 180.0, B -180.0 - (b) body free, B → -180.0, body and A solved: max gap 8.14e-14; ranges body 180.0…180.0, tip 180.0…180.0, A 0…180.0, B -180.0…0; end body 180.0, tip 180.0, A 180.0, B -180.0 - (c) body free, tip spine driven 180 → −180, body and B solved (seed B +): max gap 9.93e-14; ranges body -180.0…180.0, tip -180.0…180.0, A 0…0, B 0…0; end body -180.0, tip -180.0, A 0, B 0 - (c) body free, tip spine driven 180 → −180, body and B solved (seed B −): max gap 9.99e-14; ranges body -180.0…180.0, tip -180.0…180.0, A 0…0, B 0…0; end body -180.0, tip -180.0, A 0, B 0 - (c′) phase 1, tip spine 180 → 0: max gap 10.0e-14; ranges body 0…180.0, tip 0…180.0, A 0…0, B 0…0; end body 0, tip 0, A 0, B 0 - (c′) phase 2, tip spine 0 → −180 (seed B +): max gap 9.68e-14; ranges body 0…180.0, tip -180.0…0, A 0…180.0, B 0…180.0; end body 180.0, tip -180.0, A 180.0, B 180.0 - (c′) phase 2, tip spine 0 → −180 (seed B −): max gap 9.96e-14; ranges body -180.0…0, tip -180.0…0, A 0…0, B 0…0; end body -180.0, tip -180.0, A 0, B 0 - (d) M4, body held at 180, tip spine forced 180 → −180, B least-squares: max gap 2.0e0; ranges body 180.0…180.0, tip -180.0…180.0, A 0…180.0, B 0…180.0; end body 180.0, tip -180.0, A 180.0, B 180.0 (flap height 1) - (e) body spine opened to φ at mid-fold, tip spine driven through, B least-squares: φ 180.0° → gap 2.0e0; φ 150.0° → gap 1.6e0; φ 120.0° → gap 1.16e0; φ 90.0° → gap 7.32e-1; φ 60.0° → gap 3.56e-1; φ 30.0° → gap 2.42e-1; φ 10.0° → gap 4.05e-1; φ 0° → gap 4.81e-1 ## Case 5 — petal fold of a preliminary base's front flap - 20 faces, 26 creases, 14 free on the spanning tree, 4 measured off it; preliminary base start gap 2.48e-16 - the petal fold's own creases only (hinge driven; 4 of the 4 kite creases on the tree, the rest measured): - kite seed +: max gap 1.1e-15; collision at t = 0.735; hinge 0…180.0; front kites 0…180.0, 0…180.0 → 180.0, 180.0; inner kites -180.0…0, -180.0…0 → -180.0, -180.0; outer midline segments -180.0…-180.0, -180.0…-180.0 → -180.0, -180.0; inner square sides -180.0…0, 0…180.0, 0…180.0, -180.0…0 → -180.0, 180.0, 180.0, -180.0; creases changed: 10; front kite at t = 0.25, 0.5, 0.75: 45.0, 90.0, 135.0 - M1, the same end state with every angle linear: max gap 1.11e-15 - kite seed −: max gap 1.27e-15; collision none; hinge 0…180.0; front kites -180.0…0, -180.0…0 → -180.0, -180.0; inner kites 0…180.0, 0…180.0 → 180.0, 180.0; outer midline segments -180.0…-180.0, -180.0…-180.0 → -180.0, -180.0; inner square sides -180.0…0, 0…180.0, 0…180.0, -180.0…0 → -180.0, 180.0, 180.0, -180.0; creases changed: 10; front kite at t = 0.25, 0.5, 0.75: -45.0, -90.0, -135.0 - M1, the same end state with every angle linear: max gap 1.31e-15 - front point (0,0): (1.0, 1.0, 0) → (0.646, 0.646, -0.5) → (0.293, 0.293, 0) - side corner (0.5,0): (1.0, 0.5, 0) → (0.907, 0.657, -0.073) → (0.646, 0.646, 0) - inner corner (1,0): (1.0, 1.0, 0) → (0.646, 0.646, -0.5) → (0.293, 0.293, 0) - hinge end B: (0.793, 0.5, 0) → (0.793, 0.5, 0) → (0.793, 0.5, 0) - control, every crease outside the back quadrant free (14 unknowns): max gap 9.57e-16; collision none; hinge 0…180.0; front kites 0…0, 0…0 → 0, 0; inner kites 0…0, 0…0 → 0, 0; outer midline segments -180.0…-180.0, -180.0…-180.0 → -180.0, -180.0; inner square sides -180.0…0, 0…180.0, 0…180.0, -180.0…0 → -180.0, 180.0, 180.0, -180.0; creases changed: 6 ```