From dcfb267ac70587961863bc247c933d3b58fe5210 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 25 Sep 2026 18:15:28 +0200 Subject: [PATCH] Fix the checkerboard fixture's open-boundary contamination The 4x4x4 pure-checkerboard field had no fully-interior cell: every active cell bordered the array edge, so some crossing edges lost a quad to the open- boundary rule and edge usage came out odd (observed: all-3) for reasons unrelated to the ambiguity the test means to exercise. Wrapped the checkerboard in a one-sample uniform-outside margin (5x5x5 grid, checkerboard only on samples 1..3) so every crossing edge under test keeps all four surrounding cells in range, isolating the even-but-not-2 claim from open-boundary effects. Co-Authored-By: Claude Sonnet 5 --- tests/GameCult.Geometry.Tests/SurfaceNetsTests.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/GameCult.Geometry.Tests/SurfaceNetsTests.cs b/tests/GameCult.Geometry.Tests/SurfaceNetsTests.cs index 9b846ad1..fe550146 100644 --- a/tests/GameCult.Geometry.Tests/SurfaceNetsTests.cs +++ b/tests/GameCult.Geometry.Tests/SurfaceNetsTests.cs @@ -175,12 +175,16 @@ namespace GameCult.Geometry.Tests [Test] public void An_ambiguous_checkerboard_field_has_even_but_not_necessarily_manifold_edge_usage() { - var samples = new float[4, 4, 4]; - for (var x = 0; x < 4; x++) - for (var y = 0; y < 4; y++) - for (var z = 0; z < 4; z++) + // A checkerboard pattern with a one-sample uniform-outside margin, so every crossing + // edge this exercises has all four surrounding cells in range: any odd usage would be + // a real non-manifold artifact of the ambiguity, not an open-boundary side effect. + var samples = new float[5, 5, 5]; + for (var x = 0; x < 5; x++) + for (var y = 0; y < 5; y++) + for (var z = 0; z < 5; z++) { - samples[x, y, z] = ((x + y + z) % 2 == 0) ? -1f : 1f; + var interior = x is >= 1 and <= 3 && y is >= 1 and <= 3 && z is >= 1 and <= 3; + samples[x, y, z] = interior ? (((x + y + z) % 2 == 0) ? -1f : 1f) : 5f; } var mesh = CultGeometrySurfaceNets.Extract(samples);