Commit b3177eb0fc

b3177eb0fc52a366f69da6f30d175e1294384199

parent: e9ce227c74

Verified · cmc

cmc <hello@cleberg.net> · 2026-10-22 16:44 UTC

Collinear edges of one crease no longer put its axis on a cycle

A loop crease on the line of every axis on its path closes for any angles,
so it leaves those axes linear on their own windows. foldc rejects an axis
whose angle leaves the range between its start and its end or peak. The
box's edge fold-and-unfolds go back to two axes each.

Ref #7

Layout: unified · split

Models/box.foldscript +10 −26
@@ -32,33 +32,17 @@
3232 },
3333 {
3434 "kind": "foldAndUnfold",
35 "instruction": "Valley fold the top edge to the centre line, and unfold.",
36 "creases": [[[2, 2.5], [2.5, 2.5]]],
37 "movingSide": [[2.25, 2.75]],
38 "peakAngles": [180]
39 },
40 {
41 "kind": "foldAndUnfold",
42 "instruction": "Valley fold the bottom edge to the centre line, and unfold.",
43 "creases": [[[1.5, 1.5], [2, 1.5]]],
44 "movingSide": [[1.75, 1.25]],
45 "peakAngles": [180],
46 "repeatOf": 5
47 },
48 {
49 "kind": "foldAndUnfold",
50 "instruction": "Valley fold the left edge to the centre line, and unfold.",
51 "creases": [[[1.5, 2], [1.5, 2.5]]],
52 "movingSide": [[1.25, 2.25]],
53 "peakAngles": [180]
35 "instruction": "Valley fold the top and bottom edges to the centre line, and unfold.",
36 "creases": [[[2, 2.5], [2.5, 2.5]], [[1.5, 1.5], [2, 1.5]]],
37 "movingSide": [[2.25, 2.75], [1.75, 1.25]],
38 "peakAngles": [180, 180]
5439 },
5540 {
5641 "kind": "foldAndUnfold",
57 "instruction": "Valley fold the right edge to the centre line, and unfold.",
58 "creases": [[[2.5, 1.5], [2.5, 2]]],
59 "movingSide": [[2.75, 1.75]],
60 "peakAngles": [180],
61 "repeatOf": 7
42 "instruction": "Valley fold the left and right edges to the centre line, and unfold.",
43 "creases": [[[1.5, 2], [1.5, 2.5]], [[2.5, 1.5], [2.5, 2]]],
44 "movingSide": [[1.25, 2.25], [2.75, 1.75]],
45 "peakAngles": [180, 180]
6246 },
6347 {
6448 "kind": "fold",
@@ -101,7 +85,7 @@
10185 ],
10286 "movingSide": [[1.1, 1.4], [2, 1.25], [1.4, 1.1], [2.9, 1.4], [2.6, 1.1]],
10387 "angles": [90, 90, -180, 180, 90, -180, 180],
104 "repeatOf": 11,
88 "repeatOf": 9,
10589 "viewpoint": {"eye": [1, 2, 2], "up": [0, -1, 0]}
10690 },
10791 {
@@ -110,7 +94,7 @@
11094 "creases": [[[1.5, 1], [2, 1]], [[1.5, 0.5], [2, 0.5]]],
11195 "movingSide": [[1.9, 0.75], [1.9, 0.25]],
11296 "angles": [180, -90],
113 "repeatOf": 12
97 "repeatOf": 10
11498 }
11599 ]
116100}
Packages/FoldKit/Sources/FoldCompiler/FrameCompiler.swift +34 −2
@@ -40,6 +40,9 @@ public enum CompileError: Error, Equatable, Sendable {
4040 /// An edge on a named crease's line, in another layer, becomes an axis of its own while the
4141 /// named crease's scripted angle is not ±180; its angle is not derived.
4242 case coincidentAxisAngle(step: Int, edge: Int)
43 /// An axis's angle leaves the range between its start angle and its end angle, or its peak
44 /// angle for a fold-and-unfold.
45 case angleOutsideTravel(step: Int, edge: Int)
4346}
4447
4548/// Samples in a solved curve, evenly spaced over its window.
@@ -155,6 +158,7 @@ private func appendStep(_ n: Int, _ script: ScriptStep, viewpoint: Viewpoint, to
155158 if file.edgesFirstCreasedAtStep[e] == nil { file.edgesFirstCreasedAtStep[e] = n }
156159 }
157160 }
161 try checkTravel(n, step)
158162 let guess = guessFaceOrders(previous: previous, next: frame, step: record, file: file)
159163 frame.faceOrders = try naming(n) {
160164 try applyOrderOverrides(script.faceOrders ?? [], to: guess, frame: frame, viewpoint: viewpoint, file: file)
@@ -470,7 +474,9 @@ func solveLoops(_ n: Int, _ record: StepRecord, _ step: FoldStep, loops: [Int],
470474}
471475
472476/// The indices in `step.axes` of the axes on some loop's cycle: the tree path between the two
473/// faces of a loop crease.
477/// faces of a loop crease. A loop crease that lies on the line of every axis on its path, such as
478/// a collinear edge of one crease, is turned about its own line and closes for any angles, so it
479/// puts no axis on a cycle.
474480func axesOnCycles(_ step: FoldStep, loops: [Int], _ file: FoldFile) -> Set<Int> {
475481 var axisOfFace: [Int: Int] = [:]
476482 for (a, axis) in step.axes.enumerated() {
@@ -482,8 +488,34 @@ func axesOnCycles(_ step: FoldStep, loops: [Int], _ file: FoldFile) -> Set<Int>
482488 return result
483489 }
484490 let edgeFaces = edgesFaces(file)
491 let start = file.frames[step.index - 1].verticesCoords
492 let tolerance = sheetExtent(file) * relativeTolerance
485493 return loops.reduce(into: Set<Int>()) { cycle, e in
486 cycle.formUnion(carriers(edgeFaces[e][0]).symmetricDifference(carriers(edgeFaces[e][1])))
494 let path = carriers(edgeFaces[e][0]).symmetricDifference(carriers(edgeFaces[e][1]))
495 let coaxial = path.allSatisfy { a in
496 file.edgesVertices[e].allSatisfy {
497 onLine(start[$0], step.axes[a].origin, step.axes[a].origin + step.axes[a].direction, tolerance)
498 }
499 }
500 if !coaxial { cycle.formUnion(path) }
501 }
502}
503
504/// Checks every axis's angle stays between its start angle and its end angle, or its peak angle
505/// for a fold-and-unfold, to within 1e-6°, at four times the curve sample density over its
506/// window. A non-rigid step is checked on its pop's open and close axes, which are what move it.
507func checkTravel(_ n: Int, _ step: FoldStep) throws {
508 let moving = step.pop.map { ($0.openAxes + $0.closeAxes, StepKind.fold) } ?? (step.axes, step.kind)
509 let intervals = 4 * (curveSamples - 1)
510 for axis in moving.0 {
511 let far = moving.1 == .foldAndUnfold ? axis.peakAngle ?? axis.endAngle : axis.endAngle
512 let (low, high) = (min(axis.startAngle, far) - angleSnapTolerance, max(axis.startAngle, far) + angleSnapTolerance)
513 let w = axis.window
514 for k in 0...intervals {
515 let angle = axis.angle(at: w.lowerBound + Double(k) / Double(intervals) * (w.upperBound - w.lowerBound),
516 kind: moving.1)
517 if angle < low || angle > high { throw CompileError.angleOutsideTravel(step: n, edge: axis.edge) }
518 }
487519 }
488520}
489521
Packages/FoldKit/Sources/Models/Resources/box.fold +331 −1627
@@ -189,70 +189,70 @@
189189 null,
190190 null,
191191 2,
192 5,
192193 6,
193 7,
194 6,
194 5,
195195 2,
196 8,
196 6,
197197 3,
198198 4,
199 13,
199 11,
200200 3,
201 7,
201 6,
202202 3,
203203 2,
204204 3,
205 8,
206 13,
207 4,
208 6,
209 7,
210205 6,
206 11,
211207 4,
208 5,
212209 6,
213 7,
210 5,
211 4,
212 5,
214213 6,
214 5,
215215 2,
216 5,
216217 6,
217 8,
218 6,
218 5,
219219 4,
220 8,
220 6,
221221 1,
222222 1,
223 7,
223 6,
224224 1,
225225 4,
226226 1,
227 7,
227 6,
228228 1,
229229 2,
230230 1,
231 8,
231 6,
232232 1,
233233 4,
234234 1,
235 8,
235 6,
236236 5,
237237 5,
238238 4,
239239 5,
240 11,
241 7,
240 9,
241 6,
242242 5,
243243 2,
244244 5,
245 8,
246 11,
245 6,
246 9,
247247 5,
248248 4,
249249 3,
250250 3,
251 7,
251 6,
252252 3,
253253 2,
254254 3,
255 8,
255 6,
256256 5,
257257 5,
258258 2
@@ -3281,11 +3281,31 @@
32813281 "frame_inherit" : true,
32823282 "frame_parent" : 0,
32833283 "krz:faceOrders_midFold" : [
3284 [
3285 0,
3286 3,
3287 -1
3288 ],
3289 [
3290 0,
3291 9,
3292 1
3293 ],
32843294 [
32853295 0,
32863296 17,
32873297 1
32883298 ],
3299 [
3300 1,
3301 4,
3302 -1
3303 ],
3304 [
3305 1,
3306 10,
3307 1
3308 ],
32893309 [
32903310 1,
32913311 18,
@@ -3296,31 +3316,151 @@
32963316 8,
32973317 1
32983318 ],
3319 [
3320 2,
3321 15,
3322 -1
3323 ],
3324 [
3325 2,
3326 16,
3327 1
3328 ],
32993329 [
33003330 3,
33013331 9,
33023332 1
33033333 ],
3334 [
3335 3,
3336 14,
3337 -1
3338 ],
3339 [
3340 3,
3341 17,
3342 1
3343 ],
33043344 [
33053345 4,
33063346 10,
33073347 1
33083348 ],
3349 [
3350 4,
3351 18,
3352 1
3353 ],
3354 [
3355 4,
3356 21,
3357 -1
3358 ],
33093359 [
33103360 5,
33113361 11,
33123362 1
33133363 ],
3364 [
3365 5,
3366 19,
3367 1
3368 ],
3369 [
3370 5,
3371 20,
3372 -1
3373 ],
3374 [
3375 6,
3376 7,
3377 1
3378 ],
3379 [
3380 6,
3381 15,
3382 -1
3383 ],
33143384 [
33153385 6,
3386 16,
3387 1
3388 ],
3389 [
3390 7,
3391 15,
3392 -1
3393 ],
3394 [
33163395 7,
3396 16,
3397 1
3398 ],
3399 [
3400 8,
3401 15,
3402 -1
3403 ],
3404 [
3405 8,
3406 16,
3407 1
3408 ],
3409 [
3410 9,
3411 14,
3412 -1
3413 ],
3414 [
3415 9,
3416 17,
3417 1
3418 ],
3419 [
3420 10,
3421 18,
3422 1
3423 ],
3424 [
3425 10,
3426 21,
3427 -1
3428 ],
3429 [
3430 11,
3431 19,
3432 1
3433 ],
3434 [
3435 11,
3436 20,
3437 -1
3438 ],
3439 [
3440 12,
3441 13,
3442 1
3443 ],
3444 [
3445 12,
3446 19,
33173447 1
33183448 ],
33193449 [
33203450 12,
3451 20,
3452 -1
3453 ],
3454 [
33213455 13,
3456 19,
33223457 1
33233458 ],
3459 [
3460 13,
3461 20,
3462 -1
3463 ],
33243464 [
33253465 14,
33263466 17,
@@ -3563,9 +3703,29 @@
35633703 ],
35643704 "peakAngle" : 180,
35653705 "startAngle" : 0
3706 },
3707 {
3708 "edge" : 37,
3709 "endAngle" : 0,
3710 "movingFaces" : [
3711 2,
3712 3,
3713 4,
3714 5,
3715 6,
3716 7,
3717 8,
3718 9,
3719 10,
3720 11,
3721 12,
3722 13
3723 ],
3724 "peakAngle" : 180,
3725 "startAngle" : 0
35663726 }
35673727 ],
3568 "instruction" : "Valley fold the top edge to the centre line, and unfold.",
3728 "instruction" : "Valley fold the top and bottom edges to the centre line, and unfold.",
35693729 "kind" : "foldAndUnfold",
35703730 "nonRigid" : false,
35713731 "technique" : "plain",
@@ -4090,12 +4250,12 @@
40904250 "krz:faceOrders_midFold" : [
40914251 [
40924252 0,
4093 3,
4253 15,
40944254 -1
40954255 ],
40964256 [
40974257 0,
4098 9,
4258 16,
40994259 1
41004260 ],
41014261 [
@@ -4105,18 +4265,23 @@
41054265 ],
41064266 [
41074267 1,
4108 4,
4109 -1
4268 18,
4269 1
41104270 ],
41114271 [
41124272 1,
4113 10,
4273 19,
41144274 1
41154275 ],
41164276 [
41174277 1,
4118 18,
4119 1
4278 20,
4279 -1
4280 ],
4281 [
4282 2,
4283 3,
4284 -1
41204285 ],
41214286 [
41224287 2,
@@ -4125,59 +4290,64 @@
41254290 ],
41264291 [
41274292 2,
4128 15,
4293 9,
4294 1
4295 ],
4296 [
4297 3,
4298 6,
41294299 -1
41304300 ],
41314301 [
4132 2,
4133 16,
4302 3,
4303 7,
41344304 1
41354305 ],
41364306 [
41374307 3,
4138 9,
4308 8,
41394309 1
41404310 ],
41414311 [
41424312 3,
4143 14,
4313 9,
4314 1
4315 ],
4316 [
4317 4,
4318 5,
41444319 -1
41454320 ],
41464321 [
4147 3,
4148 17,
4322 4,
4323 10,
41494324 1
41504325 ],
41514326 [
41524327 4,
4153 10,
4328 11,
41544329 1
41554330 ],
41564331 [
41574332 4,
4158 18,
4333 12,
41594334 1
41604335 ],
41614336 [
41624337 4,
4163 21,
4338 13,
41644339 -1
41654340 ],
41664341 [
41674342 5,
4168 11,
4343 10,
41694344 1
41704345 ],
41714346 [
41724347 5,
4173 19,
4348 11,
41744349 1
41754350 ],
4176 [
4177 5,
4178 20,
4179 -1
4180 ],
41814351 [
41824352 6,
41834353 7,
@@ -4185,1622 +4355,67 @@
41854355 ],
41864356 [
41874357 6,
4188 15,
4189 -1
4358 9,
4359 1
41904360 ],
41914361 [
4192 6,
4193 16,
4362 7,
4363 9,
41944364 1
41954365 ],
41964366 [
4197 7,
4198 15,
4199 -1
4200 ],
4201 [
4202 7,
4203 16,
4204 1
4205 ],
4206 [
4207 8,
4208 15,
4209 -1
4210 ],
4211 [
4212 8,
4213 16,
4214 1
4215 ],
4216 [
4217 9,
4218 14,
4219 -1
4220 ],
4221 [
4222 9,
4223 17,
4224 1
4225 ],
4226 [
4227 10,
4228 18,
4229 1
4230 ],
4231 [
4232 10,
4233 21,
4234 -1
4235 ],
4236 [
4237 11,
4238 19,
4239 1
4240 ],
4241 [
4242 11,
4243 20,
4244 -1
4245 ],
4246 [
4247 12,
4248 13,
4249 1
4250 ],
4251 [
4252 12,
4253 19,
4254 1
4255 ],
4256 [
4257 12,
4258 20,
4259 -1
4260 ],
4261 [
4262 13,
4263 19,
4264 1
4265 ],
4266 [
4267 13,
4268 20,
4269 -1
4270 ],
4271 [
4272 14,
4273 17,
4274 1
4275 ],
4276 [
4277 15,
4278 16,
4279 1
4280 ],
4281 [
4282 18,
4283 21,
4284 1
4285 ],
4286 [
4287 19,
4288 20,
4289 1
4290 ],
4291 [
4292 22,
4293 25,
4294 1
4295 ],
4296 [
4297 23,
4298 24,
4299 1
4300 ],
4301 [
4302 25,
4303 42,
4304 1
4305 ],
4306 [
4307 26,
4308 29,
4309 1
4310 ],
4311 [
4312 26,
4313 43,
4314 1
4315 ],
4316 [
4317 27,
4318 28,
4319 1
4320 ],
4321 [
4322 30,
4323 32,
4324 1
4325 ],
4326 [
4327 31,
4328 38,
4329 1
4330 ],
4331 [
4332 33,
4333 39,
4334 1
4335 ],
4336 [
4337 34,
4338 40,
4339 1
4340 ],
4341 [
4342 35,
4343 37,
4344 1
4345 ],
4346 [
4347 36,
4348 41,
4349 1
4350 ]
4351 ],
4352 "krz:step" : {
4353 "axes" : [
4354 {
4355 "edge" : 37,
4356 "endAngle" : 0,
4357 "movingFaces" : [
4358 2,
4359 3,
4360 4,
4361 5,
4362 6,
4363 7,
4364 8,
4365 9,
4366 10,
4367 11,
4368 12,
4369 13
4370 ],
4371 "peakAngle" : 180,
4372 "startAngle" : 0
4373 }
4374 ],
4375 "instruction" : "Valley fold the bottom edge to the centre line, and unfold.",
4376 "kind" : "foldAndUnfold",
4377 "nonRigid" : false,
4378 "repeatOf" : 5,
4379 "technique" : "plain",
4380 "viewpoint" : {
4381 "eye" : [
4382 0,
4383 0,
4384 1
4385 ],
4386 "up" : [
4387 0,
4388 1,
4389 0
4390 ]
4391 }
4392 },
4393 "vertices_coords" : [
4394 [
4395 2,
4396 2,
4397 1.2246467991473532e-16
4398 ],
4399 [
4400 1.5,
4401 1.5,
4402 6.123233995736766e-17
4403 ],
4404 [
4405 2,
4406 1.5,
4407 6.123233995736766e-17
4408 ],
4409 [
4410 2.5,
4411 1.5,
4412 6.123233995736766e-17
4413 ],
4414 [
4415 1,
4416 1,
4417 0
4418 ],
4419 [
4420 1.5,
4421 1,
4422 0
4423 ],
4424 [
4425 2,
4426 1,
4427 0
4428 ],
4429 [
4430 2.5,
4431 1,
4432 0
4433 ],
4434 [
4435 3,
4436 1,
4437 0
4438 ],
4439 [
4440 1.5,
4441 1.5,
4442 6.123233995736766e-17
4443 ],
4444 [
4445 1,
4446 1.5,
4447 0
4448 ],
4449 [
4450 1.5,
4451 1.5,
4452 0
4453 ],
4454 [
4455 2,
4456 1.5,
4457 0
4458 ],
4459 [
4460 2.5,
4461 1.5,
4462 0
4463 ],
4464 [
4465 3,
4466 1.5,
4467 0
4468 ],
4469 [
4470 2.5,
4471 1.5,
4472 6.123233995736767e-17
4473 ],
4474 [
4475 2,
4476 2,
4477 1.2246467991473532e-16
4478 ],
4479 [
4480 1.5,
4481 2,
4482 6.123233995736766e-17
4483 ],
4484 [
4485 1,
4486 2,
4487 0
4488 ],
4489 [
4490 1.5,
4491 2,
4492 0
4493 ],
4494 [
4495 2,
4496 2,
4497 0
4498 ],
4499 [
4500 2.5,
4501 2,
4502 0
4503 ],
4504 [
4505 3,
4506 2,
4507 0
4508 ],
4509 [
4510 2.5,
4511 2,
4512 6.123233995736767e-17
4513 ],
4514 [
4515 2,
4516 2,
4517 1.2246467991473535e-16
4518 ],
4519 [
4520 1.5,
4521 2.5,
4522 6.123233995736766e-17
4523 ],
4524 [
4525 1,
4526 2.5,
4527 0
4528 ],
4529 [
4530 1.5,
4531 2.5,
4532 0
4533 ],
4534 [
4535 2,
4536 2.5,
4537 0
4538 ],
4539 [
4540 2.5,
4541 2.5,
4542 0
4543 ],
4544 [
4545 3,
4546 2.5,
4547 0
4548 ],
4549 [
4550 2.5,
4551 2.5,
4552 6.123233995736767e-17
4553 ],
4554 [
4555 1,
4556 3,
4557 0
4558 ],
4559 [
4560 1.5,
4561 3,
4562 0
4563 ],
4564 [
4565 2,
4566 3,
4567 0
4568 ],
4569 [
4570 2.5,
4571 3,
4572 0
4573 ],
4574 [
4575 3,
4576 3,
4577 0
4578 ],
4579 [
4580 1.5,
4581 2.5,
4582 6.123233995736767e-17
4583 ],
4584 [
4585 2,
4586 2.5,
4587 6.123233995736767e-17
4588 ],
4589 [
4590 2.5,
4591 2.5,
4592 6.123233995736767e-17
4593 ],
4594 [
4595 2,
4596 2,
4597 1.2246467991473535e-16
4598 ]
4599 ]
4600 },
4601 {
4602 "edges_assignment" : [
4603 "B",
4604 "B",
4605 "B",
4606 "B",
4607 "B",
4608 "B",
4609 "B",
4610 "B",
4611 "B",
4612 "B",
4613 "B",
4614 "B",
4615 "B",
4616 "B",
4617 "B",
4618 "B",
4619 "F",
4620 "F",
4621 "F",
4622 "F",
4623 "F",
4624 "F",
4625 "V",
4626 "V",
4627 "F",
4628 "V",
4629 "F",
4630 "V",
4631 "F",
4632 "V",
4633 "F",
4634 "F",
4635 "V",
4636 "F",
4637 "F",
4638 "F",
4639 "V",
4640 "F",
4641 "F",
4642 "F",
4643 "F",
4644 "F",
4645 "F",
4646 "F",
4647 "V",
4648 "F",
4649 "F",
4650 "F",
4651 "F",
4652 "F",
4653 "V",
4654 "F",
4655 "F",
4656 "F",
4657 "F",
4658 "F",
4659 "F",
4660 "F",
4661 "V",
4662 "F",
4663 "F",
4664 "F",
4665 "F",
4666 "V",
4667 "F",
4668 "F",
4669 "F",
4670 "F",
4671 "F",
4672 "F",
4673 "F",
4674 "F",
4675 "F",
4676 "V",
4677 "V",
4678 "V",
4679 "F",
4680 "V",
4681 "F",
4682 "V",
4683 "F",
4684 "F",
4685 "F",
4686 "F"
4687 ],
4688 "edges_foldAngle" : [
4689 0,
4690 0,
4691 0,
4692 0,
4693 0,
4694 0,
4695 0,
4696 0,
4697 0,
4698 0,
4699 0,
4700 0,
4701 0,
4702 0,
4703 0,
4704 0,
4705 0,
4706 0,
4707 0,
4708 0,
4709 0,
4710 0,
4711 180,
4712 180,
4713 0,
4714 180,
4715 0,
4716 180,
4717 0,
4718 180,
4719 0,
4720 0,
4721 180,
4722 0,
4723 0,
4724 0,
4725 180,
4726 0,
4727 0,
4728 0,
4729 0,
4730 0,
4731 0,
4732 0,
4733 180,
4734 0,
4735 0,
4736 0,
4737 0,
4738 0,
4739 180,
4740 0,
4741 0,
4742 0,
4743 0,
4744 0,
4745 0,
4746 0,
4747 180,
4748 0,
4749 0,
4750 0,
4751 0,
4752 180,
4753 0,
4754 0,
4755 0,
4756 0,
4757 0,
4758 0,
4759 0,
4760 0,
4761 0,
4762 180,
4763 180,
4764 180,
4765 0,
4766 180,
4767 0,
4768 180,
4769 0,
4770 0,
4771 0,
4772 0
4773 ],
4774 "faceOrders" : [
4775 [
4776 0,
4777 17,
4778 1
4779 ],
4780 [
4781 1,
4782 18,
4783 1
4784 ],
4785 [
4786 2,
4787 8,
4788 1
4789 ],
4790 [
4791 3,
4792 9,
4793 1
4794 ],
4795 [
4796 4,
4797 10,
4798 1
4799 ],
4800 [
4801 5,
4802 11,
4803 1
4804 ],
4805 [
4806 6,
4807 7,
4808 1
4809 ],
4810 [
4811 12,
4812 13,
4813 1
4814 ],
4815 [
4816 14,
4817 17,
4818 1
4819 ],
4820 [
4821 15,
4822 16,
4823 1
4824 ],
4825 [
4826 18,
4827 21,
4828 1
4829 ],
4830 [
4831 19,
4832 20,
4833 1
4834 ],
4835 [
4836 22,
4837 25,
4838 1
4839 ],
4840 [
4841 23,
4842 24,
4843 1
4844 ],
4845 [
4846 25,
4847 42,
4848 1
4849 ],
4850 [
4851 26,
4852 29,
4853 1
4854 ],
4855 [
4856 26,
4857 43,
4858 1
4859 ],
4860 [
4861 27,
4862 28,
4863 1
4864 ],
4865 [
4866 30,
4867 32,
4868 1
4869 ],
4870 [
4871 31,
4872 38,
4873 1
4874 ],
4875 [
4876 33,
4877 39,
4878 1
4879 ],
4880 [
4881 34,
4882 40,
4883 1
4884 ],
4885 [
4886 35,
4887 37,
4888 1
4889 ],
4890 [
4891 36,
4892 41,
4893 1
4894 ]
4895 ],
4896 "frame_inherit" : true,
4897 "frame_parent" : 0,
4898 "krz:faceOrders_midFold" : [
4899 [
4900 0,
4901 15,
4902 -1
4903 ],
4904 [
4905 0,
4906 16,
4907 1
4908 ],
4909 [
4910 0,
4911 17,
4912 1
4913 ],
4914 [
4915 1,
4916 18,
4917 1
4918 ],
4919 [
4920 2,
4921 3,
4922 -1
4923 ],
4924 [
4925 2,
4926 8,
4927 1
4928 ],
4929 [
4930 2,
4931 9,
4932 1
4933 ],
4934 [
4935 3,
4936 6,
4937 -1
4938 ],
4939 [
4940 3,
4941 7,
4942 1
4943 ],
4944 [
4945 3,
4946 8,
4947 1
4948 ],
4949 [
4950 3,
4951 9,
4952 1
4953 ],
4954 [
4955 4,
4956 10,
4957 1
4958 ],
4959 [
4960 5,
4961 11,
4962 1
4963 ],
4964 [
4965 6,
4966 7,
4967 1
4968 ],
4969 [
4970 6,
4971 9,
4972 1
4973 ],
4974 [
4975 7,
4976 9,
4977 1
4978 ],
4979 [
4980 8,
4981 9,
4982 1
4983 ],
4984 [
4985 12,
4986 13,
4987 1
4988 ],
4989 [
4990 14,
4991 15,
4992 -1
4993 ],
4994 [
4995 14,
4996 16,
4997 1
4998 ],
4999 [
5000 14,
5001 17,
5002 1
5003 ],
5004 [
5005 15,
5006 16,
5007 1
5008 ],
5009 [
5010 15,
5011 17,
5012 1
5013 ],
5014 [
5015 16,
5016 17,
5017 1
5018 ],
5019 [
5020 18,
5021 21,
5022 1
5023 ],
5024 [
5025 19,
5026 20,
5027 1
5028 ],
5029 [
5030 22,
5031 23,
5032 -1
5033 ],
5034 [
5035 22,
5036 24,
5037 1
5038 ],
5039 [
5040 22,
5041 25,
5042 1
5043 ],
5044 [
5045 23,
5046 24,
5047 1
5048 ],
5049 [
5050 23,
5051 25,
5052 1
5053 ],
5054 [
5055 23,
5056 42,
5057 -1
5058 ],
5059 [
5060 24,
5061 25,
5062 1
5063 ],
5064 [
5065 24,
5066 42,
5067 -1
5068 ],
5069 [
5070 25,
5071 42,
5072 1
5073 ],
5074 [
5075 26,
5076 29,
5077 1
5078 ],
5079 [
5080 26,
5081 43,
5082 1
5083 ],
5084 [
5085 27,
5086 28,
5087 1
5088 ],
5089 [
5090 30,
5091 32,
5092 1
5093 ],
5094 [
5095 30,
5096 33,
5097 1
5098 ],
5099 [
5100 30,
5101 39,
5102 -1
5103 ],
5104 [
5105 31,
5106 33,
5107 1
5108 ],
5109 [
5110 31,
5111 38,
5112 1
5113 ],
5114 [
5115 31,
5116 39,
5117 -1
5118 ],
5119 [
5120 32,
5121 33,
5122 1
5123 ],
5124 [
5125 32,
5126 39,
5127 -1
5128 ],
5129 [
5130 33,
5131 38,
5132 -1
5133 ],
5134 [
5135 33,
5136 39,
5137 1
5138 ],
5139 [
5140 34,
5141 40,
5142 1
5143 ],
5144 [
5145 35,
5146 37,
5147 1
5148 ],
5149 [
5150 36,
5151 41,
5152 1
5153 ],
5154 [
5155 38,
5156 39,
5157 -1
5158 ]
5159 ],
5160 "krz:step" : {
5161 "axes" : [
5162 {
5163 "edge" : 52,
5164 "endAngle" : 0,
5165 "movingFaces" : [
5166 2,
5167 6,
5168 7,
5169 8,
5170 15,
5171 16,
5172 23,
5173 24,
5174 30,
5175 31,
5176 32,
5177 38
5178 ],
5179 "peakAngle" : 180,
5180 "startAngle" : 0
5181 }
5182 ],
5183 "instruction" : "Valley fold the left edge to the centre line, and unfold.",
5184 "kind" : "foldAndUnfold",
5185 "nonRigid" : false,
5186 "technique" : "plain",
5187 "viewpoint" : {
5188 "eye" : [
5189 0,
5190 0,
5191 1
5192 ],
5193 "up" : [
5194 0,
5195 1,
5196 0
5197 ]
5198 }
5199 },
5200 "vertices_coords" : [
5201 [
5202 2,
5203 2,
5204 1.2246467991473532e-16
5205 ],
5206 [
5207 1.5,
5208 1.5,
5209 6.123233995736766e-17
5210 ],
5211 [
5212 2,
5213 1.5,
5214 6.123233995736766e-17
5215 ],
5216 [
5217 2.5,
5218 1.5,
5219 6.123233995736766e-17
5220 ],
5221 [
5222 1,
5223 1,
5224 0
5225 ],
5226 [
5227 1.5,
5228 1,
5229 0
5230 ],
5231 [
5232 2,
5233 1,
5234 0
5235 ],
5236 [
5237 2.5,
5238 1,
5239 0
5240 ],
5241 [
5242 3,
5243 1,
5244 0
5245 ],
5246 [
5247 1.5,
5248 1.5,
5249 6.123233995736766e-17
5250 ],
5251 [
5252 1,
5253 1.5,
5254 0
5255 ],
5256 [
5257 1.5,
5258 1.5,
5259 0
5260 ],
5261 [
5262 2,
5263 1.5,
5264 0
5265 ],
5266 [
5267 2.5,
5268 1.5,
5269 0
5270 ],
5271 [
5272 3,
5273 1.5,
5274 0
5275 ],
5276 [
5277 2.5,
5278 1.5,
5279 6.123233995736767e-17
5280 ],
5281 [
5282 2,
5283 2,
5284 1.2246467991473532e-16
5285 ],
5286 [
5287 1.5,
5288 2,
5289 6.123233995736766e-17
5290 ],
5291 [
5292 1,
5293 2,
5294 0
5295 ],
5296 [
5297 1.5,
5298 2,
5299 0
5300 ],
5301 [
5302 2,
5303 2,
5304 0
5305 ],
5306 [
5307 2.5,
5308 2,
5309 0
5310 ],
5311 [
5312 3,
5313 2,
5314 0
5315 ],
5316 [
5317 2.5,
5318 2,
5319 6.123233995736767e-17
5320 ],
5321 [
5322 2,
5323 2,
5324 1.2246467991473535e-16
5325 ],
5326 [
5327 1.5,
5328 2.5,
5329 6.123233995736766e-17
5330 ],
5331 [
5332 1,
5333 2.5,
5334 0
5335 ],
5336 [
5337 1.5,
5338 2.5,
5339 0
5340 ],
5341 [
5342 2,
5343 2.5,
5344 0
5345 ],
5346 [
5347 2.5,
5348 2.5,
5349 0
5350 ],
5351 [
5352 3,
5353 2.5,
5354 0
5355 ],
5356 [
5357 2.5,
5358 2.5,
5359 6.123233995736767e-17
5360 ],
5361 [
5362 1,
5363 3,
5364 0
5365 ],
5366 [
5367 1.5,
5368 3,
5369 0
5370 ],
5371 [
5372 2,
5373 3,
5374 0
5375 ],
5376 [
5377 2.5,
5378 3,
5379 0
5380 ],
5381 [
5382 3,
5383 3,
5384 0
5385 ],
5386 [
5387 1.5,
5388 2.5,
5389 6.123233995736767e-17
5390 ],
5391 [
5392 2,
5393 2.5,
5394 6.123233995736767e-17
5395 ],
5396 [
5397 2.5,
5398 2.5,
5399 6.123233995736767e-17
5400 ],
5401 [
5402 2,
5403 2,
5404 1.2246467991473535e-16
5405 ]
5406 ]
5407 },
5408 {
5409 "edges_assignment" : [
5410 "B",
5411 "B",
5412 "B",
5413 "B",
5414 "B",
5415 "B",
5416 "B",
5417 "B",
5418 "B",
5419 "B",
5420 "B",
5421 "B",
5422 "B",
5423 "B",
5424 "B",
5425 "B",
5426 "F",
5427 "F",
5428 "F",
5429 "F",
5430 "F",
5431 "F",
5432 "V",
5433 "V",
5434 "F",
5435 "V",
5436 "F",
5437 "V",
5438 "F",
5439 "V",
5440 "F",
5441 "F",
5442 "V",
5443 "F",
5444 "F",
5445 "F",
5446 "V",
5447 "F",
5448 "F",
5449 "F",
5450 "F",
5451 "F",
5452 "F",
5453 "F",
5454 "V",
5455 "F",
5456 "F",
5457 "F",
5458 "F",
5459 "F",
5460 "V",
5461 "F",
5462 "F",
5463 "F",
5464 "F",
5465 "F",
5466 "F",
5467 "F",
5468 "V",
5469 "F",
5470 "F",
5471 "F",
5472 "F",
5473 "V",
5474 "F",
5475 "F",
5476 "F",
5477 "F",
5478 "F",
5479 "F",
5480 "F",
5481 "F",
5482 "F",
5483 "V",
5484 "V",
5485 "V",
5486 "F",
5487 "V",
5488 "F",
5489 "V",
5490 "F",
5491 "F",
5492 "F",
5493 "F"
5494 ],
5495 "edges_foldAngle" : [
5496 0,
5497 0,
5498 0,
5499 0,
5500 0,
5501 0,
5502 0,
5503 0,
5504 0,
5505 0,
5506 0,
5507 0,
5508 0,
5509 0,
5510 0,
5511 0,
5512 0,
5513 0,
5514 0,
5515 0,
5516 0,
5517 0,
5518 180,
5519 180,
5520 0,
5521 180,
5522 0,
5523 180,
5524 0,
5525 180,
5526 0,
5527 0,
5528 180,
5529 0,
5530 0,
5531 0,
5532 180,
5533 0,
5534 0,
5535 0,
5536 0,
5537 0,
5538 0,
5539 0,
5540 180,
5541 0,
5542 0,
5543 0,
5544 0,
5545 0,
5546 180,
5547 0,
5548 0,
5549 0,
5550 0,
5551 0,
5552 0,
5553 0,
5554 180,
5555 0,
5556 0,
5557 0,
5558 0,
5559 180,
5560 0,
5561 0,
5562 0,
5563 0,
5564 0,
5565 0,
5566 0,
5567 0,
5568 0,
5569 180,
5570 180,
5571 180,
5572 0,
5573 180,
5574 0,
5575 180,
5576 0,
5577 0,
5578 0,
5579 0
5580 ],
5581 "faceOrders" : [
5582 [
5583 0,
5584 17,
5585 1
5586 ],
5587 [
5588 1,
5589 18,
5590 1
5591 ],
5592 [
5593 2,
5594 8,
5595 1
5596 ],
5597 [
5598 3,
5599 9,
5600 1
5601 ],
5602 [
5603 4,
5604 10,
5605 1
5606 ],
5607 [
5608 5,
5609 11,
5610 1
5611 ],
5612 [
5613 6,
5614 7,
5615 1
5616 ],
5617 [
5618 12,
5619 13,
5620 1
5621 ],
5622 [
5623 14,
5624 17,
5625 1
5626 ],
5627 [
5628 15,
5629 16,
5630 1
5631 ],
5632 [
5633 18,
5634 21,
5635 1
5636 ],
5637 [
5638 19,
5639 20,
5640 1
5641 ],
5642 [
5643 22,
5644 25,
5645 1
5646 ],
5647 [
5648 23,
5649 24,
5650 1
5651 ],
5652 [
5653 25,
5654 42,
5655 1
5656 ],
5657 [
5658 26,
5659 29,
5660 1
5661 ],
5662 [
5663 26,
5664 43,
5665 1
5666 ],
5667 [
5668 27,
5669 28,
5670 1
5671 ],
5672 [
5673 30,
5674 32,
5675 1
5676 ],
5677 [
5678 31,
5679 38,
5680 1
5681 ],
5682 [
5683 33,
5684 39,
5685 1
5686 ],
5687 [
5688 34,
5689 40,
5690 1
5691 ],
5692 [
5693 35,
5694 37,
5695 1
5696 ],
5697 [
5698 36,
5699 41,
5700 1
5701 ]
5702 ],
5703 "frame_inherit" : true,
5704 "frame_parent" : 0,
5705 "krz:faceOrders_midFold" : [
5706 [
5707 0,
5708 17,
5709 1
5710 ],
5711 [
5712 1,
5713 18,
5714 1
5715 ],
5716 [
5717 1,
5718 19,
5719 1
5720 ],
5721 [
5722 1,
5723 20,
5724 -1
5725 ],
5726 [
5727 2,
57284367 8,
5729 1
5730 ],
5731 [
5732 3,
57334368 9,
57344369 1
57354370 ],
57364371 [
5737 4,
5738 5,
5739 -1
5740 ],
5741 [
5742 4,
57434372 10,
5744 1
5745 ],
5746 [
5747 4,
57484373 11,
57494374 1
57504375 ],
57514376 [
5752 4,
4377 10,
57534378 12,
57544379 1
57554380 ],
57564381 [
5757 4,
4382 10,
57584383 13,
57594384 -1
57604385 ],
57614386 [
5762 5,
5763 10,
5764 1
5765 ],
5766 [
5767 5,
5768 11,
4387 12,
4388 13,
57694389 1
57704390 ],
57714391 [
5772 6,
5773 7,
5774 1
4392 14,
4393 15,
4394 -1
57754395 ],
57764396 [
5777 10,
5778 11,
4397 14,
4398 16,
57794399 1
57804400 ],
57814401 [
5782 10,
5783 12,
4402 14,
4403 17,
57844404 1
57854405 ],
57864406 [
5787 10,
5788 13,
5789 -1
5790 ],
5791 [
5792 12,
5793 13,
4407 15,
4408 16,
57944409 1
57954410 ],
57964411 [
5797 14,
4412 15,
57984413 17,
57994414 1
58004415 ],
58014416 [
5802 15,
58034417 16,
4418 17,
58044419 1
58054420 ],
58064421 [
@@ -5833,6 +4448,16 @@
58334448 21,
58344449 -1
58354450 ],
4451 [
4452 22,
4453 23,
4454 -1
4455 ],
4456 [
4457 22,
4458 24,
4459 1
4460 ],
58364461 [
58374462 22,
58384463 25,
@@ -5843,6 +4468,26 @@
58434468 24,
58444469 1
58454470 ],
4471 [
4472 23,
4473 25,
4474 1
4475 ],
4476 [
4477 23,
4478 42,
4479 -1
4480 ],
4481 [
4482 24,
4483 25,
4484 1
4485 ],
4486 [
4487 24,
4488 42,
4489 -1
4490 ],
58464491 [
58474492 25,
58484493 42,
@@ -5898,11 +4543,46 @@
58984543 32,
58994544 1
59004545 ],
4546 [
4547 30,
4548 33,
4549 1
4550 ],
4551 [
4552 30,
4553 39,
4554 -1
4555 ],
4556 [
4557 31,
4558 33,
4559 1
4560 ],
59014561 [
59024562 31,
59034563 38,
59044564 1
59054565 ],
4566 [
4567 31,
4568 39,
4569 -1
4570 ],
4571 [
4572 32,
4573 33,
4574 1
4575 ],
4576 [
4577 32,
4578 39,
4579 -1
4580 ],
4581 [
4582 33,
4583 38,
4584 -1
4585 ],
59064586 [
59074587 33,
59084588 39,
@@ -5958,6 +4638,11 @@
59584638 40,
59594639 -1
59604640 ],
4641 [
4642 38,
4643 39,
4644 -1
4645 ],
59614646 [
59624647 40,
59634648 41,
@@ -5966,6 +4651,26 @@
59664651 ],
59674652 "krz:step" : {
59684653 "axes" : [
4654 {
4655 "edge" : 52,
4656 "endAngle" : 0,
4657 "movingFaces" : [
4658 2,
4659 6,
4660 7,
4661 8,
4662 15,
4663 16,
4664 23,
4665 24,
4666 30,
4667 31,
4668 32,
4669 38
4670 ],
4671 "peakAngle" : 180,
4672 "startAngle" : 0
4673 },
59694674 {
59704675 "edge" : 42,
59714676 "endAngle" : 0,
@@ -5987,10 +4692,9 @@
59874692 "startAngle" : 0
59884693 }
59894694 ],
5990 "instruction" : "Valley fold the right edge to the centre line, and unfold.",
4695 "instruction" : "Valley fold the left and right edges to the centre line, and unfold.",
59914696 "kind" : "foldAndUnfold",
59924697 "nonRigid" : false,
5993 "repeatOf" : 7,
59944698 "technique" : "plain",
59954699 "viewpoint" : {
59964700 "eye" : [
@@ -10871,7 +9575,7 @@
108719575 "instruction" : "Raise the bottom end into a wall in the same way, pushing the corners in.",
108729576 "kind" : "fold",
108739577 "nonRigid" : false,
10874 "repeatOf" : 11,
9578 "repeatOf" : 9,
108759579 "technique" : "plain",
108769580 "viewpoint" : {
108779581 "eye" : [
@@ -11658,7 +10362,7 @@
1165810362 "instruction" : "Fold the bottom flap over the wall and down into the box.",
1165910363 "kind" : "fold",
1166010364 "nonRigid" : false,
11661 "repeatOf" : 12,
10365 "repeatOf" : 10,
1166210366 "technique" : "plain",
1166310367 "viewpoint" : {
1166410368 "eye" : [
Packages/FoldKit/Tests/FoldCompilerTests/CollinearAxisTests.swift added +62
@@ -0,0 +1,62 @@
1import Testing
2@testable import FoldCompiler
3import FoldFormat
4import Folding
5
6@Test func aSecondFoldAndUnfoldAxisWithCollinearEdgesTurnsBackAtItsPeak() throws {
7 let file = try compile(strips(.foldAndUnfold), pattern: stripsPattern())
8 let step = try readStep(1, in: file)
9 for axis in step.axes {
10 for k in 0...256 {
11 let angle = axis.angle(at: Double(k) / 256, kind: step.kind)
12 #expect(angle >= -1e-9 && angle <= 180 + 1e-9, "edge \(axis.edge) t \(Double(k) / 256)")
13 }
14 #expect(abs(axis.angle(at: 0.5, kind: step.kind) - 180) < 1e-9)
15 #expect(abs(axis.angle(at: 1, kind: step.kind)) < 1e-9)
16 }
17}
18
19@Test func anAxisWithCollinearEdgesTakesItsOwnWindow() throws {
20 let file = try compile(strips(.fold, windows: [[0, 0.5], [0.5, 1]]), pattern: stripsPattern())
21 #expect(try readStep(1, in: file).axes.map(\.window) == [0...0.5, 0.5...1])
22}
23
24@Test func anAxisAngleOutsideItsTravelIsRejected() throws {
25 // the second strip's angle carried on past its peak to a full turn
26 let file = try compile(strips(.foldAndUnfold), pattern: stripsPattern())
27 let step = try readStep(1, in: file)
28 let a = step.axes[1]
29 let runaway = FoldAxis(edge: a.edge, origin: a.origin, direction: a.direction, movingFaces: a.movingFaces,
30 startAngle: a.startAngle, endAngle: a.endAngle, peakAngle: a.peakAngle,
31 parent: a.parent, window: a.window, curve: (0...256).map { 360 * Double($0) / 256 })
32 let broken = FoldStep(index: 1, kind: step.kind, instruction: step.instruction, axes: [step.axes[0], runaway],
33 viewpoint: step.viewpoint)
34 #expect(throws: CompileError.angleOutsideTravel(step: 1, edge: a.edge)) { try checkTravel(1, broken) }
35}
36
37/// A 4 × 2 sheet with creases x = 1 and x = 3, each split by y = 1 into two collinear edges.
38private func stripsPattern() -> FoldFile {
39 let points: [SIMD3<Double>] = [[0, 0, 0], [1, 0, 0], [3, 0, 0], [4, 0, 0], [4, 1, 0], [4, 2, 0],
40 [3, 2, 0], [1, 2, 0], [0, 2, 0], [0, 1, 0], [1, 1, 0], [3, 1, 0]]
41 let edges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 0],
42 [1, 10], [10, 7], [2, 11], [11, 6], [9, 10], [10, 11], [11, 4]]
43 let assignment: [EdgeAssignment] = Array(repeating: .boundary, count: 10)
44 + [.valley, .valley, .valley, .valley, .flat, .flat, .flat]
45 return FoldFile(fileSpec: 1.2, fileTitle: "Strips", fileAuthor: "Traditional", fileClasses: ["creasePattern"],
46 edgesVertices: edges,
47 facesVertices: [[0, 1, 10, 9], [9, 10, 7, 8], [1, 2, 11, 10], [10, 11, 6, 7], [2, 3, 4, 11],
48 [11, 4, 5, 6]],
49 edgesFirstCreasedAtStep: edges.map { _ in nil },
50 frames: [FoldFrame(verticesCoords: points, edgesAssignment: assignment,
51 edgesFoldAngle: edges.map { _ in 0 }, faceOrders: [])])
52}
53
54/// One step folding both end strips in over the middle, about the lower edges of x = 1 and x = 3.
55private func strips(_ kind: StepKind, windows: [[Double]]? = nil) -> FoldScript {
56 FoldScript(creasePattern: "", title: "Strips", steps: [
57 ScriptStep(kind: kind, instruction: "Fold both ends in.", creases: [.edgeIndex(10), .edgeIndex(12)],
58 movingSide: [SIMD2(0.5, 0.5), SIMD2(3.5, 0.5)],
59 angles: kind == .fold ? [180, 180] : nil, peakAngles: kind == .foldAndUnfold ? [180, 180] : nil,
60 windows: windows),
61 ])
62}
Packages/FoldKit/Tests/ModelsTests/CatalogueTests.swift +1 −1
@@ -131,7 +131,7 @@ private func sessionCamera(_ file: FoldFile, _ step: FoldStep, aspect: Double) -
131131 // decision 0002: the end walls are rigid, coupled steps; the box is not flat at the end
132132 let box = try ModelLibrary.model(named: "box")
133133 let raising = try readSteps(box).filter { $0.axes.contains { $0.curve != nil } }
134 #expect(raising.map(\.index) == [11, 13])
134 #expect(raising.map(\.index) == [9, 11])
135135 #expect(raising.allSatisfy { !$0.nonRigid })
136136 let heights = box.frames[box.stepCount].verticesCoords.map(\.z)
137137 #expect(heights.max()! - heights.min()! > 0.4)
Packages/FoldKit/Tests/NotationTests/Snapshots/box-10.png

Binary file not shown.

Packages/FoldKit/Tests/NotationTests/Snapshots/box-11.png

Binary file not shown.

Packages/FoldKit/Tests/NotationTests/Snapshots/box-12.png

Binary file not shown.

Packages/FoldKit/Tests/NotationTests/Snapshots/box-13.png deleted

Binary file not shown.

Packages/FoldKit/Tests/NotationTests/Snapshots/box-14.png deleted

Binary file not shown.

Packages/FoldKit/Tests/NotationTests/Snapshots/box-5.png

Binary file not shown.

Packages/FoldKit/Tests/NotationTests/Snapshots/box-6.png

Binary file not shown.

Packages/FoldKit/Tests/NotationTests/Snapshots/box-7.png

Binary file not shown.

Packages/FoldKit/Tests/NotationTests/Snapshots/box-8.png

Binary file not shown.

Packages/FoldKit/Tests/NotationTests/Snapshots/box-9.png

Binary file not shown.

docs/authoring/box.md +26 −32
@@ -1,7 +1,7 @@
11# Box
22
3The traditional masu. Fourteen steps: four fold-and-unfolds, eight folds, and two
4coupled folds with solved curves (steps 11 and 13) that raise the end walls. No
3The traditional masu. Twelve steps: four fold-and-unfolds, six folds, and two
4coupled folds with solved curves (steps 9 and 11) that raise the end walls. No
55non-rigid steps. The model ends standing as a box, not flat.
66
77`Models/box-cp.fold` and `Models/box.foldscript` compile to
@@ -28,25 +28,19 @@ either end.
28282. Fold and unfold the diagonal x = 2, left corner to right.
29293. Fold the bottom and top corners to the centre (two axes).
30304. Fold the left and right corners to the centre (two axes).
315. Fold and unfold the top edge to the centre line (y′ = 2.5 through all layers).
326. The same for the bottom edge (`repeatOf` 5).
337. Fold and unfold the left edge to the centre line (x′ = 1.5).
348. The same for the right edge (`repeatOf` 7).
359. Unfold the top and bottom corners (angles 180 → 0).
3610. Raise the left and right sides to 90°.
3711. Raise the top end to 90°, the corners folding in against it (coupled).
3812. Fold the top flap over the wall and down into the box.
3913. Raise the bottom end in the same way (`repeatOf` 11).
4014. Fold the bottom flap into the box (`repeatOf` 12).
41
42Each edge's fold-and-unfold is a step of its own. A fold-and-unfold with two
43axes, where the second axis's crease has collinear edges, compiles with that
44axis running 0 → 360° instead of 0 → 180° → 0, so the second strip passes
45through the paper after its peak. Neither the interpenetration check nor the
46layer checks see it.
47
48Viewpoints: eye (0, 0, 1), up (0, 1, 0) for steps 1–9; eye (1, −2, 2), up
49(0, 1, 0) for steps 10–12; eye (1, 2, 2), up (0, −1, 0) for steps 13–14, so
315. Fold and unfold the top and bottom edges to the centre line (y′ = 2.5 and
32 1.5 through all layers; two axes).
336. Fold and unfold the left and right edges to the centre line (x′ = 1.5 and
34 2.5; two axes).
357. Unfold the top and bottom corners (angles 180 → 0).
368. Raise the left and right sides to 90°.
379. Raise the top end to 90°, the corners folding in against it (coupled).
3810. Fold the top flap over the wall and down into the box.
3911. Raise the bottom end in the same way (`repeatOf` 9).
4012. Fold the bottom flap into the box (`repeatOf` 10).
41
42Viewpoints: eye (0, 0, 1), up (0, 1, 0) for steps 1–7; eye (1, −2, 2), up
43(0, 1, 0) for steps 8–10; eye (1, 2, 2), up (0, −1, 0) for steps 11–12, so
5044that each end is raised on the far side of the box. Neither oblique eye lies in
5145the plane of any wall, so no face is seen edge-on.
5246
@@ -72,13 +66,13 @@ edges.
7266| y = 1, y = 3: segments of the end walls' top edges, x ∈ [1½, 2½] | 3 | V 180 |
7367| y = 1, y = 3: x ∈ [1, 1½] and [2½, 3] | 3 | M −180 |
7468| x = 1, x = 3 (the side blintz folds) | 4 | V 180 |
75| y = 2½, y = 1½ through the base, x ∈ [1, 3] | 5, 6 | V 90 |
76| y = 2½, y = 1½ through the side flaps | 5, 6 | M −90 |
77| y = 3½, y = ½ (the end flaps' tips) | 5, 6 | M −90 |
78| x = 1½, x = 2½, y ∈ [1½, 2½] (the side walls) | 7, 8 | V 90 |
79| x = 1½, x = 2½, the rest of the line | 7, 8 | V 180 |
80| x = ½, x = 3½ (the side flaps' tips) | 7, 8 | M −90 |
81| the corner diagonals | 11, 13 | M −180 |
69| y = 2½, y = 1½ through the base, x ∈ [1, 3] | 5 | V 90 |
70| y = 2½, y = 1½ through the side flaps | 5 | M −90 |
71| y = 3½, y = ½ (the end flaps' tips) | 5 | M −90 |
72| x = 1½, x = 2½, y ∈ [1½, 2½] (the side walls) | 6 | V 90 |
73| x = 1½, x = 2½, the rest of the line | 6 | V 180 |
74| x = ½, x = 3½ (the side flaps' tips) | 6 | M −90 |
75| the corner diagonals | 9, 11 | M −180 |
8276
8377The pattern's assignments are the last frame's; the diagonals end flat.
8478
@@ -111,10 +105,10 @@ sheet), nothing interpenetrates at 64 samples, and the validator's layer rules
111105and `layerMotionDefects` pass. Intermediate states were also drawn and checked
112106by eye. They have not been checked in the app.
113107
114Steps 12 and 14 fold the end flap 180° over the wall's top edge, with its tip
115folding −90° on the same window. The tip stays above the floor throughout. A
116staggered window for the tip is rejected (`solvedAxisWindowConflict`), because
117the tip crease's second edge counts as a loop.
108Steps 10 and 12 fold the end flap 180° over the wall's top edge, with its tip
109folding −90° on the same window. The tip stays above the floor throughout. With
110the tip on [0.5, 1] instead, it is still straight when the flap is level, and
111in step 12 the bottom flap's tip point touches the raised top wall's upper edge.
118112
119113## Layer-order overrides
120114