Make named creases material; add flap operands (#28) #43

Merged
toph merged 7 commits from feat/material-creases into main 2026-07-03 10:50:41 +00:00
Owner

For #28. PR2 of the #26/#28 material-crease design — the user-facing half, built on PR1's edge entity (#40).

Makes named creases material: a named crease --d now resolves against its current edge-pieces and tracks through folds and flip, instead of being frozen to the table-space line it was bound to. Binding stores Material (crease_id, axis); resolution walks the crease's pieces — returns the original line if they still lie on it (the byte-stable common case), recomputes if a rigid move or flip relocated them, and errors if a later fold bent them apart:

--d is no longer straight after folding; pick a flap, e.g. --( --d #(.a .b .c) )

Ships the escape hatch in the same PR: #(.a .b .c) names the unique flat flap (a face) carrying all listed points, and --( --d #(.a .b .c) ) restricts a crease to that flap's straight piece. Flap resolution is in paper space — a point set unique to one flap disambiguates even when individual corners are shared between adjacent flaps.

subdivide/fold_with_records now mint one crease_id per operation (was per cut face) so a crease's pieces share an identity. The id stays internal and unserialized, so FOLD output is unchanged: all 20 pre-existing example goldens are byte-identical — every existing program references its creases while flat, resolving to the original line. (The design's premise that multiple-folds.bel would bend a crease turned out geometrically false; it is unchanged.) Three new examples exercise the bent→error path, the #(...) escape hatch, and flip-tracking.

Out of scope, filed as follow-ups: materiality in the emitted beloch:named_lines (#45), material creases through def line-parameters (#46), and taco-taco/taco-tortilla validity checks (#47). Design and plan live in docs/superpowers/{specs,plans}/2026-07-03-*.

For #28. PR2 of the #26/#28 material-crease design — the user-facing half, built on PR1's edge entity (#40). Makes named creases **material**: a named crease `--d` now resolves against its current edge-pieces and tracks through folds and `flip`, instead of being frozen to the table-space line it was bound to. Binding stores `Material (crease_id, axis)`; resolution walks the crease's pieces — returns the original line if they still lie on it (the byte-stable common case), recomputes if a rigid move or `flip` relocated them, and errors if a later fold bent them apart: ``` --d is no longer straight after folding; pick a flap, e.g. --( --d #(.a .b .c) ) ``` Ships the escape hatch in the same PR: `#(.a .b .c)` names the unique flat flap (a face) carrying all listed points, and `--( --d #(.a .b .c) )` restricts a crease to that flap's straight piece. Flap resolution is in paper space — a point set unique to one flap disambiguates even when individual corners are shared between adjacent flaps. `subdivide`/`fold_with_records` now mint one `crease_id` per operation (was per cut face) so a crease's pieces share an identity. The id stays internal and unserialized, so FOLD output is unchanged: all 20 pre-existing example goldens are byte-identical — every existing program references its creases while flat, resolving to the original line. (The design's premise that `multiple-folds.bel` would bend a crease turned out geometrically false; it is unchanged.) Three new examples exercise the bent→error path, the `#(...)` escape hatch, and flip-tracking. Out of scope, filed as follow-ups: materiality in the emitted `beloch:named_lines` (#45), material creases through `def` line-parameters (#46), and taco-taco/taco-tortilla validity checks (#47). Design and plan live in `docs/superpowers/{specs,plans}/2026-07-03-*`.
Author
Owner

The two new escape-hatch examples, rendered — crease pattern and folded form:

crease-flap-restrict.bel--b (through .a .c) is bent by the --v half-fold, so a bare reference errors. --( --b #(.c .d) ) picks the top-flap piece and folds cleanly.

crease-flap-restrict crease pattern
crease-flap-restrict folded

crease-flip-reuse.bel--q is precreased, the sheet flipped, then reused. Material tracking resolves --q to its flipped position, so perp --q through .b lands correctly rather than snapping back to the pre-flip line.

crease-flip-reuse crease pattern
crease-flip-reuse folded

The two new escape-hatch examples, rendered — crease pattern and folded form: **`crease-flap-restrict.bel`** — `--b` (through `.a .c`) is bent by the `--v` half-fold, so a bare reference errors. `--( --b #(.c .d) )` picks the top-flap piece and folds cleanly. ![crease-flap-restrict crease pattern](https://git.toph.so/attachments/6bf8d6b0-7da8-4c23-b15b-619dc77f4a56) ![crease-flap-restrict folded](https://git.toph.so/attachments/47bb3af2-5984-4124-85f1-65a931d56397) **`crease-flip-reuse.bel`** — `--q` is precreased, the sheet flipped, then reused. Material tracking resolves `--q` to its flipped position, so `perp --q through .b` lands correctly rather than snapping back to the pre-flip line. ![crease-flip-reuse crease pattern](https://git.toph.so/attachments/d09b15cc-7701-4449-8bae-e281b48d3337) ![crease-flip-reuse folded](https://git.toph.so/attachments/219af402-bd61-4c15-9297-2559d584835a)
toph merged commit 7489ec7155 into main 2026-07-03 10:50:41 +00:00
toph deleted branch feat/material-creases 2026-07-03 10:50:41 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
toph/beloch!43
No description provided.