docs/decisions/0003-bending-openings.md

main
fold/docs/decisions/0003-bending-openings.md rendered · source · history · blame · raw

426 lines · 21846 bytes

21 symbols in this file
  1# 0003 — Openings for the crane's reverse folds and the sampan's inversion
  2
  3**Status:** measured and decided 2026-10-22 (see *Decision*). The decision going in was to bend
  4the opening: the flap's near layers bend open while the body holds still, using the
  5same as-rigid-as-possible machinery as 0002's pop, and the same machinery for the
  6sampan's inversion. The measurements below do not support that as stated. They support
  7a rigid opening of the whole near side on a bend line, with the pop the only bent
  8phase. For the sampan, bending does not work either.
  9
 10Follows `0002-non-rigid-steps.md`. Spike: `spikes/bending`, run with
 11`swift run -c release --package-path spikes/bending [case]`. The cases are `mesh`,
 12`crane`, `stages`, `pop`, `sampan`, `sampanpath` and `sampanbend`; with no argument
 13it runs all of them, in about four minutes.
 14
 15## Question
 16
 17Task 15 stopped on two steps that no rigid motion makes:
 18
 191. **The crane's inside reverse folds (neck, tail, head).** The neck's near layers
 20   cannot open rigidly on the spine: the near half of the paper crosses the spine's
 21   line, so turning it drives the other leg's layers through each other. Once the neck
 22   is reversed, the tail and head have no single hinge to open on.
 232. **The long-form sampan's step 14, turning inside out.** About 108 faces hang on the
 24   base hexagon B's eight edges. There is no spine, and the scripted end does not close
 25   (gap 0.632).
 26
 27Also, on the crane's pattern the pop's strain was set by sliver edges in the render
 28mesh, not by the paper.
 29
 30This record measures whether bending fixes those three things, and how.
 31
 32## Inputs
 33
 34`spikes/bending/Data` holds scratch outputs from Task 15:
 35
 36- `crane-1-12.fold`: the crane through step 12 (narrowed legs), with the staged neck
 37  creases. Step 4 was compiled with the locally patched loop solver from the crane
 38  report (Blocker 1, still open).
 39- `crane-1-13.foldscript`: the staged neck script.
 40- `sampan-long-1-13.fold`: the long-form sampan through step 13.
 41- `sampan-long-attempt-2.foldscript`: the failed step 14.
 42
 43The spike depends on FoldKit by path. It uses FoldKit for decoding, for compiling the
 440002 fixture, and for FoldKit's own `RenderMesh` and pop. It builds its own meshes,
 45as-rigid-as-possible solver, kinematics and interpenetration check.
 46
 47Interpenetration is counted on mesh triangles in different FOLD faces. Two kinds of
 48crossing are not counted:
 49
 50- crossings shallower than 1e-3 of the sheet's size, which is about 0.15 mm on a 15 cm
 51  square, roughly the paper's thickness;
 52- coplanar pairs, which are FoldKit's rule.
 53
 54"Strain" is the largest relative change in a mesh edge's length, as in 0002. "Principal"
 55is the largest |σ − 1| over the triangles' singular values. Principal strain does not
 56depend on which directions the mesh's edges run in.
 57
 58## 1. Render mesh
 59
 60Three constructions were measured, each with spacing h equal to the longer side divided
 61by 32:
 62
 63- **grid:** 0002's, which is FoldKit's `RenderMesh`;
 64- **collapsed:** the grid with edges shorter than h/4 collapsed onto crease-pattern
 65  vertices or along creases;
 66- **delaunay:** each crease divided evenly at about h; a triangular lattice inside each
 67  face, kept 0.6 h from the face's sides; Delaunay within each face (ear clipping, point
 68  insertion, Lawson flips). Faces stay convex and conforming, and the FOLD topology is
 69  unchanged.
 70
 71| pattern | mesh | shortest edge | shortest / h | smallest angle |
 72|---|---|---|---|---|
 73| crane | grid | 1.39e-4 | 0.004 | 0.1° |
 74| crane | collapsed | 3.94e-4 | 0.013 | 0.7° |
 75| crane | delaunay | 6.18e-3 | 0.198 | 10.9° |
 76| sampan | grid | 2.53e-2 | 0.202 | 8.1° |
 77| sampan | delaunay | 4.66e-2 | 0.373 | 18.4° |
 78
 79On the crane, Delaunay's shortest edges are at the legs' points, where creases meet at
 80small angles. They are wedges of real paper, not slivers.
 81
 82**Pop strain on each mesh** (`mesh`):
 83
 84| case | grid | collapsed | delaunay |
 85|---|---|---|---|
 86| 0002 fixture, opened to 30° from flat, h = 1/32 | 7.46% (principal 7.79%) | 7.46% | 9.69% (10.94%) |
 87| same, h = 1/64 | 8.45% (8.73%) | 8.45% | 9.47% (9.50%) |
 88| crane neck, opened to 160°, slerp pop (§2) | 402% (497%) | 9.80% (33.6%) | 8.74% (8.84%) |
 89| crane neck, opened to 150° | 918% | 21.2% (71.6%) | 18.8% (19.0%) |
 90
 91The grid's crane numbers are sliver edges 2e-4 long. Collapsing leaves edges 4e-4 long:
 92it cannot move a point lying on one crease onto another crease. Delaunay's edge strain
 93and principal strain agree on the crane, which means its strain is the paper's.
 94
 95The fixture is not a clean comparison. Its pop strain depends on the mesh, ranging from
 967.5% to 11% across meshes and resolutions. At finer resolution the two meshes approach
 97each other, at about 9%. The grid's 7.46% is partly an artifact of its edges running
 98only in three directions.
 99
