Commit 3134c1e782

3134c1e78262d6a40f3c3cc9df474773f66e7d73

parent: e36f7091df

Verified · cmc

cmc <hello@cleberg.net> · 2026-10-20 04:53 UTC

Plan: batch E rulings and carry-overs into Tasks 11, 14 and 15

Record the occluders and snapshot recording for Task 9, the runtime shader
compile and allMovingFaces for Task 10, DiagramCanvas drawing through
Notation and cluster caching for Task 11, the camera's up vector for
Task 14, and composite creases, unfold notation and edge-on faces for
Task 15.

Closes #5

Layout: unified · split

docs/superpowers/plans/2026-10-19-fold.md +8 −4
@@ -1581,7 +1581,7 @@ Expected: FAIL.
1581 1581
1582- [ ] **Step 3: Implement the types, `buildDiagram` and `visibleSegments`** 1582- [ ] **Step 3: Implement the types, `buildDiagram` and `visibleSegments`**
1583 1583
1584Project through the viewpoint's orthographic matrix. Classify each edge as above. Clip each edge against the **union** of the projected faces `order` places above either of the edge's incident faces, and emit the surviving segments, drawing coincident segments once. Clipping against each face separately would keep an edge lying under the seam between two adjacent upper faces — e8 in quarters frame 2 lies on the boundary of f3 and of f2 but inside their union. An edge on the outer boundary of that union is not hidden. Subdivision edges are never drawn. Golden images are generated once, inspected by eye against the reference, then committed. 1584Project through the viewpoint's orthographic matrix. Classify each edge as above. Clip each edge against the **union** of the projected faces `order` places above either of the edge's incident faces, and emit the surviving segments, drawing coincident segments once. Clipping against each face separately would keep an edge lying under the seam between two adjacent upper faces — e8 in quarters frame 2 lies on the boundary of f3 and of f2 but inside their union. An edge on the outer boundary of that union is not hidden. Subdivision edges are never drawn. A face hides an edge when it follows either of the edge's faces in their shared cluster, from `LayerOrder.clusters` looking along −`eye`; faces in other clusters do not occlude, which holds while every diagram frame is flat. Golden images are recorded when missing or with `FOLD_RECORD_SNAPSHOTS=1` (the test fails when it records), compared at 24/255 per channel, inspected by eye against the reference, then committed. The drawing itself is Notation's, so the app's diagram and the goldens are one drawing.
1585 1585
1586- [ ] **Step 4: Run tests to verify they pass** 1586- [ ] **Step 4: Run tests to verify they pass**
1587 1587
@@ -1623,9 +1623,9 @@ Depth handling is **hybrid**. `faceOrders` is defined only for faces that overla
1623 1623
1624Facets are two-sided, front and back distinguished in the fragment shader by `[[front_facing]]`. This task owns Review Focus item 3. 1624Facets are two-sided, front and back distinguished in the fragment shader by `[[front_facing]]`. This task owns Review Focus item 3.
1625 1625
1626During a non-rigid step the faces that open on the spine move, but `FoldStep.movingFaceUnion` holds only the main axes' faces (the pop's held faces depend on that). `LayerOrder.active`'s rewrite of mixed moving/still pairs must use the set `layerMotionDefects` uses — the main, open and close axes' faces — made a named `FoldStep` property here rather than a second copy. The pop's `SparseCholesky` factor is `@unchecked Sendable`; confirm concurrent solves on one factor are safe, or serialise them, before the renderer calls the interpolator from more than one thread. 1626During a non-rigid step the faces that open on the spine move, but `FoldStep.movingFaceUnion` holds only the main axes' faces (the pop's held faces depend on that). `LayerOrder.active`'s rewrite of mixed moving/still pairs must use the set `layerMotionDefects` uses — the main, open and close axes' faces — made a named `FoldStep` property here (`allMovingFaces`) rather than a second copy. The pop's `SparseCholesky` factor is `@unchecked Sendable`; confirm concurrent solves on one factor are safe, or serialise them, before the renderer calls the interpolator from more than one thread.
1627 1627
1628SwiftPM compiles `Shaders.metal` with the Metal toolchain; see *Setup* step 4. 1628`Shaders.metal` is a copied resource compiled at `PaperRenderer.init` with `makeLibrary(source:options:)`: SwiftPM can compile it with the Metal toolchain (*Setup* step 4), but then warns on every build.
1629 1629
1630- [ ] **Step 1: Write the failing tests** 1630- [ ] **Step 1: Write the failing tests**
1631 1631
@@ -1736,6 +1736,8 @@ git commit -m "Metal paper renderer with hybrid depth and cluster ordering"
1736 1736
1737`project.yml` mirrors `krz/moonrise/App/project.yml`. The `.xcodeproj` is generated and ignored by git, as in moonrise: `xcodegen generate --spec App/project.yml`. On iPad the diagram and the model sit side by side; on iPhone they swap. The diagram's caption is the step's `instruction`. 1737`project.yml` mirrors `krz/moonrise/App/project.yml`. The `.xcodeproj` is generated and ignored by git, as in moonrise: `xcodegen generate --spec App/project.yml`. On iPad the diagram and the model sit side by side; on iPhone they swap. The diagram's caption is the step's `instruction`.
1738 1738
1739`DiagramCanvas` draws through Notation's public CoreGraphics drawing function (via `GraphicsContext.withCGContext`), the same one Task 9's golden images are rendered with, so the snapshots hold the diagram the user sees; it adds no glyph geometry of its own. `PaperView` computes cluster membership once per *t* and re-sorts only when the camera moves; `LayerOrder.clusters` computes both together, so add the split there if profiling on device shows the per-frame cost matters. Reuse the vertex buffer between frames, and give the depth texture `.memoryless` storage on iOS.
1740
1739- [ ] **Step 1: Write the failing UI tests** 1741- [ ] **Step 1: Write the failing UI tests**
1740 1742
1741```swift 1743```swift
@@ -1986,6 +1988,8 @@ git commit -m "Drag gesture for turn-over and rotate steps"
1986- Produces: 1988- Produces:
1987 - `struct OrbitGesture` — two-finger drag to `Camera` orbit, pinch to field of view 1989 - `struct OrbitGesture` — two-finger drag to `Camera` orbit, pinch to field of view
1988 1990
1991`Camera.viewProjection` builds its basis from `cross(viewDirection, up)`, which is undefined when `up` is parallel to the view direction; `OrbitGesture` keeps `up` perpendicular to the view direction as it orbits, including past the poles.
1992
1989A folding model cannot be described by a static label, so the paper view's accessibility label is the step's authored `instruction`. `AppStore/rights-basis.md` records that every shipped model is traditional and why that matters. 1993A folding model cannot be described by a static label, so the paper view's accessibility label is the step's authored `instruction`. `AppStore/rights-basis.md` records that every shipped model is traditional and why that matters.
1990 1994
1991- [ ] **Step 1: Write the failing tests** 1995- [ ] **Step 1: Write the failing tests**
@@ -2073,7 +2077,7 @@ git commit -m "Orbit and zoom, accessibility pass and release assets"
2073 2077
2074Authoring, not engineering: three crease patterns, three scripts, and a correction pass over each model's guessed `faceOrders`, made as overrides in the script. Every gate already exists — Task 2's validator, Task 6's interpenetration checker, Task 8's catalogue tests including the isometry sweep — so this task adds no new machinery, only the models and the record of how each was verified. Published sampan sequences differ in their middle steps; `docs/authoring/sampan.md` records which sequence was authored and its source. 2078Authoring, not engineering: three crease patterns, three scripts, and a correction pass over each model's guessed `faceOrders`, made as overrides in the script. Every gate already exists — Task 2's validator, Task 6's interpenetration checker, Task 8's catalogue tests including the isometry sweep — so this task adds no new machinery, only the models and the record of how each was verified. Published sampan sequences differ in their middle steps; `docs/authoring/sampan.md` records which sequence was authored and its source.
2075 2079
2076Carried 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`. 2080Carried 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).
2077 2081
2078The 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. 2082The 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.
2079 2083