Commit e5aeeae2a6

e5aeeae2a6e7dcce71981d4ba91ee1e21fe336bc

parent: f8a2b36461

Verified · cmc

cmc <hello@cleberg.net> · 2026-10-22 21:06 UTC

Check pops for mesh interpenetration in every phase

Ref #7

Layout: unified · split

Packages/FoldKit/Tests/FoldCompilerTests/NonRigidTests.swift +2 −1
@@ -71,9 +71,10 @@ import FoldKitTestSupport
7171}
7272
7373@Test func nothingPassesThroughAnything() throws {
74 // in all three phases, on the render mesh
7475 let file = try compiled("reverse")
7576 let i = FoldInterpolator(file: file, step: try readSteps(file)[1])
76 #expect(meshInterpenetrations(i, samples: 64).filter { $0.t > 0.02 && $0.t < 0.98 }.isEmpty)
77 #expect(meshInterpenetrations(i, samples: 64).isEmpty)
7778}
7879
7980@Test func theTipLandsBetweenTheFlapsLayers() throws {
Packages/FoldKit/Tests/ModelsTests/CatalogueTests.swift +3 −2
@@ -70,14 +70,15 @@ import Notation
7070}
7171
7272@Test func everyFlaggedStepStaysWithinTheBound() throws {
73 // decision 0002: 10% largest edge strain on the render mesh, and nothing passes through anything
73 // decisions 0002 and 0003: 10% largest edge strain on the render mesh, and nothing passes
74 // through anything in any phase
7475 for file in try ModelLibrary.all() {
7576 for step in try readSteps(file) where step.nonRigid {
7677 let i = FoldInterpolator(file: file, step: step)
7778 let (lo, hi) = (step.pop!.phases.lowerBound, step.pop!.phases.upperBound)
7879 let worst = (0...128).map { strain(i.meshPositions(at: lo + Double($0) / 128 * (hi - lo)), mesh: i.mesh) }.max()!
7980 #expect(worst <= 0.10, "\(file.fileTitle ?? "?") step \(step.index)")
80 #expect(meshInterpenetrations(i, samples: 64).filter { $0.t > 0.02 && $0.t < 0.98 }.isEmpty)
81 #expect(meshInterpenetrations(i, samples: 64).isEmpty, "\(file.fileTitle ?? "?") step \(step.index)")
8182 }
8283 }
8384}