Commit 0ce8c8b65a
Verified · cmc
Layout: unified · split
Models/cup-cp.fold added +33
| @@ -0,0 +1,33 @@ | |||
| 1 | { | ||
| 2 | "file_spec": 1.2, | ||
| 3 | "file_title": "Cup", | ||
| 4 | "file_author": "Traditional", | ||
| 5 | "file_classes": ["creasePattern"], | ||
| 6 | "vertices_coords": [ | ||
| 7 | [1, 0], | ||
| 8 | [1.4142135623730951, 0.41421356237309515], | ||
| 9 | [2, 1], | ||
| 10 | [1.4142135623730951, 1.5857864376269049], | ||
| 11 | [1, 2], | ||
| 12 | [0.5857864376269049, 1.5857864376269049], | ||
| 13 | [0, 1], | ||
| 14 | [0.5857864376269049, 0.41421356237309515], | ||
| 15 | [0.8284271247461903, 1], | ||
| 16 | [1.1715728752538097, 1] | ||
| 17 | ], | ||
| 18 | "edges_vertices": [ | ||
| 19 | [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 0], | ||
| 20 | [6, 8], [8, 9], [9, 2], | ||
| 21 | [9, 3], [9, 1], | ||
| 22 | [8, 5], [8, 7], | ||
| 23 | [7, 1], [5, 3] | ||
| 24 | ], | ||
| 25 | "edges_assignment": [ | ||
| 26 | "B", "B", "B", "B", "B", "B", "B", "B", | ||
| 27 | "V", "V", "V", | ||
| 28 | "V", "M", | ||
| 29 | "V", "M", | ||
| 30 | "M", "M" | ||
| 31 | ], | ||
| 32 | "faces_vertices": [[7, 0, 1], [7, 1, 9, 8], [1, 2, 9], [6, 7, 8], [6, 8, 5], [8, 9, 3, 5], [9, 2, 3], [5, 3, 4]] | ||
| 33 | } | ||
Models/cup.foldscript added +41
| @@ -0,0 +1,41 @@ | |||
| 1 | { | ||
| 2 | "creasePattern": "cup-cp.fold", | ||
| 3 | "title": "Cup", | ||
| 4 | "steps": [ | ||
| 5 | { | ||
| 6 | "kind": "fold", | ||
| 7 | "instruction": "Valley fold in half along the diagonal, bottom corner up to the top corner.", | ||
| 8 | "creases": [[[0.8284271247461903, 1], [1.1715728752538097, 1]]], | ||
| 9 | "movingSide": [[1, 0.5]] | ||
| 10 | }, | ||
| 11 | { | ||
| 12 | "kind": "fold", | ||
| 13 | "instruction": "Valley fold the right corner across to touch the left edge, so that the top edge of the flap is level.", | ||
| 14 | "creases": [[[1.1715728752538097, 1], [1.4142135623730951, 1.5857864376269049]]], | ||
| 15 | "movingSide": [[1.6, 1.2]] | ||
| 16 | }, | ||
| 17 | { | ||
| 18 | "kind": "fold", | ||
| 19 | "instruction": "Valley fold the left corner across to touch the right edge, over the first flap.", | ||
| 20 | "creases": [[[0.8284271247461903, 1], [0.5857864376269049, 1.5857864376269049]]], | ||
| 21 | "movingSide": [[0.4, 1.2]] | ||
| 22 | }, | ||
| 23 | { | ||
| 24 | "kind": "fold", | ||
| 25 | "instruction": "Valley fold the front top flap down over the front.", | ||
| 26 | "creases": [[[0.5857864376269049, 0.41421356237309515], [1.4142135623730951, 0.41421356237309515]]], | ||
| 27 | "movingSide": [[1, 0.2]] | ||
| 28 | }, | ||
| 29 | { | ||
| 30 | "kind": "turnOver", | ||
| 31 | "instruction": "Turn over.", | ||
| 32 | "turnOverAxis": "vertical" | ||
| 33 | }, | ||
| 34 | { | ||
| 35 | "kind": "fold", | ||
| 36 | "instruction": "Valley fold the remaining top flap down.", | ||
| 37 | "creases": [[[0.5857864376269049, 1.5857864376269049], [1.4142135623730951, 1.5857864376269049]]], | ||
| 38 | "movingSide": [[1, 1.8]] | ||
| 39 | } | ||
| 40 | ] | ||
| 41 | } | ||
Packages/FoldKit/Package.swift +6
| @@ -8,13 +8,17 @@ let package = Package( | |||
| 8 | .library(name: "FoldFormat", targets: ["FoldFormat"]), | 8 | .library(name: "FoldFormat", targets: ["FoldFormat"]), |
| 9 | .library(name: "Folding", targets: ["Folding"]), | 9 | .library(name: "Folding", targets: ["Folding"]), |
| 10 | .library(name: "FoldCompiler", targets: ["FoldCompiler"]), | 10 | .library(name: "FoldCompiler", targets: ["FoldCompiler"]), |
| 11 | .library(name: "Models", targets: ["Models"]), | ||
| 11 | .executable(name: "foldc", targets: ["foldc"]), | 12 | .executable(name: "foldc", targets: ["foldc"]), |
| 13 | .executable(name: "foldlint", targets: ["foldlint"]), | ||
| 12 | ], | 14 | ], |
| 13 | targets: [ | 15 | targets: [ |
| 14 | .target(name: "FoldFormat"), | 16 | .target(name: "FoldFormat"), |
| 15 | .target(name: "Folding", dependencies: ["FoldFormat"]), | 17 | .target(name: "Folding", dependencies: ["FoldFormat"]), |
| 16 | .target(name: "FoldCompiler", dependencies: ["FoldFormat", "Folding"]), | 18 | .target(name: "FoldCompiler", dependencies: ["FoldFormat", "Folding"]), |
| 19 | .target(name: "Models", dependencies: ["FoldFormat"], resources: [.copy("Resources")]), | ||
| 17 | .executableTarget(name: "foldc", dependencies: ["FoldCompiler"]), | 20 | .executableTarget(name: "foldc", dependencies: ["FoldCompiler"]), |
| 21 | .executableTarget(name: "foldlint", dependencies: ["FoldFormat", "Folding"]), | ||
| 18 | .target( | 22 | .target( |
| 19 | name: "FoldKitTestSupport", | 23 | name: "FoldKitTestSupport", |
| 20 | dependencies: ["FoldFormat", "Folding", "FoldCompiler"], | 24 | dependencies: ["FoldFormat", "Folding", "FoldCompiler"], |
| @@ -24,6 +28,8 @@ let package = Package( | |||
| 24 | .testTarget(name: "FoldingTests", dependencies: ["Folding", "FoldFormat", "FoldKitTestSupport"]), | 28 | .testTarget(name: "FoldingTests", dependencies: ["Folding", "FoldFormat", "FoldKitTestSupport"]), |
| 25 | .testTarget(name: "FoldCompilerTests", | 29 | .testTarget(name: "FoldCompilerTests", |
| 26 | dependencies: ["FoldCompiler", "Folding", "FoldFormat", "FoldKitTestSupport"]), | 30 | dependencies: ["FoldCompiler", "Folding", "FoldFormat", "FoldKitTestSupport"]), |
| 31 | .testTarget(name: "ModelsTests", | ||
| 32 | dependencies: ["Models", "FoldCompiler", "Folding", "FoldFormat", "FoldKitTestSupport", "foldlint"]), | ||
| 27 | ], | 33 | ], |
| 28 | swiftLanguageModes: [.v6] | 34 | swiftLanguageModes: [.v6] |
| 29 | ) | 35 | ) |
Packages/FoldKit/Sources/FoldKitTestSupport/Helpers.swift +39
| @@ -452,3 +452,42 @@ private func replacing(_ s: ScriptStep, spine: CreaseRef?, openAngle: Double?) - | |||
| 452 | faceOrdersMidFold: s.faceOrdersMidFold, driver: s.driver, windows: s.windows, spine: spine, | 452 | faceOrdersMidFold: s.faceOrdersMidFold, driver: s.driver, windows: s.windows, spine: spine, |
| 453 | openAngle: openAngle) | 453 | openAngle: openAngle) |
| 454 | } | 454 | } |
| 455 | |||
| 456 | /// The repository's `Models/` directory, four levels above this package's `Sources/`. | ||
| 457 | private let modelsDirectory = URL(fileURLWithPath: #filePath) | ||
| 458 | .deletingLastPathComponent().deletingLastPathComponent().deletingLastPathComponent() | ||
| 459 | .deletingLastPathComponent().deletingLastPathComponent().appendingPathComponent("Models") | ||
| 460 | |||
| 461 | /// `Models/<name>.foldscript`. | ||
| 462 | public func script(_ name: String) -> URL { | ||
| 463 | modelsDirectory.appendingPathComponent("\(name).foldscript") | ||
| 464 | } | ||
| 465 | |||
| 466 | /// `Models/<name>-cp.fold`. | ||
| 467 | public func pattern(_ name: String) -> URL { | ||
| 468 | modelsDirectory.appendingPathComponent("\(name)-cp.fold") | ||
| 469 | } | ||
| 470 | |||
| 471 | #if os(macOS) | ||
| 472 | /// Runs the built `foldlint` on `url`, returning its exit status and its standard output and | ||
| 473 | /// error together. The executable is beside the test bundle, which may hold this module's | ||
| 474 | /// resource bundle, or beside the resource bundle itself. | ||
| 475 | public func runFoldlint(on url: URL) throws -> (exitCode: Int32, output: String) { | ||
| 476 | let beside = Bundle.module.bundleURL.deletingLastPathComponent() | ||
| 477 | var testBundle = beside | ||
| 478 | while testBundle.pathComponents.count > 1 && testBundle.pathExtension != "xctest" { | ||
| 479 | testBundle.deleteLastPathComponent() | ||
| 480 | } | ||
| 481 | let products = testBundle.pathExtension == "xctest" ? testBundle.deletingLastPathComponent() : beside | ||
| 482 | let process = Process() | ||
| 483 | process.executableURL = products.appendingPathComponent("foldlint") | ||
| 484 | process.arguments = [url.path] | ||
| 485 | let pipe = Pipe() | ||
| 486 | process.standardOutput = pipe | ||
| 487 | process.standardError = pipe | ||
| 488 | try process.run() | ||
| 489 | let output = pipe.fileHandleForReading.readDataToEndOfFile() | ||
| 490 | process.waitUntilExit() | ||
| 491 | return (process.terminationStatus, String(decoding: output, as: UTF8.self)) | ||
| 492 | } | ||
| 493 | #endif | ||
Packages/FoldKit/Sources/Models/ModelLibrary.swift added +34
| @@ -0,0 +1,34 @@ | |||
| 1 | import FoldFormat | ||
| 2 | import Foundation | ||
| 3 | |||
| 4 | public enum ModelLibraryError: Error, Equatable, Sendable { | ||
| 5 | case noModel(named: String) | ||
| 6 | } | ||
| 7 | |||
| 8 | /// The shipped models: `Resources/<name>.fold`, each generated by `foldc` from | ||
| 9 | /// `Models/<name>.foldscript` and `Models/<name>-cp.fold`. | ||
| 10 | public enum ModelLibrary { | ||
| 11 | /// Every model, in the order of `names()`. | ||
| 12 | public static func all() throws -> [FoldFile] { | ||
| 13 | try names().map(model(named:)) | ||
| 14 | } | ||
| 15 | |||
| 16 | /// The models' names, sorted. | ||
| 17 | public static func names() throws -> [String] { | ||
| 18 | try FileManager.default.contentsOfDirectory(at: directory, includingPropertiesForKeys: nil) | ||
| 19 | .filter { $0.pathExtension == "fold" } | ||
| 20 | .map { $0.deletingPathExtension().lastPathComponent } | ||
| 21 | .sorted() | ||
| 22 | } | ||
| 23 | |||
| 24 | public static func model(named name: String) throws -> FoldFile { | ||
| 25 | let url = directory.appendingPathComponent("\(name).fold") | ||
| 26 | guard FileManager.default.fileExists(atPath: url.path) else { throw ModelLibraryError.noModel(named: name) } | ||
| 27 | return try FoldFile(contentsOf: url) | ||
| 28 | } | ||
| 29 | |||
| 30 | /// The resource directory the package copies in. | ||
| 31 | private static var directory: URL { | ||
| 32 | Bundle.module.url(forResource: "Resources", withExtension: nil)! | ||
| 33 | } | ||
| 34 | } | ||
Packages/FoldKit/Sources/Models/Resources/cup.fold added +1469
| @@ -0,0 +1,1469 @@ | |||
| 1 | { | ||
| 2 | "edges_assignment" : [ | ||
| 3 | "B", | ||
| 4 | "B", | ||
| 5 | "B", | ||
| 6 | "B", | ||
| 7 | "B", | ||
| 8 | "B", | ||
| 9 | "B", | ||
| 10 | "B", | ||
| 11 | "F", | ||
| 12 | "F", | ||
| 13 | "F", | ||
| 14 | "F", | ||
| 15 | "F", | ||
| 16 | "F", | ||
| 17 | "F", | ||
| 18 | "F", | ||
| 19 | "F" | ||
| 20 | ], | ||
| 21 | "edges_foldAngle" : [ | ||
| 22 | 0, | ||
| 23 | 0, | ||
| 24 | 0, | ||
| 25 | 0, | ||
| 26 | 0, | ||
| 27 | 0, | ||
| 28 | 0, | ||
| 29 | 0, | ||
| 30 | 0, | ||
| 31 | 0, | ||
| 32 | 0, | ||
| 33 | 0, | ||
| 34 | 0, | ||
| 35 | 0, | ||
| 36 | 0, | ||
| 37 | 0, | ||
| 38 | 0 | ||
| 39 | ], | ||
| 40 | "edges_krz:firstCreasedAtStep" : [ | ||
| 41 | null, | ||
| 42 | null, | ||
| 43 | null, | ||
| 44 | null, | ||
| 45 | null, | ||
| 46 | null, | ||
| 47 | null, | ||
| 48 | null, | ||
| 49 | 1, | ||
| 50 | 1, | ||
| 51 | 1, | ||
| 52 | 2, | ||
| 53 | 2, | ||
| 54 | 3, | ||
| 55 | 3, | ||
| 56 | 4, | ||
| 57 | 6 | ||
| 58 | ], | ||
| 59 | "edges_vertices" : [ | ||
| 60 | [ | ||
| 61 | 0, | ||
| 62 | 1 | ||
| 63 | ], | ||
| 64 | [ | ||
| 65 | 1, | ||
| 66 | 2 | ||
| 67 | ], | ||
| 68 | [ | ||
| 69 | 2, | ||
| 70 | 3 | ||
| 71 | ], | ||
| 72 | [ | ||
| 73 | 3, | ||
| 74 | 4 | ||
| 75 | ], | ||
| 76 | [ | ||
| 77 | 4, | ||
| 78 | 5 | ||
| 79 | ], | ||
| 80 | [ | ||
| 81 | 5, | ||
| 82 | 6 | ||
| 83 | ], | ||
| 84 | [ | ||
| 85 | 6, | ||
| 86 | 7 | ||
| 87 | ], | ||
| 88 | [ | ||
| 89 | 7, | ||
| 90 | 0 | ||
| 91 | ], | ||
| 92 | [ | ||
| 93 | 6, | ||
| 94 | 8 | ||
| 95 | ], | ||
| 96 | [ | ||
| 97 | 8, | ||
| 98 | 9 | ||
| 99 | ], | ||
| 100 | [ | ||
| 101 | 9, | ||
| 102 | 2 | ||
| 103 | ], | ||
| 104 | [ | ||
| 105 | 9, | ||
| 106 | 3 | ||
| 107 | ], | ||
| 108 | [ | ||
| 109 | 9, | ||
| 110 | 1 | ||
| 111 | ], | ||
| 112 | [ | ||
| 113 | 8, | ||
| 114 | 5 | ||
| 115 | ], | ||
| 116 | [ | ||
| 117 | 8, | ||
| 118 | 7 | ||
| 119 | ], | ||
| 120 | [ | ||
| 121 | 7, | ||
| 122 | 1 | ||
| 123 | ], | ||
| 124 | [ | ||
| 125 | 5, | ||
| 126 | 3 | ||
| 127 | ] | ||
| 128 | ], | ||
| 129 | "faceOrders" : [ | ||
| 130 | |||
| 131 | ], | ||
| 132 | "faces_vertices" : [ | ||
| 133 | [ | ||
| 134 | 7, | ||
| 135 | 0, | ||
| 136 | 1 | ||
| 137 | ], | ||
| 138 | [ | ||
| 139 | 7, | ||
| 140 | 1, | ||
| 141 | 9, | ||
| 142 | 8 | ||
| 143 | ], | ||
| 144 | [ | ||
| 145 | 1, | ||
| 146 | 2, | ||
| 147 | 9 | ||
| 148 | ], | ||
| 149 | [ | ||
| 150 | 6, | ||
| 151 | 7, | ||
| 152 | 8 | ||
| 153 | ], | ||
| 154 | [ | ||
| 155 | 6, | ||
| 156 | 8, | ||
| 157 | 5 | ||
| 158 | ], | ||
| 159 | [ | ||
| 160 | 8, | ||
| 161 | 9, | ||
| 162 | 3, | ||
| 163 | 5 | ||
| 164 | ], | ||
| 165 | [ | ||
| 166 | 9, | ||
| 167 | 2, | ||
| 168 | 3 | ||
| 169 | ], | ||
| 170 | [ | ||
| 171 | 5, | ||
| 172 | 3, | ||
| 173 | 4 | ||
| 174 | ] | ||
| 175 | ], | ||
| 176 | "file_author" : "Traditional", | ||
| 177 | "file_classes" : [ | ||
| 178 | "diagrams" | ||
| 179 | ], | ||
| 180 | "file_frames" : [ | ||
| 181 | { | ||
| 182 | "edges_assignment" : [ | ||
| 183 | "B", | ||
| 184 | "B", | ||
| 185 | "B", | ||
| 186 | "B", | ||
| 187 | "B", | ||
| 188 | "B", | ||
| 189 | "B", | ||
| 190 | "B", | ||
| 191 | "V", | ||
| 192 | "V", | ||
| 193 | "V", | ||
| 194 | "F", | ||
| 195 | "F", | ||
| 196 | "F", | ||
| 197 | "F", | ||
| 198 | "F", | ||
| 199 | "F" | ||
| 200 | ], | ||
| 201 | "edges_foldAngle" : [ | ||
| 202 | 0, | ||
| 203 | 0, | ||
| 204 | 0, | ||
| 205 | 0, | ||
| 206 | 0, | ||
| 207 | 0, | ||
| 208 | 0, | ||
| 209 | 0, | ||
| 210 | 180, | ||
| 211 | 180, | ||
| 212 | 180, | ||
| 213 | 0, | ||
| 214 | 0, | ||
| 215 | 0, | ||
| 216 | 0, | ||
| 217 | 0, | ||
| 218 | 0 | ||
| 219 | ], | ||
| 220 | "faceOrders" : [ | ||
| 221 | [ | ||
| 222 | 0, | ||
| 223 | 7, | ||
| 224 | 1 | ||
| 225 | ], | ||
| 226 | [ | ||
| 227 | 1, | ||
| 228 | 5, | ||
| 229 | 1 | ||
| 230 | ], | ||
| 231 | [ | ||
| 232 | 2, | ||
| 233 | 6, | ||
| 234 | 1 | ||
| 235 | ], | ||
| 236 | [ | ||
| 237 | 3, | ||
| 238 | 4, | ||
| 239 | 1 | ||
| 240 | ] | ||
| 241 | ], | ||
| 242 | "frame_inherit" : true, | ||
| 243 | "frame_parent" : 0, | ||
| 244 | "krz:step" : { | ||
| 245 | "axes" : [ | ||
| 246 | { | ||
| 247 | "edge" : 9, | ||
| 248 | "endAngle" : 180, | ||
| 249 | "movingFaces" : [ | ||
| 250 | 0, | ||
| 251 | 1, | ||
| 252 | 2, | ||
| 253 | 3 | ||
| 254 | ], | ||
| 255 | "startAngle" : 0 | ||
| 256 | } | ||
| 257 | ], | ||
| 258 | "instruction" : "Valley fold in half along the diagonal, bottom corner up to the top corner.", | ||
| 259 | "kind" : "fold", | ||
| 260 | "nonRigid" : false, | ||
| 261 | "technique" : "plain", | ||
| 262 | "viewpoint" : { | ||
| 263 | "eye" : [ | ||
| 264 | 0, | ||
| 265 | 0, | ||
| 266 | 1 | ||
| 267 | ], | ||
| 268 | "up" : [ | ||
| 269 | 0, | ||
| 270 | 1, | ||
| 271 | 0 | ||
| 272 | ] | ||
| 273 | } | ||
| 274 | }, | ||
| 275 | "vertices_coords" : [ | ||
| 276 | [ | ||
| 277 | 1, | ||
| 278 | 2, | ||
| 279 | 1.2246467991473532e-16 | ||
| 280 | ], | ||
| 281 | [ | ||
| 282 | 1.4142135623730951, | ||
| 283 | 1.5857864376269049, | ||
| 284 | 7.173814858237197e-17 | ||
| 285 | ], | ||
| 286 | [ | ||
| 287 | 2, | ||
| 288 | 1, | ||
| 289 | 0 | ||
| 290 | ], | ||
| 291 | [ | ||
| 292 | 1.4142135623730951, | ||
| 293 | 1.5857864376269049, | ||
| 294 | 0 | ||
| 295 | ], | ||
| 296 | [ | ||
| 297 | 1, | ||
| 298 | 2, | ||
| 299 | 0 | ||
| 300 | ], | ||
| 301 | [ | ||
| 302 | 0.5857864376269049, | ||
| 303 | 1.5857864376269049, | ||
| 304 | 0 | ||
| 305 | ], | ||
| 306 | [ | ||
| 307 | 0, | ||
| 308 | 1, | ||
| 309 | 0 | ||
| 310 | ], | ||
| 311 | [ | ||
| 312 | 0.5857864376269049, | ||
| 313 | 1.5857864376269049, | ||
| 314 | 7.173814858237197e-17 | ||
| 315 | ], | ||
| 316 | [ | ||
| 317 | 0.8284271247461903, | ||
| 318 | 1, | ||
| 319 | 0 | ||
| 320 | ], | ||
| 321 | [ | ||
| 322 | 1.1715728752538097, | ||
| 323 | 1, | ||
| 324 | 0 | ||
| 325 | ] | ||
| 326 | ] | ||
| 327 | }, | ||
| 328 | { | ||
| 329 | "edges_assignment" : [ | ||
| 330 | "B", | ||
| 331 | "B", | ||
| 332 | "B", | ||
| 333 | "B", | ||
| 334 | "B", | ||
| 335 | "B", | ||
| 336 | "B", | ||
| 337 | "B", | ||
| 338 | "V", | ||
| 339 | "V", | ||
| 340 | "V", | ||
| 341 | "V", | ||
| 342 | "M", | ||
| 343 | "F", | ||
| 344 | "F", | ||
| 345 | "F", | ||
| 346 | "F" | ||
| 347 | ], | ||
| 348 | "edges_foldAngle" : [ | ||
| 349 | 0, | ||
| 350 | 0, | ||
| 351 | 0, | ||
| 352 | 0, | ||
| 353 | 0, | ||
| 354 | 0, | ||
| 355 | 0, | ||
| 356 | 0, | ||
| 357 | 180, | ||
| 358 | 180, | ||
| 359 | 180, | ||
| 360 | 180, | ||
| 361 | -180, | ||
| 362 | 0, | ||
| 363 | 0, | ||
| 364 | 0, | ||
| 365 | 0 | ||
| 366 | ], | ||
| 367 | "faceOrders" : [ | ||
| 368 | [ | ||
| 369 | 0, | ||
| 370 | 7, | ||
| 371 | 1 | ||
| 372 | ], | ||
| 373 | [ | ||
| 374 | 1, | ||
| 375 | 2, | ||
| 376 | -1 | ||
| 377 | ], | ||
| 378 | [ | ||
| 379 | 1, | ||
| 380 | 5, | ||
| 381 | 1 | ||
| 382 | ], | ||
| 383 | [ | ||
| 384 | 1, | ||
| 385 | 6, | ||
| 386 | 1 | ||
| 387 | ], | ||
| 388 | [ | ||
| 389 | 2, | ||
| 390 | 5, | ||
| 391 | 1 | ||
| 392 | ], | ||
| 393 | [ | ||
| 394 | 2, | ||
| 395 | 6, | ||
| 396 | 1 | ||
| 397 | ], | ||
| 398 | [ | ||
| 399 | 3, | ||
| 400 | 4, | ||
| 401 | 1 | ||
| 402 | ], | ||
| 403 | [ | ||
| 404 | 5, | ||
| 405 | 6, | ||
| 406 | 1 | ||
| 407 | ] | ||
| 408 | ], | ||
| 409 | "frame_inherit" : true, | ||
| 410 | "frame_parent" : 0, | ||
| 411 | "krz:step" : { | ||
| 412 | "axes" : [ | ||
| 413 | { | ||
| 414 | "edge" : 11, | ||
| 415 | "endAngle" : 180, | ||
| 416 | "movingFaces" : [ | ||
| 417 | 2, | ||
| 418 | 6 | ||
| 419 | ], | ||
| 420 | "startAngle" : 0 | ||
| 421 | } | ||
| 422 | ], | ||
| 423 | "instruction" : "Valley fold the right corner across to touch the left edge, so that the top edge of the flap is level.", | ||
| 424 | "kind" : "fold", | ||
| 425 | "nonRigid" : false, | ||
| 426 | "technique" : "plain", | ||
| 427 | "viewpoint" : { | ||
| 428 | "eye" : [ | ||
| 429 | 0, | ||
| 430 | 0, | ||
| 431 | 1 | ||
| 432 | ], | ||
| 433 | "up" : [ | ||
| 434 | 0, | ||
| 435 | 1, | ||
| 436 | 0 | ||
| 437 | ] | ||
| 438 | } | ||
| 439 | }, | ||
| 440 | "vertices_coords" : [ | ||
| 441 | [ | ||
| 442 | 1, | ||
| 443 | 2, | ||
| 444 | 1.2246467991473532e-16 | ||
| 445 | ], | ||
| 446 | [ | ||
| 447 | 1.4142135623730951, | ||
| 448 | 1.5857864376269049, | ||
| 449 | 7.173814858237197e-17 | ||
| 450 | ], | ||
| 451 | [ | ||
| 452 | 0.5857864376269052, | ||
| 453 | 1.5857864376269053, | ||
| 454 | 9.373040810652596e-17 | ||
| 455 | ], | ||
| 456 | [ | ||
| 457 | 1.4142135623730951, | ||
| 458 | 1.5857864376269049, | ||
| 459 | 0 | ||
| 460 | ], | ||
| 461 | [ | ||
| 462 | 1, | ||
| 463 | 2, | ||
| 464 | 0 | ||
| 465 | ], | ||
| 466 | [ | ||
| 467 | 0.5857864376269049, | ||
| 468 | 1.5857864376269049, | ||
| 469 | 0 | ||
| 470 | ], | ||
| 471 | [ | ||
| 472 | 0, | ||
| 473 | 1, | ||
| 474 | 0 | ||
| 475 | ], | ||
| 476 | [ | ||
| 477 | 0.5857864376269049, | ||
| 478 | 1.5857864376269049, | ||
| 479 | 7.173814858237197e-17 | ||
| 480 | ], | ||
| 481 | [ | ||
| 482 | 0.8284271247461903, | ||
| 483 | 1, | ||
| 484 | 0 | ||
| 485 | ], | ||
| 486 | [ | ||
| 487 | 1.1715728752538097, | ||
| 488 | 1, | ||
| 489 | 0 | ||
| 490 | ] | ||
| 491 | ] | ||
| 492 | }, | ||
| 493 | { | ||
| 494 | "edges_assignment" : [ | ||
| 495 | "B", | ||
| 496 | "B", | ||
| 497 | "B", | ||
| 498 | "B", | ||
| 499 | "B", | ||
| 500 | "B", | ||
| 501 | "B", | ||
| 502 | "B", | ||
| 503 | "V", | ||
| 504 | "V", | ||
| 505 | "V", | ||
| 506 | "V", | ||
| 507 | "M", | ||
| 508 | "V", | ||
| 509 | "M", | ||
| 510 | "F", | ||
| 511 | "F" | ||
| 512 | ], | ||
| 513 | "edges_foldAngle" : [ | ||
| 514 | 0, | ||
| 515 | 0, | ||
| 516 | 0, | ||
| 517 | 0, | ||
| 518 | 0, | ||
| 519 | 0, | ||
| 520 | 0, | ||
| 521 | 0, | ||
| 522 | 180, | ||
| 523 | 180, | ||
| 524 | 180, | ||
| 525 | 180, | ||
| 526 | -180, | ||
| 527 | 180, | ||
| 528 | -180, | ||
| 529 | 0, | ||
| 530 | 0 | ||
| 531 | ], | ||
| 532 | "faceOrders" : [ | ||
| 533 | [ | ||
| 534 | 0, | ||
| 535 | 7, | ||
| 536 | 1 | ||
| 537 | ], | ||
| 538 | [ | ||
| 539 | 1, | ||
| 540 | 2, | ||
| 541 | -1 | ||
| 542 | ], | ||
| 543 | [ | ||
| 544 | 1, | ||
| 545 | 3, | ||
| 546 | -1 | ||
| 547 | ], | ||
| 548 | [ | ||
| 549 | 1, | ||
| 550 | 4, | ||
| 551 | 1 | ||
| 552 | ], | ||
| 553 | [ | ||
| 554 | 1, | ||
| 555 | 5, | ||
| 556 | 1 | ||
| 557 | ], | ||
| 558 | [ | ||
| 559 | 1, | ||
| 560 | 6, | ||
| 561 | 1 | ||
| 562 | ], | ||
| 563 | [ | ||
| 564 | 2, | ||
| 565 | 3, | ||
| 566 | -1 | ||
| 567 | ], | ||
| 568 | [ | ||
| 569 | 2, | ||
| 570 | 4, | ||
| 571 | 1 | ||
| 572 | ], | ||
| 573 | [ | ||
| 574 | 2, | ||
| 575 | 5, | ||
| 576 | 1 | ||
| 577 | ], | ||
| 578 | [ | ||
| 579 | 2, | ||
| 580 | 6, | ||
| 581 | 1 | ||
| 582 | ], | ||
| 583 | [ | ||
| 584 | 3, | ||
| 585 | 4, | ||
| 586 | 1 | ||
| 587 | ], | ||
| 588 | [ | ||
| 589 | 3, | ||
| 590 | 5, | ||
| 591 | 1 | ||
| 592 | ], | ||
| 593 | [ | ||
| 594 | 3, | ||
| 595 | 6, | ||
| 596 | -1 | ||
| 597 | ], | ||
| 598 | [ | ||
| 599 | 4, | ||
| 600 | 5, | ||
| 601 | 1 | ||
| 602 | ], | ||
| 603 | [ | ||
| 604 | 4, | ||
| 605 | 6, | ||
| 606 | -1 | ||
| 607 | ], | ||
| 608 | [ | ||
| 609 | 5, | ||
| 610 | 6, | ||
| 611 | 1 | ||
| 612 | ] | ||
| 613 | ], | ||
| 614 | "frame_inherit" : true, | ||
| 615 | "frame_parent" : 0, | ||
| 616 | "krz:step" : { | ||
| 617 | "axes" : [ | ||
| 618 | { | ||
| 619 | "edge" : 13, | ||
| 620 | "endAngle" : 180, | ||
| 621 | "movingFaces" : [ | ||
| 622 | 3, | ||
| 623 | 4 | ||
| 624 | ], | ||
| 625 | "startAngle" : 0 | ||
| 626 | } | ||
| 627 | ], | ||
| 628 | "instruction" : "Valley fold the left corner across to touch the right edge, over the first flap.", | ||
| 629 | "kind" : "fold", | ||
| 630 | "nonRigid" : false, | ||
| 631 | "technique" : "plain", | ||
| 632 | "viewpoint" : { | ||
| 633 | "eye" : [ | ||
| 634 | 0, | ||
| 635 | 0, | ||
| 636 | 1 | ||
| 637 | ], | ||
| 638 | "up" : [ | ||
| 639 | 0, | ||
| 640 | 1, | ||
| 641 | 0 | ||
| 642 | ] | ||
| 643 | } | ||
| 644 | }, | ||
| 645 | "vertices_coords" : [ | ||
| 646 | [ | ||
| 647 | 1, | ||
| 648 | 2, | ||
| 649 | 1.2246467991473532e-16 | ||
| 650 | ], | ||
| 651 | [ | ||
| 652 | 1.4142135623730951, | ||
| 653 | 1.5857864376269049, | ||
| 654 | 7.173814858237197e-17 | ||
| 655 | ], | ||
| 656 | [ | ||
| 657 | 0.5857864376269052, | ||
| 658 | 1.5857864376269053, | ||
| 659 | 9.373040810652596e-17 | ||
| 660 | ], | ||
| 661 | [ | ||
| 662 | 1.4142135623730951, | ||
| 663 | 1.5857864376269049, | ||
| 664 | 0 | ||
| 665 | ], | ||
| 666 | [ | ||
| 667 | 1, | ||
| 668 | 2, | ||
| 669 | 0 | ||
| 670 | ], | ||
| 671 | [ | ||
| 672 | 0.5857864376269046, | ||
| 673 | 1.5857864376269049, | ||
| 674 | 0 | ||
| 675 | ], | ||
| 676 | [ | ||
| 677 | 1.4142135623730945, | ||
| 678 | 1.5857864376269055, | ||
| 679 | 9.373040810652596e-17 | ||
| 680 | ], | ||
| 681 | [ | ||
| 682 | 0.5857864376269049, | ||
| 683 | 1.5857864376269049, | ||
| 684 | 7.173814858237197e-17 | ||
| 685 | ], | ||
| 686 | [ | ||
| 687 | 0.8284271247461903, | ||
| 688 | 1, | ||
| 689 | 0 | ||
| 690 | ], | ||
| 691 | [ | ||
| 692 | 1.1715728752538097, | ||
| 693 | 1, | ||
| 694 | 0 | ||
| 695 | ] | ||
| 696 | ] | ||
| 697 | }, | ||
| 698 | { | ||
| 699 | "edges_assignment" : [ | ||
| 700 | "B", | ||
| 701 | "B", | ||
| 702 | "B", | ||
| 703 | "B", | ||
| 704 | "B", | ||
| 705 | "B", | ||
| 706 | "B", | ||
| 707 | "B", | ||
| 708 | "V", | ||
| 709 | "V", | ||
| 710 | "V", | ||
| 711 | "V", | ||
| 712 | "M", | ||
| 713 | "V", | ||
| 714 | "M", | ||
| 715 | "M", | ||
| 716 | "F" | ||
| 717 | ], | ||
| 718 | "edges_foldAngle" : [ | ||
| 719 | 0, | ||
| 720 | 0, | ||
| 721 | 0, | ||
| 722 | 0, | ||
| 723 | 0, | ||
| 724 | 0, | ||
| 725 | 0, | ||
| 726 | 0, | ||
| 727 | 180, | ||
| 728 | 180, | ||
| 729 | 180, | ||
| 730 | 180, | ||
| 731 | -180, | ||
| 732 | 180, | ||
| 733 | -180, | ||
| 734 | -180, | ||
| 735 | 0 | ||
| 736 | ], | ||
| 737 | "faceOrders" : [ | ||
| 738 | [ | ||
| 739 | 0, | ||
| 740 | 1, | ||
| 741 | -1 | ||
| 742 | ], | ||
| 743 | [ | ||
| 744 | 0, | ||
| 745 | 2, | ||
| 746 | 1 | ||
| 747 | ], | ||
| 748 | [ | ||
| 749 | 0, | ||
| 750 | 3, | ||
| 751 | 1 | ||
| 752 | ], | ||
| 753 | [ | ||
| 754 | 0, | ||
| 755 | 4, | ||
| 756 | -1 | ||
| 757 | ], | ||
| 758 | [ | ||
| 759 | 0, | ||
| 760 | 5, | ||
| 761 | 1 | ||
| 762 | ], | ||
| 763 | [ | ||
| 764 | 0, | ||
| 765 | 6, | ||
| 766 | -1 | ||
| 767 | ], | ||
| 768 | [ | ||
| 769 | 1, | ||
| 770 | 2, | ||
| 771 | -1 | ||
| 772 | ], | ||
| 773 | [ | ||
| 774 | 1, | ||
| 775 | 3, | ||
| 776 | -1 | ||
| 777 | ], | ||
| 778 | [ | ||
| 779 | 1, | ||
| 780 | 4, | ||
| 781 | 1 | ||
| 782 | ], | ||
| 783 | [ | ||
| 784 | 1, | ||
| 785 | 5, | ||
| 786 | 1 | ||
| 787 | ], | ||
| 788 | [ | ||
| 789 | 1, | ||
| 790 | 6, | ||
| 791 | 1 | ||
| 792 | ], | ||
| 793 | [ | ||
| 794 | 2, | ||
| 795 | 3, | ||
| 796 | -1 | ||
| 797 | ], | ||
| 798 | [ | ||
| 799 | 2, | ||
| 800 | 4, | ||
| 801 | 1 | ||
| 802 | ], | ||
| 803 | [ | ||
| 804 | 2, | ||
| 805 | 5, | ||
| 806 | 1 | ||
| 807 | ], | ||
| 808 | [ | ||
| 809 | 2, | ||
| 810 | 6, | ||
| 811 | 1 | ||
| 812 | ], | ||
| 813 | [ | ||
| 814 | 3, | ||
| 815 | 4, | ||
| 816 | 1 | ||
| 817 | ], | ||
| 818 | [ | ||
| 819 | 3, | ||
| 820 | 5, | ||
| 821 | 1 | ||
| 822 | ], | ||
| 823 | [ | ||
| 824 | 3, | ||
| 825 | 6, | ||
| 826 | -1 | ||
| 827 | ], | ||
| 828 | [ | ||
| 829 | 4, | ||
| 830 | 5, | ||
| 831 | 1 | ||
| 832 | ], | ||
| 833 | [ | ||
| 834 | 4, | ||
| 835 | 6, | ||
| 836 | -1 | ||
| 837 | ], | ||
| 838 | [ | ||
| 839 | 5, | ||
| 840 | 6, | ||
| 841 | 1 | ||
| 842 | ] | ||
| 843 | ], | ||
| 844 | "frame_inherit" : true, | ||
| 845 | "frame_parent" : 0, | ||
| 846 | "krz:step" : { | ||
| 847 | "axes" : [ | ||
| 848 | { | ||
| 849 | "edge" : 15, | ||
| 850 | "endAngle" : -180, | ||
| 851 | "movingFaces" : [ | ||
| 852 | 0 | ||
| 853 | ], | ||
| 854 | "startAngle" : 0 | ||
| 855 | } | ||
| 856 | ], | ||
| 857 | "instruction" : "Valley fold the front top flap down over the front.", | ||
| 858 | "kind" : "fold", | ||
| 859 | "nonRigid" : false, | ||
| 860 | "technique" : "plain", | ||
| 861 | "viewpoint" : { | ||
| 862 | "eye" : [ | ||
| 863 | 0, | ||
| 864 | 0, | ||
| 865 | 1 | ||
| 866 | ], | ||
| 867 | "up" : [ | ||
| 868 | 0, | ||
| 869 | 1, | ||
| 870 | 0 | ||
| 871 | ] | ||
| 872 | } | ||
| 873 | }, | ||
| 874 | "vertices_coords" : [ | ||
| 875 | [ | ||
| 876 | 1, | ||
| 877 | 1.1715728752538097, | ||
| 878 | 7.1738148582372e-17 | ||
| 879 | ], | ||
| 880 | [ | ||
| 881 | 1.4142135623730951, | ||
| 882 | 1.5857864376269049, | ||
| 883 | 7.173814858237197e-17 | ||
| 884 | ], | ||
| 885 | [ | ||
| 886 | 0.5857864376269052, | ||
| 887 | 1.5857864376269053, | ||
| 888 | 9.373040810652596e-17 | ||
| 889 | ], | ||
| 890 | [ | ||
| 891 | 1.4142135623730951, | ||
| 892 | 1.5857864376269049, | ||
| 893 | 0 | ||
| 894 | ], | ||
| 895 | [ | ||
| 896 | 1, | ||
| 897 | 2, | ||
| 898 | 0 | ||
| 899 | ], | ||
| 900 | [ | ||
| 901 | 0.5857864376269046, | ||
| 902 | 1.5857864376269049, | ||
| 903 | 0 | ||
| 904 | ], | ||
| 905 | [ | ||
| 906 | 1.4142135623730945, | ||
| 907 | 1.5857864376269055, | ||
| 908 | 9.373040810652596e-17 | ||
| 909 | ], | ||
| 910 | [ | ||
| 911 | 0.5857864376269049, | ||
| 912 | 1.5857864376269049, | ||
| 913 | 7.173814858237197e-17 | ||
| 914 | ], | ||
| 915 | [ | ||
| 916 | 0.8284271247461903, | ||
| 917 | 1, | ||
| 918 | 0 | ||
| 919 | ], | ||
| 920 | [ | ||
| 921 | 1.1715728752538097, | ||
| 922 | 1, | ||
| 923 | 0 | ||
| 924 | ] | ||
| 925 | ] | ||
| 926 | }, | ||
| 927 | { | ||
| 928 | "edges_assignment" : [ | ||
| 929 | "B", | ||
| 930 | "B", | ||
| 931 | "B", | ||
| 932 | "B", | ||
| 933 | "B", | ||
| 934 | "B", | ||
| 935 | "B", | ||
| 936 | "B", | ||
| 937 | "V", | ||
| 938 | "V", | ||
| 939 | "V", | ||
| 940 | "V", | ||
| 941 | "M", | ||
| 942 | "V", | ||
| 943 | "M", | ||
| 944 | "M", | ||
| 945 | "F" | ||
| 946 | ], | ||
| 947 | "edges_foldAngle" : [ | ||
| 948 | 0, | ||
| 949 | 0, | ||
| 950 | 0, | ||
| 951 | 0, | ||
| 952 | 0, | ||
| 953 | 0, | ||
| 954 | 0, | ||
| 955 | 0, | ||
| 956 | 180, | ||
| 957 | 180, | ||
| 958 | 180, | ||
| 959 | 180, | ||
| 960 | -180, | ||
| 961 | 180, | ||
| 962 | -180, | ||
| 963 | -180, | ||
| 964 | 0 | ||
| 965 | ], | ||
| 966 | "faceOrders" : [ | ||
| 967 | [ | ||
| 968 | 0, | ||
| 969 | 1, | ||
| 970 | -1 | ||
| 971 | ], | ||
| 972 | [ | ||
| 973 | 0, | ||
| 974 | 2, | ||
| 975 | 1 | ||
| 976 | ], | ||
| 977 | [ | ||
| 978 | 0, | ||
| 979 | 3, | ||
| 980 | 1 | ||
| 981 | ], | ||
| 982 | [ | ||
| 983 | 0, | ||
| 984 | 4, | ||
| 985 | -1 | ||
| 986 | ], | ||
| 987 | [ | ||
| 988 | 0, | ||
| 989 | 5, | ||
| 990 | 1 | ||
| 991 | ], | ||
| 992 | [ | ||
| 993 | 0, | ||
| 994 | 6, | ||
| 995 | -1 | ||
| 996 | ], | ||
| 997 | [ | ||
| 998 | 1, | ||
| 999 | 2, | ||
| 1000 | -1 | ||
| 1001 | ], | ||
| 1002 | [ | ||
| 1003 | 1, | ||
| 1004 | 3, | ||
| 1005 | -1 | ||
| 1006 | ], | ||
| 1007 | [ | ||
| 1008 | 1, | ||
| 1009 | 4, | ||
| 1010 | 1 | ||
| 1011 | ], | ||
| 1012 | [ | ||
| 1013 | 1, | ||
| 1014 | 5, | ||
| 1015 | 1 | ||
| 1016 | ], | ||
| 1017 | [ | ||
| 1018 | 1, | ||
| 1019 | 6, | ||
| 1020 | 1 | ||
| 1021 | ], | ||
| 1022 | [ | ||
| 1023 | 2, | ||
| 1024 | 3, | ||
| 1025 | -1 | ||
| 1026 | ], | ||
| 1027 | [ | ||
| 1028 | 2, | ||
| 1029 | 4, | ||
| 1030 | 1 | ||
| 1031 | ], | ||
| 1032 | [ | ||
| 1033 | 2, | ||
| 1034 | 5, | ||
| 1035 | 1 | ||
| 1036 | ], | ||
| 1037 | [ | ||
| 1038 | 2, | ||
| 1039 | 6, | ||
| 1040 | 1 | ||
| 1041 | ], | ||
| 1042 | [ | ||
| 1043 | 3, | ||
| 1044 | 4, | ||
| 1045 | 1 | ||
| 1046 | ], | ||
| 1047 | [ | ||
| 1048 | 3, | ||
| 1049 | 5, | ||
| 1050 | 1 | ||
| 1051 | ], | ||
| 1052 | [ | ||
| 1053 | 3, | ||
| 1054 | 6, | ||
| 1055 | -1 | ||
| 1056 | ], | ||
| 1057 | [ | ||
| 1058 | 4, | ||
| 1059 | 5, | ||
| 1060 | 1 | ||
| 1061 | ], | ||
| 1062 | [ | ||
| 1063 | 4, | ||
| 1064 | 6, | ||
| 1065 | -1 | ||
| 1066 | ], | ||
| 1067 | [ | ||
| 1068 | 5, | ||
| 1069 | 6, | ||
| 1070 | 1 | ||
| 1071 | ] | ||
| 1072 | ], | ||
| 1073 | "frame_inherit" : true, | ||
| 1074 | "frame_parent" : 0, | ||
| 1075 | "krz:step" : { | ||
| 1076 | "axes" : [ | ||
| 1077 | |||
| 1078 | ], | ||
| 1079 | "instruction" : "Turn over.", | ||
| 1080 | "kind" : "turnOver", | ||
| 1081 | "nonRigid" : false, | ||
| 1082 | "technique" : "plain", | ||
| 1083 | "turnOverAxis" : "vertical", | ||
| 1084 | "viewpoint" : { | ||
| 1085 | "eye" : [ | ||
| 1086 | 0, | ||
| 1087 | 0, | ||
| 1088 | 1 | ||
| 1089 | ], | ||
| 1090 | "up" : [ | ||
| 1091 | 0, | ||
| 1092 | 1, | ||
| 1093 | 0 | ||
| 1094 | ] | ||
| 1095 | } | ||
| 1096 | }, | ||
| 1097 | "vertices_coords" : [ | ||
| 1098 | [ | ||
| 1099 | 0.9999999999999998, | ||
| 1100 | 1.1715728752538097, | ||
| 1101 | 2.199225952415395e-17 | ||
| 1102 | ], | ||
| 1103 | [ | ||
| 1104 | 0.5857864376269046, | ||
| 1105 | 1.5857864376269049, | ||
| 1106 | -2.8734271808209374e-17 | ||
| 1107 | ], | ||
| 1108 | [ | ||
| 1109 | 1.4142135623730945, | ||
| 1110 | 1.5857864376269053, | ||
| 1111 | 5.07265313323633e-17 | ||
| 1112 | ], | ||
| 1113 | [ | ||
| 1114 | 0.5857864376269046, | ||
| 1115 | 1.5857864376269049, | ||
| 1116 | 4.300387677416259e-17 | ||
| 1117 | ], | ||
| 1118 | [ | ||
| 1119 | 0.9999999999999998, | ||
| 1120 | 2, | ||
| 1121 | 9.373040810652595e-17 | ||
| 1122 | ], | ||
| 1123 | [ | ||
| 1124 | 1.4142135623730951, | ||
| 1125 | 1.5857864376269049, | ||
| 1126 | 1.4445693943888932e-16 | ||
| 1127 | ], | ||
| 1128 | [ | ||
| 1129 | 0.5857864376269053, | ||
| 1130 | 1.5857864376269055, | ||
| 1131 | -5.072653133236329e-17 | ||
| 1132 | ], | ||
| 1133 | [ | ||
| 1134 | 1.414213562373095, | ||
| 1135 | 1.5857864376269049, | ||
| 1136 | 7.271879085651732e-17 | ||
| 1137 | ], | ||
| 1138 | [ | ||
| 1139 | 1.1715728752538095, | ||
| 1140 | 1, | ||
| 1141 | 1.1474202535653456e-16 | ||
| 1142 | ], | ||
| 1143 | [ | ||
| 1144 | 0.8284271247461901, | ||
| 1145 | 1, | ||
| 1146 | 7.271879085651732e-17 | ||
| 1147 | ] | ||
| 1148 | ] | ||
| 1149 | }, | ||
| 1150 | { | ||
| 1151 | "edges_assignment" : [ | ||
| 1152 | "B", | ||
| 1153 | "B", | ||
| 1154 | "B", | ||
| 1155 | "B", | ||
| 1156 | "B", | ||
| 1157 | "B", | ||
| 1158 | "B", | ||
| 1159 | "B", | ||
| 1160 | "V", | ||
| 1161 | "V", | ||
| 1162 | "V", | ||
| 1163 | "V", | ||
| 1164 | "M", | ||
| 1165 | "V", | ||
| 1166 | "M", | ||
| 1167 | "M", | ||
| 1168 | "M" | ||
| 1169 | ], | ||
| 1170 | "edges_foldAngle" : [ | ||
| 1171 | 0, | ||
| 1172 | 0, | ||
| 1173 | 0, | ||
| 1174 | 0, | ||
| 1175 | 0, | ||
| 1176 | 0, | ||
| 1177 | 0, | ||
| 1178 | 0, | ||
| 1179 | 180, | ||
| 1180 | 180, | ||
| 1181 | 180, | ||
| 1182 | 180, | ||
| 1183 | -180, | ||
| 1184 | 180, | ||
| 1185 | -180, | ||
| 1186 | -180, | ||
| 1187 | -180 | ||
| 1188 | ], | ||
| 1189 | "faceOrders" : [ | ||
| 1190 | [ | ||
| 1191 | 0, | ||
| 1192 | 1, | ||
| 1193 | -1 | ||
| 1194 | ], | ||
| 1195 | [ | ||
| 1196 | 0, | ||
| 1197 | 2, | ||
| 1198 | 1 | ||
| 1199 | ], | ||
| 1200 | [ | ||
| 1201 | 0, | ||
| 1202 | 3, | ||
| 1203 | 1 | ||
| 1204 | ], | ||
| 1205 | [ | ||
| 1206 | 0, | ||
| 1207 | 4, | ||
| 1208 | -1 | ||
| 1209 | ], | ||
| 1210 | [ | ||
| 1211 | 0, | ||
| 1212 | 5, | ||
| 1213 | 1 | ||
| 1214 | ], | ||
| 1215 | [ | ||
| 1216 | 0, | ||
| 1217 | 6, | ||
| 1218 | -1 | ||
| 1219 | ], | ||
| 1220 | [ | ||
| 1221 | 0, | ||
| 1222 | 7, | ||
| 1223 | -1 | ||
| 1224 | ], | ||
| 1225 | [ | ||
| 1226 | 1, | ||
| 1227 | 2, | ||
| 1228 | -1 | ||
| 1229 | ], | ||
| 1230 | [ | ||
| 1231 | 1, | ||
| 1232 | 3, | ||
| 1233 | -1 | ||
| 1234 | ], | ||
| 1235 | [ | ||
| 1236 | 1, | ||
| 1237 | 4, | ||
| 1238 | 1 | ||
| 1239 | ], | ||
| 1240 | [ | ||
| 1241 | 1, | ||
| 1242 | 5, | ||
| 1243 | 1 | ||
| 1244 | ], | ||
| 1245 | [ | ||
| 1246 | 1, | ||
| 1247 | 6, | ||
| 1248 | 1 | ||
| 1249 | ], | ||
| 1250 | [ | ||
| 1251 | 1, | ||
| 1252 | 7, | ||
| 1253 | -1 | ||
| 1254 | ], | ||
| 1255 | [ | ||
| 1256 | 2, | ||
| 1257 | 3, | ||
| 1258 | -1 | ||
| 1259 | ], | ||
| 1260 | [ | ||
| 1261 | 2, | ||
| 1262 | 4, | ||
| 1263 | 1 | ||
| 1264 | ], | ||
| 1265 | [ | ||
| 1266 | 2, | ||
| 1267 | 5, | ||
| 1268 | 1 | ||
| 1269 | ], | ||
| 1270 | [ | ||
| 1271 | 2, | ||
| 1272 | 6, | ||
| 1273 | 1 | ||
| 1274 | ], | ||
| 1275 | [ | ||
| 1276 | 2, | ||
| 1277 | 7, | ||
| 1278 | -1 | ||
| 1279 | ], | ||
| 1280 | [ | ||
| 1281 | 3, | ||
| 1282 | 4, | ||
| 1283 | 1 | ||
| 1284 | ], | ||
| 1285 | [ | ||
| 1286 | 3, | ||
| 1287 | 5, | ||
| 1288 | 1 | ||
| 1289 | ], | ||
| 1290 | [ | ||
| 1291 | 3, | ||
| 1292 | 6, | ||
| 1293 | -1 | ||
| 1294 | ], | ||
| 1295 | [ | ||
| 1296 | 3, | ||
| 1297 | 7, | ||
| 1298 | -1 | ||
| 1299 | ], | ||
| 1300 | [ | ||
| 1301 | 4, | ||
| 1302 | 5, | ||
| 1303 | 1 | ||
| 1304 | ], | ||
| 1305 | [ | ||
| 1306 | 4, | ||
| 1307 | 6, | ||
| 1308 | -1 | ||
| 1309 | ], | ||
| 1310 | [ | ||
| 1311 | 4, | ||
| 1312 | 7, | ||
| 1313 | -1 | ||
| 1314 | ], | ||
| 1315 | [ | ||
| 1316 | 5, | ||
| 1317 | 6, | ||
| 1318 | 1 | ||
| 1319 | ], | ||
| 1320 | [ | ||
| 1321 | 5, | ||
| 1322 | 7, | ||
| 1323 | -1 | ||
| 1324 | ], | ||
| 1325 | [ | ||
| 1326 | 6, | ||
| 1327 | 7, | ||
| 1328 | -1 | ||
| 1329 | ] | ||
| 1330 | ], | ||
| 1331 | "frame_inherit" : true, | ||
| 1332 | "frame_parent" : 0, | ||
| 1333 | "krz:step" : { | ||
| 1334 | "axes" : [ | ||
| 1335 | { | ||
| 1336 | "edge" : 16, | ||
| 1337 | "endAngle" : -180, | ||
| 1338 | "movingFaces" : [ | ||
| 1339 | 7 | ||
| 1340 | ], | ||
| 1341 | "startAngle" : 0 | ||
| 1342 | } | ||
| 1343 | ], | ||
| 1344 | "instruction" : "Valley fold the remaining top flap down.", | ||
| 1345 | "kind" : "fold", | ||
| 1346 | "nonRigid" : false, | ||
| 1347 | "technique" : "plain", | ||
| 1348 | "viewpoint" : { | ||
| 1349 | "eye" : [ | ||
| 1350 | 0, | ||
| 1351 | 0, | ||
| 1352 | 1 | ||
| 1353 | ], | ||
| 1354 | "up" : [ | ||
| 1355 | 0, | ||
| 1356 | 1, | ||
| 1357 | 0 | ||
| 1358 | ] | ||
| 1359 | } | ||
| 1360 | }, | ||
| 1361 | "vertices_coords" : [ | ||
| 1362 | [ | ||
| 1363 | 0.9999999999999998, | ||
| 1364 | 1.1715728752538097, | ||
| 1365 | 2.199225952415395e-17 | ||
| 1366 | ], | ||
| 1367 | [ | ||
| 1368 | 0.5857864376269046, | ||
| 1369 | 1.5857864376269049, | ||
| 1370 | -2.8734271808209374e-17 | ||
| 1371 | ], | ||
| 1372 | [ | ||
| 1373 | 1.4142135623730945, | ||
| 1374 | 1.5857864376269053, | ||
| 1375 | 5.07265313323633e-17 | ||
| 1376 | ], | ||
| 1377 | [ | ||
| 1378 | 0.5857864376269046, | ||
| 1379 | 1.5857864376269049, | ||
| 1380 | 4.300387677416259e-17 | ||
| 1381 | ], | ||
| 1382 | [ | ||
| 1383 | 0.9999999999999998, | ||
| 1384 | 1.1715728752538097, | ||
| 1385 | 1.444569394388892e-16 | ||
| 1386 | ], | ||
| 1387 | [ | ||
| 1388 | 1.4142135623730951, | ||
| 1389 | 1.5857864376269049, | ||
| 1390 | 1.4445693943888932e-16 | ||
| 1391 | ], | ||
| 1392 | [ | ||
| 1393 | 0.5857864376269053, | ||
| 1394 | 1.5857864376269055, | ||
| 1395 | -5.072653133236329e-17 | ||
| 1396 | ], | ||
| 1397 | [ | ||
| 1398 | 1.414213562373095, | ||
| 1399 | 1.5857864376269049, | ||
| 1400 | 7.271879085651732e-17 | ||
| 1401 | ], | ||
| 1402 | [ | ||
| 1403 | 1.1715728752538095, | ||
| 1404 | 1, | ||
| 1405 | 1.1474202535653456e-16 | ||
| 1406 | ], | ||
| 1407 | [ | ||
| 1408 | 0.8284271247461901, | ||
| 1409 | 1, | ||
| 1410 | 7.271879085651732e-17 | ||
| 1411 | ] | ||
| 1412 | ] | ||
| 1413 | } | ||
| 1414 | ], | ||
| 1415 | "file_spec" : 1.2, | ||
| 1416 | "file_title" : "Cup", | ||
| 1417 | "vertices_coords" : [ | ||
| 1418 | [ | ||
| 1419 | 1, | ||
| 1420 | 0, | ||
| 1421 | 0 | ||
| 1422 | ], | ||
| 1423 | [ | ||
| 1424 | 1.4142135623730951, | ||
| 1425 | 0.41421356237309515, | ||
| 1426 | 0 | ||
| 1427 | ], | ||
| 1428 | [ | ||
| 1429 | 2, | ||
| 1430 | 1, | ||
| 1431 | 0 | ||
| 1432 | ], | ||
| 1433 | [ | ||
| 1434 | 1.4142135623730951, | ||
| 1435 | 1.5857864376269049, | ||
| 1436 | 0 | ||
| 1437 | ], | ||
| 1438 | [ | ||
| 1439 | 1, | ||
| 1440 | 2, | ||
| 1441 | 0 | ||
| 1442 | ], | ||
| 1443 | [ | ||
| 1444 | 0.5857864376269049, | ||
| 1445 | 1.5857864376269049, | ||
| 1446 | 0 | ||
| 1447 | ], | ||
| 1448 | [ | ||
| 1449 | 0, | ||
| 1450 | 1, | ||
| 1451 | 0 | ||
| 1452 | ], | ||
| 1453 | [ | ||
| 1454 | 0.5857864376269049, | ||
| 1455 | 0.41421356237309515, | ||
| 1456 | 0 | ||
| 1457 | ], | ||
| 1458 | [ | ||
| 1459 | 0.8284271247461903, | ||
| 1460 | 1, | ||
| 1461 | 0 | ||
| 1462 | ], | ||
| 1463 | [ | ||
| 1464 | 1.1715728752538097, | ||
| 1465 | 1, | ||
| 1466 | 0 | ||
| 1467 | ] | ||
| 1468 | ] | ||
| 1469 | }\ No newline at end of file | ||
Packages/FoldKit/Sources/foldlint/main.swift added +33
| @@ -0,0 +1,33 @@ | |||
| 1 | import FoldFormat | ||
| 2 | import Folding | ||
| 3 | import Foundation | ||
| 4 | |||
| 5 | // foldlint <model.fold>... | ||
| 6 | // | ||
| 7 | // Prints each defect as `<path>: <defect>`, one per line, and exits 1 when there is one. A file | ||
| 8 | // that validates has its steps read and its layer motion checked. | ||
| 9 | |||
| 10 | let paths = Array(CommandLine.arguments.dropFirst()) | ||
| 11 | guard !paths.isEmpty else { | ||
| 12 | FileHandle.standardError.write(Data("usage: foldlint <model.fold>...\n".utf8)) | ||
| 13 | exit(2) | ||
| 14 | } | ||
| 15 | |||
| 16 | var clean = true | ||
| 17 | for path in paths { | ||
| 18 | func report(_ defect: Any) { | ||
| 19 | print("\(path): \(defect)") | ||
| 20 | clean = false | ||
| 21 | } | ||
| 22 | do { | ||
| 23 | let file = try FoldFile(contentsOf: URL(fileURLWithPath: path)) | ||
| 24 | let defects = validate(file) | ||
| 25 | defects.forEach(report) | ||
| 26 | guard defects.isEmpty else { continue } | ||
| 27 | _ = try readSteps(file) | ||
| 28 | layerMotionDefects(file).forEach(report) | ||
| 29 | } catch { | ||
| 30 | report(error) | ||
| 31 | } | ||
| 32 | } | ||
| 33 | exit(clean ? 0 : 1) | ||
Packages/FoldKit/Tests/ModelsTests/CatalogueTests.swift added +94
| @@ -0,0 +1,94 @@ | |||
| 1 | import Foundation | ||
| 2 | import Testing | ||
| 3 | import simd | ||
| 4 | import FoldCompiler | ||
| 5 | import FoldFormat | ||
| 6 | import Folding | ||
| 7 | import FoldKitTestSupport | ||
| 8 | import Models | ||
| 9 | |||
| 10 | @Test func everyShippedStepEndsOnItsEndFrame() throws { | ||
| 11 | // the step records and the frames must agree: interpolating a step to t = 1 reproduces frame n | ||
| 12 | for file in try ModelLibrary.all() { | ||
| 13 | for step in try readSteps(file) { | ||
| 14 | let i = FoldInterpolator(file: file, step: step) | ||
| 15 | #expect(zip(i.positions(at: 1), file.frames[step.index].verticesCoords) | ||
| 16 | .allSatisfy { simd_distance($0, $1) < 1e-6 * sheetSize(file) }, "\(file.fileTitle ?? "?") step \(step.index)") | ||
| 17 | } | ||
| 18 | } | ||
| 19 | } | ||
| 20 | |||
| 21 | @Test func everyShippedModelValidates() throws { | ||
| 22 | for file in try ModelLibrary.all() { #expect(validate(file).isEmpty, "\(file.fileTitle ?? "?")") } | ||
| 23 | } | ||
| 24 | |||
| 25 | @Test func everyShippedModelReadsItsSteps() throws { | ||
| 26 | for file in try ModelLibrary.all() { | ||
| 27 | #expect(try readSteps(file).count == file.stepCount) | ||
| 28 | } | ||
| 29 | } | ||
| 30 | |||
| 31 | @Test func noShippedModelStretchesAtAnyStep() throws { | ||
| 32 | // flagged non-rigid steps are held to Task 0b's bound instead | ||
| 33 | for file in try ModelLibrary.all() { | ||
| 34 | for step in try readSteps(file) where !step.nonRigid { | ||
| 35 | let i = FoldInterpolator(file: file, step: step) | ||
| 36 | for t in stride(from: 0.0, through: 1.0, by: 1.0 / 256) { | ||
| 37 | #expect(maxEdgeLengthDrift(i.positions(at: t), file) < 1e-6, | ||
| 38 | "\(file.fileTitle ?? "?") step \(step.index) t \(t)") | ||
| 39 | } | ||
| 40 | } | ||
| 41 | } | ||
| 42 | } | ||
| 43 | |||
| 44 | @Test func noShippedModelInterpenetratesAtAnyStep() throws { | ||
| 45 | // non-rigid steps bend their faces; everyFlaggedStepStaysWithinTheBound checks them on the mesh | ||
| 46 | for file in try ModelLibrary.all() { | ||
| 47 | for step in try readSteps(file) where !step.nonRigid { | ||
| 48 | let i = FoldInterpolator(file: file, step: step) | ||
| 49 | #expect(interpenetrations(i, faces: file.facesVertices, samples: 64).isEmpty, | ||
| 50 | "\(file.fileTitle ?? "?") step \(step.index)") | ||
| 51 | } | ||
| 52 | } | ||
| 53 | } | ||
| 54 | |||
| 55 | @Test func noShippedModelMovesThroughAStillFace() throws { | ||
| 56 | for file in try ModelLibrary.all() { #expect(layerMotionDefects(file).isEmpty, "\(file.fileTitle ?? "?")") } | ||
| 57 | } | ||
| 58 | |||
| 59 | @Test func everyModelIsAttributedAsTraditional() throws { | ||
| 60 | for file in try ModelLibrary.all() { #expect(file.fileAuthor == "Traditional") } | ||
| 61 | } | ||
| 62 | |||
| 63 | @Test func everyShippedModelRegeneratesFromItsScript() throws { | ||
| 64 | for name in try ModelLibrary.names() { | ||
| 65 | let recompiled = try compile(FoldScript(contentsOf: script(name)), | ||
| 66 | pattern: FoldFile(contentsOf: pattern(name))) | ||
| 67 | #expect(structurallyEqual(recompiled, try ModelLibrary.model(named: name), tolerance: 1e-12), "\(name)") | ||
| 68 | } | ||
| 69 | } | ||
| 70 | |||
| 71 | @Test func everyFlaggedStepStaysWithinTheBound() throws { | ||
| 72 | // decision 0002: 10% largest edge strain on the render mesh, and nothing passes through anything | ||
| 73 | for file in try ModelLibrary.all() { | ||
| 74 | for step in try readSteps(file) where step.nonRigid { | ||
| 75 | let i = FoldInterpolator(file: file, step: step) | ||
| 76 | let (lo, hi) = (step.pop!.phases.lowerBound, step.pop!.phases.upperBound) | ||
| 77 | let worst = (0...128).map { strain(i.meshPositions(at: lo + Double($0) / 128 * (hi - lo)), mesh: i.mesh) }.max()! | ||
| 78 | #expect(worst <= 0.10, "\(file.fileTitle ?? "?") step \(step.index)") | ||
| 79 | #expect(meshInterpenetrations(i, samples: 64).filter { $0.t > 0.02 && $0.t < 0.98 }.isEmpty) | ||
| 80 | } | ||
| 81 | } | ||
| 82 | } | ||
| 83 | |||
| 84 | @Test func theCatalogueContainsTheCup() throws { | ||
| 85 | #expect(try ModelLibrary.names() == ["cup"]) | ||
| 86 | } | ||
| 87 | |||
| 88 | @Test func theCupContainsATurnOverStep() throws { | ||
| 89 | #expect(try readSteps(ModelLibrary.model(named: "cup")).contains { $0.kind == .turnOver }) | ||
| 90 | } | ||
| 91 | |||
| 92 | @Test func foldlintExitsNonZeroOnADefectiveFile() throws { | ||
| 93 | #expect(try runFoldlint(on: fixture("bad-index.fold")).exitCode == 1) | ||
| 94 | } | ||
docs/authoring/cup.md added +96
| @@ -0,0 +1,96 @@ | |||
| 1 | # Cup | ||
| 2 | |||
| 3 | Traditional. Six steps: five folds of one axis each and a turn-over. No coupled | ||
| 4 | steps (no solved curves) and no non-rigid steps. | ||
| 5 | |||
| 6 | `Models/cup-cp.fold` and `Models/cup.foldscript` compile to | ||
| 7 | `Packages/FoldKit/Sources/Models/Resources/cup.fold`: | ||
| 8 | |||
| 9 | ```bash | ||
| 10 | swift run --package-path Packages/FoldKit foldc Models/cup.foldscript \ | ||
| 11 | -o Packages/FoldKit/Sources/Models/Resources/cup.fold | ||
| 12 | ``` | ||
| 13 | |||
| 14 | `everyShippedModelRegeneratesFromItsScript` checks that the shipped file is | ||
| 15 | what the script compiles to. | ||
| 16 | |||
| 17 | ## Crease pattern | ||
| 18 | |||
| 19 | Constructed from the traditional folding sequence, not taken from a published | ||
| 20 | crease pattern. The sheet is a square of side √2 set as a diamond, corners | ||
| 21 | S (1, 0), E (2, 1), N (1, 2), W (0, 1), its top side up (+z). | ||
| 22 | |||
| 23 | Step 1 folds S up to N along the diagonal y = 1, giving a triangle with its | ||
| 24 | folded edge W–E at the bottom and apex N. Step 2 folds corner E to the left | ||
| 25 | edge W–N so that the flap's top edge, part of the former right edge E–N, is | ||
| 26 | level. Reflecting E–N (direction 135°) onto a horizontal line needs a crease | ||
| 27 | at 67.5°; the one that also puts E on W–N runs from Q = (4 − 2√2, 1) on the | ||
| 28 | fold to R = (√2, 3 − √2) on the right edge, and E lands on | ||
| 29 | P = (2 − √2, 3 − √2). Step 3 is its mirror image: the crease from | ||
| 30 | Q′ = (2√2 − 2, 1) to P, and W lands on R. The apex flaps fold down along the | ||
| 31 | level line through P and R. Each crease through both layers of the triangle | ||
| 32 | is two creases in the pattern, one in each half of the diamond, mirrored in | ||
| 33 | y = 1. | ||
| 34 | |||
| 35 | | Vertex | Point | Coordinates | | ||
| 36 | |---|---|---| | ||
| 37 | | v0 | S | (1, 0) | | ||
| 38 | | v1 | R′ | (√2, √2 − 1) | | ||
| 39 | | v2 | E | (2, 1) | | ||
| 40 | | v3 | R | (√2, 3 − √2) | | ||
| 41 | | v4 | N | (1, 2) | | ||
| 42 | | v5 | P | (2 − √2, 3 − √2) | | ||
| 43 | | v6 | W | (0, 1) | | ||
| 44 | | v7 | P′ | (2 − √2, √2 − 1) | | ||
| 45 | | v8 | Q′ | (2√2 − 2, 1) | | ||
| 46 | | v9 | Q | (4 − 2√2, 1) | | ||
| 47 | |||
| 48 | | Edges | Crease | Assignment | Step | | ||
| 49 | |---|---|---|---| | ||
| 50 | | e0–e7 | boundary, S → R′ → E → R → N → P → W → P′ → S | B | — | | ||
| 51 | | e8, e9, e10 | the diagonal: W–Q′, Q′–Q, Q–E | V | 1 | | ||
| 52 | | e11, e12 | Q–R (top half), Q–R′ (bottom half) | V, M | 2 | | ||
| 53 | | e13, e14 | Q′–P (top half), Q′–P′ (bottom half) | V, M | 3 | | ||
| 54 | | e15 | P′–R′, the front apex flap | M | 4 | | ||
| 55 | | e16 | P–R, the back apex flap | M | 6 | | ||
| 56 | |||
| 57 | Faces, counterclockwise: f0 [P′, S, R′] (front apex flap), f1 [P′, R′, Q, Q′] | ||
| 58 | (front body), f2 [R′, E, Q] and f6 [Q, E, R] (the right corner flap, front and | ||
| 59 | back layers), f3 [W, P′, Q′] and f4 [W, Q′, P] (the left corner flap), f5 | ||
| 60 | [Q′, Q, R, P] (back body), f7 [P, R, N] (back apex flap). | ||
| 61 | |||
| 62 | Every crease ends on the boundary or at Q or Q′ on the diagonal, so no | ||
| 63 | subdivision edges are needed. Q and Q′ are degree-4 vertices with sectors | ||
| 64 | 67.5°, 112.5°, 112.5°, 67.5° and three valleys to one mountain. | ||
| 65 | |||
| 66 | The bottom half's creases are mountains because that half is turned face-down | ||
| 67 | by step 1: steps 2–4 fold toward the viewer, which is a valley seen from the | ||
| 68 | front and a mountain on the bottom half's own top side. Step 6 folds the back | ||
| 69 | apex flap toward the viewer after the turn-over, when its top side faces away. | ||
| 70 | |||
| 71 | ## Sequence | ||
| 72 | |||
| 73 | 1. Valley fold S up to N along the diagonal (named crease e9; e8 and e10 lie | ||
| 74 | on its line and fold with it). | ||
| 75 | 2. Valley fold the right corner E across to P, through both layers (e11; e12 | ||
| 76 | folds with it). The right corner goes first. | ||
| 77 | 3. Valley fold the left corner W across to R, over the first flap (e13 and | ||
| 78 | e14). Six layers where the corner flaps cross. | ||
| 79 | 4. Valley fold the front apex flap f0 down over the front along P–R (e15). | ||
| 80 | S lands on (1, 4 − 2√2). Seven layers. | ||
| 81 | 5. Turn over, about the vertical axis. | ||
| 82 | 6. Valley fold the back apex flap f7 down (e16). N lands on (1, 4 − 2√2). | ||
| 83 | Eight layers in the triangle P, R, (1, 4 − 2√2). | ||
| 84 | |||
| 85 | The apex flaps are folded down over the outside, not tucked into the pocket. | ||
| 86 | The model ends flat. Viewpoint: eye (0, 0, 1), up (0, 1, 0) throughout. | ||
| 87 | |||
| 88 | ## Layer-order overrides | ||
| 89 | |||
| 90 | None. Every step is a plain valley fold of one moving set onto the outside of | ||
| 91 | the stack, which is the case the compiler's guess (the moving set lands on the | ||
| 92 | side it arrives from, its own layers reversed) gets right. `foldc`'s | ||
| 93 | validation, the interpenetration check and `layerMotionDefects` pass with the | ||
| 94 | guessed orders, and the guessed stacks were checked by hand against the sequence: | ||
| 95 | after step 3, bottom to top along +z, f5, f1, f2, f6, f3, f4; step 4 puts f0 | ||
| 96 | on top of all of them; step 6 puts f7 on top of the turned-over stack. | ||