Commit 42a7a0e7fc

42a7a0e7fcbba12b99647b74f96e16fe449d4a88

parent: 679bb3fc48

Verified · cmc

cmc <hello@cleberg.net> · 2026-10-19 21:37 UTC

Plan: subdivision edges are never an axis; pop axis windows are on the step's t

Ref #2

Layout: unified · split

docs/superpowers/plans/2026-10-19-fold.md +2 −2
@@ -19,7 +19,7 @@
1919- `edges_assignment` codes: `B` boundary, `M` mountain, `V` valley, `F` flat, `U` unassigned. `C` and `J` are rejected.
2020- `edges_foldAngle` is degrees in −180...180, positive for valley, negative for mountain, 0 for `F`, `U` and `B`.
2121- `faceOrders` triples are `[f, g, s]`; `s = +1` means `f` is above `g` **on the side `g`'s normal points toward**, so the sign is evaluated against the current view direction, not absolutely, and two triples can only be compared after normalising each by its `g`'s folded-state normal. Cycles (after normalising) are rejected.
22- Faces are convex. FOLD's alternative, splitting faces with `J` edges, is not supported. A crease that ends inside the sheet (a pinch or partial crease) leaves a nonconvex face around its end; split that face with a **subdivision edge** — assigned `F`, flat in every frame, `edges_krz:firstCreasedAtStep` null, never drawn.
22- Faces are convex. FOLD's alternative, splitting faces with `J` edges, is not supported. A crease that ends inside the sheet (a pinch or partial crease) leaves a nonconvex face around its end; split that face with a **subdivision edge** — assigned `F`, flat in every frame, never the axis edge of any step, `edges_krz:firstCreasedAtStep` null, never drawn. A crease made only by a fold-and-unfold is flat in every frame but is an axis, so it is not a subdivision edge and needs `edges_krz:firstCreasedAtStep`.
2323- Extension keys: `edges_krz:firstCreasedAtStep` (key frame, inherited), `krz:step` (frames 1…N), `krz:faceOrders_midFold` (frames 1…N).
2424- **Step numbering.** Frame 0 is the key frame (the unfolded sheet); `file_frames[i]` is frame `i + 1`. Step n, counting from 1, takes frame n − 1 to frame n and is recorded in frame n's `krz:step`. Every index called a step — in the format, the validator's defects, `FoldStep.index`, the UI — is this n. Defects about one frame's state say `frame:`; defects about a transition or a step record say `step:`; frame n and step n share the number.
2525- Every frame in `file_frames` carries `frame_parent: 0` and `frame_inherit: true`, and never overrides `edges_vertices` or `faces_vertices`.
@@ -268,7 +268,7 @@ git commit -m "Non-rigid steps: model, bound and the remaining coupled steps"
268268 - `struct AxisRecord: Codable, Equatable, Sendable { let edge: Int; let movingFaces: [Int]; let startAngle: Double; let endAngle: Double; let peakAngle: Double?; let parent: Int?; let window: [Double]?; let angles: [Double]? }` — `parent` is the index, in the same step's `axes`, of the axis whose motion carries this one; `window` is `[t0, t1]`, default `[0, 1]`; `angles` is a solved curve, the fold angle at 257 evenly spaced points of the window, absent for a linear axis
269269 - `struct Viewpoint: Codable, Equatable, Sendable { let eye: SIMD3<Double>; let up: SIMD3<Double> }` — `eye` is the unit direction toward the viewer
270270 - `struct StepRecord: Codable, Equatable, Sendable { let kind: StepKind; let technique: StepTechnique; let instruction: String?; let axes: [AxisRecord]; let rotateDegrees: Double?; let turnOverAxis: TurnOverAxis?; let repeatOf: Int?; let nonRigid: Bool; let pop: PopRecord?; let viewpoint: Viewpoint }` — `nonRigid` decodes to `false` when absent; a non-rigid step's `axes` still list its creases with their start and end angles, for the diagram and the validator, and its motion is `pop`
271 - `struct PopRecord: Codable, Equatable, Sendable { let spine: [Int]; let openAngle: Double; let phases: [Double]; let openAxes: [AxisRecord]; let popped: [SIMD3<Double>]; let closeAxes: [AxisRecord] }` — decision 0002's open, pop, close: `spine` is the flap's spine edges; `openAngle` the spine's fold angle when open (default 30); `phases` the two boundaries on *t* (default `[1/3, 2/3]`); `openAxes` open the flap on `[0, phases[0]]`; `popped` is every vertex's position after the pop; `closeAxes`, relative to `popped`, close it on `[phases[1], 1]`
271 - `struct PopRecord: Codable, Equatable, Sendable { let spine: [Int]; let openAngle: Double; let phases: [Double]; let openAxes: [AxisRecord]; let popped: [SIMD3<Double>]; let closeAxes: [AxisRecord] }` — decision 0002's open, pop, close: `spine` is the flap's spine edges; `openAngle` the spine's fold angle when open (default 30); `phases` the two boundaries on *t* (default `[1/3, 2/3]`); `openAxes` open the flap on `[0, phases[0]]`; `popped` is every vertex's position after the pop; `closeAxes`, relative to `popped`, close it on `[phases[1], 1]`. Axis windows are on the step's whole *t*, as for any axis, so `foldc` writes each opening axis's window inside `[0, phases[0]]` and each closing axis's inside `[phases[1], 1]`
272272 - `struct FoldFrame: Codable, Sendable { var verticesCoords: [SIMD3<Double>]; var edgesAssignment: [EdgeAssignment]; var edgesFoldAngle: [Double]; var faceOrders: [[Int]]; var faceOrdersMidFold: [[Int]]?; var step: StepRecord? }`
273273 - `struct FoldFile: Codable, Sendable { var fileSpec: Double; var fileCreator: String?; var fileTitle: String?; var fileAuthor: String?; var fileClasses: [String]; var edgesVertices: [[Int]]; var facesVertices: [[Int]]; var edgesFirstCreasedAtStep: [Int?]; var frames: [FoldFrame] }` — `frames[0]` is the key frame, `frames[n]` is frame n
274274 - `var (FoldFile).stepCount: Int { get }` — `frames.count − 1`
docs/superpowers/specs/2026-10-19-fold-design.md +1 −1
@@ -141,7 +141,7 @@ in scope needs one. It recommends `J` edges to split faces that overlap in
141141several regions or are nonconvex; `J` is rejected and faces must be convex.
142142A crease that ends inside the sheet (a pinch) leaves a nonconvex face around
143143its end, which is split by a **subdivision edge**: assigned `F`, flat in
144every frame, with no `edges_krz:firstCreasedAtStep`, and never drawn.
144every frame, never any step's axis, with no `edges_krz:firstCreasedAtStep`, and never drawn.
145145
146146### Frames and step numbering
147147