100**Recommendation: the Delaunay construction.** Keep the bound on edge strain.
101
102## 2. Crane: neck, tail and head
103
104### The neck crease
105
106The staged script's neck crease runs from the spine at view height 0.47 to the leg's
107edge at 0.288. Reflected about that crease, the neck points down and out, 35° below
108horizontal. That is not the crane's neck.
109
110The spike also measures a **raised** crease: 22.5° below horizontal from the same spine
111point. The neck then ends 45° above horizontal, rising between the body's layers. The
112spike adds this crease to the crane's pattern through every layer of the leg. The tail is
113the mirror of the raised neck. The head crease runs across the neck 0.33 from the
114vertex, horizontal, so the head points 45° down. Which neck crease the crane uses is the
115author's call; the raised one is the harder case and the one measured throughout.
116
117### How the motion is built
118
119The reverse vertex is 0001's degree-4 vertex. With the near layers turned by α about the
120spine, the tip has two rigid placements:
121
122- **unreversed:** the tip turns with its layers;
123- **reversed:** each layer of the tip turns about its own reverse crease until the tip's
124  spine meets in the plane bisecting the opened layers. That turn is
125  γ = 2·atan2((c_n × w⊥)·c, w⊥·c), where c is the far crease, c_n the near crease turned
126  by α, w the tip's spine direction and w⊥ its component across c_n.
127
128The motion has three phases:
129
1301. Open over t 0–⅓, with the tip unreversed.
1312. Pop over ⅓–⅔, by slerp per face as in 0002, with everything else held.
1323. Close over ⅔–1, on the reversed branch.
133
134The close lands exactly on the step's end, with the tip reflected in its crease.
135
136### Bending the opening (`crane`)
137
138Three ways to open were tried.
139
140- **A** bends the leg's near layers and holds the body.
141- **B** bends the whole near side on the flap's side, together with the two near faces
142  that cross the spine's line (1 and 14: the front wing's centre and the layer under
143  it).
144- **C** puts a bend line on the spine's line through those two faces. The bend line is an
145  edge that is never creased. The near side then turns rigidly.
146
147| opening | neck crease | α | open strain (principal) | pop strain | collisions open / pop / close | tip between layers |
148|---|---|---|---|---|---|---|
149| A, body held | staged | 150° | 44.0% (44.6%) | 44.0% | 1239 / 2738 / 4576 | yes |
150| A, body held | raised | 150° | 199% (204%) | 199% | 1234 / 1320 / 3316 | yes |
151| B, h = 1/32 | staged | 150° | 9.70% (13.8%) | 9.70% | 5815 / 9330 / 15267 | yes |
152| B, h = 1/32 | raised | 150° | 11.7% (16.7%) | 18.8% | 5603 / 9585 / 13971 | yes |
153| B, h = 1/64 | raised | 150° | 6.55% (8.02%) | 13.8% | 12056 / 16710 / 21696 | yes |
154| C, bend line | staged | 150° | 0 | 3.84% | 0 / 0 / 0 | yes |
155| C, bend line | raised | 160° | 0 | 8.74% | 0 / 0 / 0 | yes |
156
157**What these show.**
158
159- **The body cannot be held (A).** The neck's innermost near layer (face 21) runs on
160  under the front wing to the centre of the square. At the reverse vertex it must open
161  nearly flat, and at the wing it must stay closed. Developability makes it worse: along
162  a straight crease the near layer's opening angle is constant, unless the paper creases
163  again near it. Forcing the change over the short stretch between the two strains the
164  paper by 44–200%.
165- **Bending the near side without a shared line (B) passes layers through each other.**
166  Its strain falls as the mesh is refined (11.7% → 6.6% at 150°), because the solver
167  approximates a fold in a narrow band. But faces 1 and 14 lie one on the other, and each
168  bends on its own. They cross at the first sample, and the counts grow with refinement.
169  Every layer of a stack must bend alike, and independent as-rigid-as-possible solves
170  per layer do not do that.
171- **A bend line (C) makes the opening rigid.** It has zero strain and no
172  interpenetration. The near side turns as one stack, and the wing's centre folds on the
173  line with the layer under it.
174
175C is not bending. It opens the front wing's half along its centre by α for the duration
176of the step. In real paper, that is where the wing flexes when the leg is opened.
177
178### All three folds with a bend line (`stages`)
179
180- **Tail.** The tail is the neck mirrored, in frame 13. The neck's tip, reversed between
181  the left layers, holds still.
182- **Head.** The head re-opens the neck by turning the left near side again. The neck's
183  layers follow the neck's own reversed branch rigidly. By symmetry, they open by
184  exactly α, the same as the body. The head then pops between the neck's layers.
185
186At every opening, the units' placements agree within 6e-13, and the open and close have
187zero strain.
188
189| step | α | pop strain (principal) | collisions | tip between layers |
190|---|---|---|---|---|
191| neck | 170° / 160° / 150° | 2.25% / 8.74% / 18.8% (19.0%) | 0 | yes |
192| tail | 170° / 160° / 150° | 2.33% / 9.01% / 19.2% (20.7%) | 0 | yes |
193| head | 170° / 160° / 150° | 0.46% / 1.82% / 4.06% | 0 | yes |
194
195The neck's and tail's pop strain sits at the leg's tip, on 6.4e-3 edges at the paper's
196corner. The two layers of the tip turn about different creases, so they part along the
197tip's spine, and the leg is narrowest at its point.
198
199### The pop (`pop`)
200
201Four pops were compared. In all of them the opening and closing are rigid.
202
203- **slerp:** 0002's pop.
204- **guided:** as-rigid-as-possible, with only the tip's far 10% on the slerp path.
205- **spine:** as-rigid-as-possible, with only the tip's spine guided, turning in the
206  bisecting plane.
207- **banded:** slerp, but within the tip's width of its spine each layer's turn is
208  blended toward the other layer's turn. The blend is halfway at the spine and grows as
209  4s(1 − s), so it is zero at both ends. Least squares then spreads the gap between the
210  layers over the band.
211
212| step | α | slerp | guided | spine | banded |
213|---|---|---|---|---|---|
214| fixture | 160° | 4.36% | 2.25% | 1.82%, gap 5.2e-2 | 3.08% |
215| fixture | 150° | 9.69% | 5.00% | 4.05%, gap 6.1e-2 | 6.68% |
216| neck | 160° | 8.74% | 8.74%, 1054 coll. | 0.75%, 5603 coll., gap 2.1e-2 | 2.83% |
217| neck | 150° | 18.8% | 18.8%, 2755 coll. | 1.10%, 7611 coll. | 6.13%, 97 coll. |
218| tail | 160° | 9.01% | 9.01%, 365 coll. | 2.65%, 5604 coll. | 3.28% |
219| head | 160° | 1.82% | 1.32% | 1.81%, 492 coll. | 1.71% |
220| head | 150° | 4.06% | 3.04%, 2 coll. | 4.03%, 548 coll. | 3.83% |
221
222Collisions are zero wherever none are listed. The gap is the distance between the pop's
223last sample and the pose the close starts from; for slerp and banded it is below 4e-13.
224
225- The as-rigid-as-possible paths cut strain the most, but they pass the tip's stacked
226  layers through each other. The spine-guided path also does not end where the close
227  begins (gap 0.02–0.06).
228- Banded keeps slerp's properties: exact ends, no interpenetration at 160°, the same
229  cost per frame. It cuts the neck and tail pops by a factor of 3.
230
231## 3. Sampan: turning inside out
232
233### The end state (`sampan`)
234
235The scripted end turns all eight hinges from −180° to 90° and keeps every other crease.
236It does not close: the gap is 1.265 on a sheet of side 4. With the hinges held at 90°
237and the other 100 tree creases free, the least gap is 0.028. **The scripted end is not
238a rigid state.**
239
240The reason is that **B's four corners are 0001's reverse vertex.** At (1.5, 2.25):
241
242- the straight pair is the slanted line: the slanted hinge and its continuation;
243- the mirror pair is the long hinge and the step-13 crease beyond the corner;
244- the sectors are 26.57°, 26.57°, 153.43° and 153.43°.
245
246On the reverse branch, tan(ρ_slanted/2) = cos 26.57° · tan(ρ_long/2). So a long wall at
24790° puts the slanted wall at **83.6°**, not 90°.
248
249**Rigid states with every wall up exist.** With long hinges at 90° and slanted hinges at
25083.6°, the gap is 6.4e-15. The same holds for 153°/150°, 125°/120° and 106°/100°: this
251is a one-parameter family.
252
253### The path (`sampanpath`)
254
255- A continuation from frame 13 reaches that end with gap ≤ 3.8e-9 throughout. The long
256  hinges go −180° → 0° → 90°, the slanted hinges follow the corner relation, and the
257  rest are solved. At 0°, 50 creases are flat.
258- 56 of the 111 tree creases move by more than 1°.
259- The path interpenetrates from the first samples: 85,626 triangle pairs over 90
260  samples, 354 face pairs, the first at −177°. 60 creases pass beyond ±180°, that is,
261  their faces turn through each other at the crease.
262- The solver's direction of departure from ±180° is free. It was not established
263  whether a collision-free rigid branch exists.
264- The end state was not checked against the real boat. It is not a clean hull: the
265  walls' layers do not stay stacked.
266
267### Bending (`sampanbend`)
268
269Each face hangs from its nearest hinge (breadth first from the hinges). The walls swing
270outward from −180° through 0° to 90°/83.6°.
271
272| | worst strain (principal) | collisions per sample |
273|---|---|---|
274| walls as rigid stacks, misfit spread by least squares | 69.5% (96.3%) | 520–3100 |
275| then relaxed by as-rigid-as-possible, B and the hinge faces held | 14.4% (16.3%) | 880–2740 |
276
277Relaxed, the strain is moderate. But the wall layers cross each other throughout, as in
278the crane's B variant, and the relaxed end is a shallow dish, not a boat. **Bending does
279not make the sampan's inversion work.** Making it work would need two things:
280
281- bending that keeps each wall's layers together as one sheet, which nothing here
282  provides;
283- a defined target shape for the finished boat. None was found: the published
284  instructions do not describe it, and the photo shows bent "tent" ends.
285
286## 4. The bound
287
288On every case that works, the openings and closings are rigid. Only the pop bends, so
2890002's bound still means what it meant. Measured pop strain on the Delaunay mesh:
290
291| | 170° | 160° | 150° |
292|---|---|---|---|
293| fixture, slerp | 1.10% | 4.36% | 9.69% |
294| neck, slerp | 2.25% | 8.74% | 18.8% |
295| neck, banded | 0.72% | 2.83% | 6.13% (97 coll.) |
296| tail, banded | 0.85% | 3.28% | 6.94% (100 coll.) |
297| head, banded | 0.43% | 1.71% | 3.83% |
298
299**10% stays the right bound, on edge strain on the Delaunay mesh.** The default opening
300should move from 30° to 20° from flat (α = 160°). At 30°, the fixture's pop is at the
301bound on the new mesh (9.69%, principal 10.9%), and the neck and tail fail with slerp
302(18.8%, 19.2%).
303
304The bent openings that were measured (A, B, and the sampan's walls) would need 13–200%
305and still interpenetrate. No strain bound makes them acceptable, so none is proposed for
306them.
307
308## Recommendation
309
3101. **Render mesh: Delaunay** (§1). It replaces the grid in `RenderMesh` and keeps the
311   same public API.
3122. **Crane reverse folds: open, pop, close, with a rigid opening of the whole near
313   side.** This is decision 0002's model with two changes:
314   - **Bend lines.** The crease pattern carries, on the spine's line, edges through the
315     near faces that cross it (on the crane: the front wing's centre and the layer under
316     it). These edges are F in every frame and are never creased
317     (`edges_krz:firstCreasedAtStep` null). The opening side is everything on the near
318     face's side once every edge on the line is cut. That is the spine-side patch from
319     the crane report, which bend lines make sufficient for the neck and the tail.
320   - **Nested openings.** A reverse fold of a flap that is itself the tip of an earlier
321     reverse fold (the head) opens by turning the outer opening again (the body's near
322     side), with the earlier fold's creases solved on its reversed branch. Its open phase
323     is a rigid M2 motion, like any coupled step.
3243. **Pop: banded slerp** (§2), at a default opening of 20° from flat. Plain slerp also
325   passes the crane at 20° (8.74%, 9.01%), with little margin.
3264. **Bound: 10% edge strain on the Delaunay mesh, unchanged.**
3275. **Sampan: not solved by bending.** The options are under *Decisions for the author*.
328
329## Cost
330
331- **Mesh.** About 200 lines in `RenderMesh` (division of creases, lattice,
332  triangulation, flips). The crane mesh has 1,120 vertices and 2,110 triangles, fewer
333  than the grid's 1,620 vertices and 3,108 triangles.
334- **Bend lines.** Edges in the crease pattern; no format change. `compilePop` takes the
335  spine-side patch, and the open phase is checked with `meshInterpenetrations` as well
336  as `layerMotionDefects`.
337- **Nested openings.** `compilePop`'s open axes become a tree with solved curves, built
338  by the loop solver that rigid steps already use.
339- **Banded pop.** `Bending` gains per-triangle rotation targets. The band is computed
340  from the open pose, the popped pose and the tip's spine in frame n − 1, so
341  `PopRecord` is unchanged. The per-frame cost stays one sparse solve.
342
343## What the crane batch must build
344
345- **`RenderMesh`**, Delaunay construction:
346  - each crease divided into round(length / spacing) equal parts;
347  - per face, a triangular lattice (rows `spacing·√3/2` apart, offset by half a spacing
348    on alternate rows), keeping points at least `0.6·spacing` from the face's sides;
349  - ear clipping on the boundary, skipping any ear with another boundary point on it;
350  - point insertion, splitting an edge when the point lies on it;
351  - Lawson flips on every edge that is not a boundary edge.
352
353  The anchors are as now. Test: no edge shorter than 0.15·spacing except where a crease
354  is shorter or creases meet at a sharp angle, and the fixture's pop at 20° from flat
355  under 10%.
356- **`ScriptStep`**:
357  - `openAngle` defaults to 20.
358  - `openOn: CreaseRef?` names the crease whose opening opens the flap when that differs
359    from `spine` (the head: the body's spine).
360- **`compilePop`**:
361  - The opening side is computed by cutting the spine's whole line, keeping on-line edges
362    whose faces fall on different sides (the crane report's patch).
363  - With `openOn`, the open axes are the tree that the loop solver closes, driven by
364    `openOn` from its angle to ±α; the close is the same in reverse after the pop.
365  - Mesh interpenetration is checked in all three phases.
366- **`Bending`**: per-triangle turn targets. A tip triangle lies at distance d from the
367  tip's spine (in frame n − 1); b is one width for the whole tip, the largest such d of a
368  tip triangle, as the spike computed it. A triangle with d / b < 1 has target
369  slerp(mid, own, w), where:
370  - mid = slerp(own, other, ½);
371  - w = d / b + (1 − d / b)·(1 − 4s(1 − s)).
372
373  Triangles with d / b ≥ 1 are not blended and keep their own turn.
374- **Crane pattern:** bend lines on the spine's line through the front wing's centre and
375  the layer under it, added with the neck and tail creases.
376- **Tests** (Task 15):
377  - each reverse fold's open and close are isometric;
378  - the pop is under 10%;
379  - no mesh interpenetration in any phase;
380  - the tip lies between the layers at 97% of the close.
381
382  These are the checks the spike ran.
383
384## Not measured
385
386- The crane after the head (the wings down), and the staged neck's tail and head.
387- The banded pop on the fixture's interpenetration at 150° and below, beyond the counts
388  above.
389- Whether a collision-free rigid branch of the sampan's inversion exists. The departure
390  of each ±180° crease would need to follow its layer order.
391- The finished long-form sampan's real shape.
392
393## Decisions for the author
394
3951. **Bending the opening, as decided, does not work.** Holding the body costs 44–200%
396   strain. Bending the near side layer by layer passes the layers through each other.
397   Use the rigid opening on a bend line instead, which opens the front wing's half along
398   its centre during the step? Recommended.
3992. **The neck crease:** the staged one (neck pointing down and out) or the raised one
400   (the traditional crane's)? Recommended: raised.
4013. **The pop:** banded slerp, or 0002's slerp, both at 20° from flat?
4024. **The sampan:**
403   - (a) keep the short form, whose inversion is rigid;
404   - (b) ship the long form to step 13 with a rigid partial step;
405   - (c) a further spike on stack-coherent bending with a target shape taken from the real
406     model.
407
408   Recommended: (a).
409
410## Decision
411
412Made 2026-10-22 by the author:
413
4141. The crane's reverse folds open rigidly: the whole near side turns about the spine's line,
415   with bend lines (edges on that line through the faces that cross it, `F` in every frame,
416   never creased). During the step the front wing's half folds along its centre by up to
417   160° and flattens again. The head opens nested, on the body's spine (`openOn`).
4182. The neck crease is the raised one, 22.5° from the spine.
4193. The pop is the banded slerp, and the default opening is 20° from flat.
4204. The sampan ships in its short form, which turns inside out rigidly on two hinges and
421   ends as an open tray. The long form with covered ends has no rigid end state as
422   scripted, its rigid walls-up path interpenetrates, and bending it does not give a
423   boat; it is a known gap.
424
425The bound stays at 10% largest edge strain, measured on the Delaunay render mesh.
426