Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
H6 decouple AP242 accuracy contracts from tessellation
Yuechen Li08295c82b51a
diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242CorpusManifestGateTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242CorpusManifestGateTests.csindex 393db5e1..c5e52d46 100644--- a/Aetheris.Kernel.Core.Tests/Step242/Step242CorpusManifestGateTests.cs+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242CorpusManifestGateTests.cs@@ -11,7 +11,7 @@ public sealed class Step242CorpusManifestGateTestsAssert.Equal("1", manifest.Version);var entries = manifest.Entries.OrderBy(e => e.Path, StringComparer.Ordinal).ToArray();- var reports = entries.Select(Step242CorpusManifestRunner.RunOne).ToArray();+ var reports = entries.Select(entry => Step242CorpusManifestRunner.RunOne(entry)).ToArray();Assert.All(reports, r => Assert.False(r.ExceptionEscaped));@@ -86,7 +86,7 @@ public sealed class Step242CorpusManifestGateTests{var manifest = Step242CorpusManifestRunner.LoadManifest("testdata/step242/manifests/v0.corpus.json");var blockerEntry = manifest.Entries.Single(e => e.Id == "exp_cylinder_hole_unsupported");- var blockerReport = Step242CorpusManifestRunner.RunOne(blockerEntry);+ var blockerReport = Step242CorpusManifestRunner.RunOne(blockerEntry, includeDisplayAudit: true);Assert.Equal("success", blockerReport.Status);Assert.Equal(string.Empty, blockerReport.FirstFailureLayer);Assert.Equal("pickerBlockedByTessellationSkip", blockerReport.DisplayStatus);@@ -94,7 +94,7 @@ public sealed class Step242CorpusManifestGateTestsAssert.Equal("Audit.Picker", blockerReport.DisplayFirstDiagnostic.Source);var successEntry = manifest.Entries.Single(e => e.Id == "gen_box_v0");- var successReport = Step242CorpusManifestRunner.RunOne(successEntry);+ var successReport = Step242CorpusManifestRunner.RunOne(successEntry, includeDisplayAudit: true);Assert.Equal("success", successReport.Status);Assert.Equal(string.Empty, successReport.FirstFailureLayer);Assert.Equal("success", successReport.DisplayStatus);diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242CorpusManifestRunner.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242CorpusManifestRunner.csindex 0cbe7bfc..dfc65d23 100644--- a/Aetheris.Kernel.Core.Tests/Step242/Step242CorpusManifestRunner.cs+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242CorpusManifestRunner.cs@@ -34,7 +34,7 @@ internal static class Step242CorpusManifestRunner{var reportEntries = entries.OrderBy(e => e.Path, StringComparer.Ordinal)- .Select(RunOne)+ .Select(entry => RunOne(entry)).ToArray();var report = JsonSerializer.Serialize(reportEntries, new JsonSerializerOptions@@ -46,7 +46,7 @@ internal static class Step242CorpusManifestRunnerreturn NormalizeLf(report) + "\n";}- public static Step242CorpusReportEntry RunOne(Step242CorpusManifestEntry entry)+ public static Step242CorpusReportEntry RunOne(Step242CorpusManifestEntry entry, bool includeDisplayAudit = false){var fullPath = Path.Combine(RepoRoot(), entry.Path.Replace('/', Path.DirectorySeparatorChar));var text = File.ReadAllText(fullPath, Encoding.UTF8);@@ -73,7 +73,9 @@ internal static class Step242CorpusManifestRunnerreturn BuildAp242Failure(entry, sizeBytes, "exporter", export.Diagnostics, body);}- var displayAudit = RunDisplayAudit(body);+ var displayAudit = includeDisplayAudit+ ? RunDisplayAudit(body)+ : DisplayAuditResult.NotRun;return new Step242CorpusReportEntry(entry.Id,entry.Path,@@ -384,4 +386,12 @@ internal sealed record DisplayAuditResult(string FirstFailureLayer,Step242AuditDiagnostic FirstDiagnostic,int DiagnosticCount,- Step242TessellationCounts TessellationCounts);+ Step242TessellationCounts TessellationCounts)+{+ public static DisplayAuditResult NotRun { get; } = new(+ "notRun",+ string.Empty,+ new Step242AuditDiagnostic("Unknown", "Audit.None", "Not run."),+ 0,+ Step242TessellationCounts.Zero);+}diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242CylinderTrimDualSingleCoedgeClosedCircleRegressionTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242CylinderTrimDualSingleCoedgeClosedCircleRegressionTests.csindex 4fb3263d..217f242b 100644--- a/Aetheris.Kernel.Core.Tests/Step242/Step242CylinderTrimDualSingleCoedgeClosedCircleRegressionTests.cs+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242CylinderTrimDualSingleCoedgeClosedCircleRegressionTests.cs@@ -47,8 +47,8 @@ public sealed class Step242CylinderTrimDualSingleCoedgeClosedCircleRegressionTespublic void Step242_Ftc11_AdvancesPastCylinderTrimDegenerate_ToNextExplicitBlocker_Deterministically(){const string relativePath = "testdata/step242/nist/FTC/nist_ftc_11_asme1_ap242-e2.stp";- var first = Step242CorpusManifestRunner.RunOne(new Step242CorpusManifestEntry("ftc11", relativePath, "nist-regression", null, null, null, null, null));- var second = Step242CorpusManifestRunner.RunOne(new Step242CorpusManifestEntry("ftc11", relativePath, "nist-regression", null, null, null, null, null));+ var first = Step242CorpusManifestRunner.RunOne(new Step242CorpusManifestEntry("ftc11", relativePath, "nist-regression", null, null, null, null, null), includeDisplayAudit: true);+ var second = Step242CorpusManifestRunner.RunOne(new Step242CorpusManifestEntry("ftc11", relativePath, "nist-regression", null, null, null, null, null), includeDisplayAudit: true);Assert.Equal("success", first.Status);Assert.Equal(string.Empty, first.FirstFailureLayer);diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242NistAuditHarnessTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242NistAuditHarnessTests.csindex 85a68e4a..252f8283 100644--- a/Aetheris.Kernel.Core.Tests/Step242/Step242NistAuditHarnessTests.cs+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242NistAuditHarnessTests.cs@@ -51,7 +51,7 @@ public sealed class Step242NistAuditHarnessTests}[Fact]- public void NistCorpus_RepresentativeDisplayBlocker_DoesNotFailAp242Lane()+ public void NistCorpus_RepresentativeAp242Lane_DoesNotRequireDisplayAudit(){const string relativePath = "testdata/step242/nist/FTC/nist_ftc_11_asme1_ap242-e2.stp";var entry = BuildNistEntry(relativePath);@@ -59,6 +59,22 @@ public sealed class Step242NistAuditHarnessTestsvar first = Step242CorpusManifestRunner.RunOne(entry);var second = Step242CorpusManifestRunner.RunOne(entry);+ Assert.Equal("success", first.Status);+ Assert.Equal(string.Empty, first.FirstFailureLayer);+ Assert.Equal("notRun", first.DisplayStatus);+ Assert.Equal(string.Empty, first.DisplayFirstFailureLayer);+ Assert.Equal(first.DisplayStatus, second.DisplayStatus);+ }++ [Fact]+ public void NistCorpus_RepresentativeDisplayBlocker_RemainsVisibleInDisplayLane()+ {+ const string relativePath = "testdata/step242/nist/FTC/nist_ftc_11_asme1_ap242-e2.stp";+ var entry = BuildNistEntry(relativePath);++ var first = Step242CorpusManifestRunner.RunOne(entry, includeDisplayAudit: true);+ var second = Step242CorpusManifestRunner.RunOne(entry, includeDisplayAudit: true);+Assert.Equal("success", first.Status);Assert.Equal(string.Empty, first.FirstFailureLayer);Assert.Equal("pickerBlockedByTessellationSkip", first.DisplayStatus);@@ -111,7 +127,6 @@ public sealed class Step242NistAuditHarnessTestsDiagnosticCount: r.DiagnosticCount,ExceptionEscaped: r.ExceptionEscaped,TopologyCounts: r.TopologyCounts,- TessellationCounts: r.TessellationCounts,CanonicalSha256: r.CanonicalSha256);}@@ -144,6 +159,5 @@ public sealed class Step242NistAuditHarnessTestsint DiagnosticCount,bool ExceptionEscaped,Step242TopologyCounts TopologyCounts,- Step242TessellationCounts TessellationCounts,string? CanonicalSha256);}diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242RoundTripReliabilityTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242RoundTripReliabilityTests.csindex 4d89b33c..7a1e3072 100644--- a/Aetheris.Kernel.Core.Tests/Step242/Step242RoundTripReliabilityTests.cs+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242RoundTripReliabilityTests.cs@@ -34,11 +34,13 @@ public sealed class Step242RoundTripReliabilityTestsAssertTopologyInvariantMatch(original.Value, imported);AssertGeometryKindsAreSubset(imported);+ Assert.Equal(6, imported.Topology.Faces.Count());+ Assert.Equal(12, imported.Topology.Edges.Count());var tessellation = BrepDisplayTessellator.Tessellate(imported);Assert.True(tessellation.IsSuccess);- Assert.Equal(6, tessellation.Value.FacePatches.Count);- Assert.Equal(12, tessellation.Value.EdgePolylines.Count);+ Assert.NotEmpty(tessellation.Value.FacePatches);+ Assert.NotEmpty(tessellation.Value.EdgePolylines);var ray = new Ray3D(new Point3D(0d, 0d, 6d), Direction3D.Create(new Vector3D(0d, 0d, -1d)));var pick = BrepPicker.Pick(imported, tessellation.Value, ray, PickQueryOptions.Default with { NearestOnly = true });diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242TessellationRobustnessTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242TessellationRobustnessTests.csindex 8296f41f..3d96ee5e 100644--- a/Aetheris.Kernel.Core.Tests/Step242/Step242TessellationRobustnessTests.cs+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242TessellationRobustnessTests.cs@@ -81,6 +81,7 @@ public sealed class Step242TessellationRobustnessTests}[Fact]+ [Trait("Category", "SlowCorpus")]public void Step242_Tessellate_UnsupportedComplexPlanarMultiLoop_DoesNotFallbackToOuterLoopFill(){var text = LoadFixture("testdata/step242/nist/CTC/nist_ctc_02_asme1_ap242-e2.stp");diff --git a/testdata/step242/manifests/nist.v0.report.json b/testdata/step242/manifests/nist.v0.report.jsonindex ad0e49da..cb16d447 100644--- a/testdata/step242/manifests/nist.v0.report.json+++ b/testdata/step242/manifests/nist.v0.report.json@@ -17,10 +17,6 @@"edges": 318,"faces": 117},- "tessellationCounts": {- "facePatches": 117,- "edgePolylines": 318- },"canonicalSha256": "dc035a418ef98d85aa31f20cfd1582cc5ad3c44159a8018a1b70b87344abcd1f"},{@@ -41,10 +37,6 @@"edges": 1416,"faces": 637},- "tessellationCounts": {- "facePatches": 637,- "edgePolylines": 1416- },"canonicalSha256": "d49fd736ad41ba423a0ee40e73f99edeed13ff93dec4985e14c9bd59382e612e"},{@@ -65,10 +57,6 @@"edges": 354,"faces": 120},- "tessellationCounts": {- "facePatches": 120,- "edgePolylines": 354- },"canonicalSha256": "8d32fe4a6f88f6a6de325f5126475fe49bb56c4dd4e2e49cff8d68474838abb2"},{@@ -89,10 +77,6 @@"edges": 1110,"faces": 484},- "tessellationCounts": {- "facePatches": 484,- "edgePolylines": 1110- },"canonicalSha256": "3103da3bc3e8ad82026a4cd1debfea1ac2978ced50fb4a722ec82d732b1882ae"},{@@ -113,10 +97,6 @@"edges": 331,"faces": 156},- "tessellationCounts": {- "facePatches": 156,- "edgePolylines": 331- },"canonicalSha256": "29b2850267dd6755e96eb7f9f7a1f568b0da34ea5e273096f6a962ccbe746494"},{@@ -137,10 +117,6 @@"edges": 476,"faces": 187},- "tessellationCounts": {- "facePatches": 187,- "edgePolylines": 476- },"canonicalSha256": "4c9eee2cc02bff8f4a0eb27f69651214a773d03acab2ed5322cc396ada0592ae"},{@@ -161,10 +137,6 @@"edges": 871,"faces": 306},- "tessellationCounts": {- "facePatches": 306,- "edgePolylines": 871- },"canonicalSha256": "e88e432d9cae16a3b457d1ba3ce3ccddcb2a64e3f740d543c3d5cd570026fa0a"},{@@ -185,10 +157,6 @@"edges": 10083,"faces": 3361},- "tessellationCounts": {- "facePatches": 3361,- "edgePolylines": 10083- },"canonicalSha256": "02272208c101eede63651658006f4b483dbabe4d7148654a12dc9e01f8509b19"},{@@ -209,10 +177,6 @@"edges": 616,"faces": 247},- "tessellationCounts": {- "facePatches": 247,- "edgePolylines": 616- },"canonicalSha256": "bdc8e56bfd10539aa2d73c2bdecbcc94d7ffc3821517ffb77687f316590cd213"},{@@ -233,10 +197,6 @@"edges": 458,"faces": 159},- "tessellationCounts": {- "facePatches": 159,- "edgePolylines": 458- },"canonicalSha256": "25b4cf509c5d90b49db0c212d9c8bc08e1db96011e424803a65593b3f275b30a"},{@@ -257,10 +217,6 @@"edges": 813,"faces": 268},- "tessellationCounts": {- "facePatches": 268,- "edgePolylines": 813- },"canonicalSha256": "72852a798345f6815b5d56397e942efe70ca47e8c7c216770170fe06fa2ced11"},{@@ -281,10 +237,6 @@"edges": 104,"faces": 42},- "tessellationCounts": {- "facePatches": 42,- "edgePolylines": 104- },"canonicalSha256": "d941e5707a91b7a8be0049455af81c42e2499cb620c71875435175e1cccf8426"},{@@ -305,10 +257,6 @@"edges": 310,"faces": 144},- "tessellationCounts": {- "facePatches": 144,- "edgePolylines": 310- },"canonicalSha256": "ab158a7eb18ce3eabe4412821683c9eda11ab355b176792a699dbb89752b2859"},{@@ -329,10 +277,6 @@"edges": 871,"faces": 306},- "tessellationCounts": {- "facePatches": 306,- "edgePolylines": 871- },"canonicalSha256": "639f0d562dc98d38b3ea323e3dc81cad82cbe9d13e8ecf2a8d6db6703183a1eb"},{@@ -353,10 +297,6 @@"edges": 709,"faces": 271},- "tessellationCounts": {- "facePatches": 271,- "edgePolylines": 709- },"canonicalSha256": "df51040864fadab2d106c45a9610a20edc5944f518c90be82e0e7c734457ae35"},{@@ -377,10 +317,6 @@"edges": 392,"faces": 125},- "tessellationCounts": {- "facePatches": 125,- "edgePolylines": 392- },"canonicalSha256": "8ac9846765fabbae05bab97ca0e540e10f58cddf4b1d5daf052fcbb7263c71a5"},{@@ -401,10 +337,6 @@"edges": 551,"faces": 256},- "tessellationCounts": {- "facePatches": 256,- "edgePolylines": 551- },"canonicalSha256": "3703906cba81c4fba8e935a298fcdb89bbd74c151552ea0d1324eccf429e98a9"}]