Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Advance stc_10 past cylindrical ambiguous outer blocker

Yuechen Li90ad82fa2ae8
diff --git a/Aetheris.Kernel.Core.Tests/Step242/Step242ConicalSurfaceRegressionTests.cs b/Aetheris.Kernel.Core.Tests/Step242/Step242ConicalSurfaceRegressionTests.cs
index a5d4b9a6..d5a42810 100644
--- a/Aetheris.Kernel.Core.Tests/Step242/Step242ConicalSurfaceRegressionTests.cs
+++ b/Aetheris.Kernel.Core.Tests/Step242/Step242ConicalSurfaceRegressionTests.cs
@@ -150,9 +150,9 @@ public sealed class Step242ConicalSurfaceRegressionTests
"No diagnostics.")]
[InlineData(
"testdata/step242/nist/STC/nist_stc_10_asme1_ap242-e2.stp",
- "importer-topology",
- "Importer.LoopRole.CylinderAmbiguousOuter",
- "Unable to choose a unique cylindrical outer loop")]
+ "tessellator",
+ "Viewer.Tessellation.PlanarNonConvexTriangulationFailed",
+ "Face 3 planar loop triangulation failed because the polygon is not simple.")]
public void Step242_NistTargets_AdvancePastCircleTrim_AndKeepDeterministicNextBlocker(
string relativePath,
string expectedLayer,
diff --git a/Aetheris.Kernel.Core/Step242/Step242Importer.cs b/Aetheris.Kernel.Core/Step242/Step242Importer.cs
index 68eb4667..5cc3adc4 100644
--- a/Aetheris.Kernel.Core/Step242/Step242Importer.cs
+++ b/Aetheris.Kernel.Core/Step242/Step242Importer.cs
@@ -1444,6 +1444,7 @@ public static class Step242Importer
const string containmentSource = "Importer.LoopRole.CylinderInnerContainmentFailed";
var infos = new List<CylindricalLoopInfo>(loops.Count);
+ var degenerate = new List<(LoopBuildData Loop, CylinderProjectionAnalysis Analysis)>(loops.Count);
var maxUniqueCount = 0;
var maxAbsArea = 0d;
foreach (var loop in loops)
@@ -1469,25 +1470,38 @@ public static class Step242Importer
if (uniqueCount < 3 || double.Abs(area) <= AreaEps)
{
+ degenerate.Add((loop, analysis));
continue;
}
infos.Add(new CylindricalLoopInfo(loop, projected, area, ComputePolygonCentroid(projected)));
}
- if (infos.Count == 0)
+ var fullRevolutionConstantAxial = degenerate
+ .Where(d => d.Analysis.Degeneracy == CylinderProjectionDegeneracy.FullRevolutionConstantAxial)
+ .OrderBy(d => d.Loop.LoopId.Value)
+ .ToArray();
+ var otherDegenerate = degenerate
+ .Where(d => d.Analysis.Degeneracy != CylinderProjectionDegeneracy.FullRevolutionConstantAxial)
+ .OrderBy(d => d.Loop.LoopId.Value)
+ .ToArray();
+
+ if (fullRevolutionConstantAxial.Length > 0 && (otherDegenerate.Length > 0 || infos.Count > 0))
{
- var degenerate = loops
- .Select(loop =>
- {
- var projected = ProjectLoopToCylinder(loop.Samples, cylinder);
- var uniqueCount = CountUniquePoints(projected, ContainmentEps);
- var area = ComputeSignedArea(projected);
- return (Loop: loop, Analysis: AnalyzeCylindricalProjection(uniqueCount, area, projected));
- })
- .OrderBy(d => d.Loop.LoopId.Value)
- .ToArray();
+ var normalizedMixedInners = infos
+ .OrderByDescending(i => double.Abs(i.SignedArea))
+ .ThenBy(i => i.Loop.LoopId.Value)
+ .Select(i => NormalizeLoopWinding(i.Loop, i.SignedArea, shouldBePositive: false));
+
+ var mixedOrdered = new List<LoopBuildData>(fullRevolutionConstantAxial.Length + otherDegenerate.Length + infos.Count);
+ mixedOrdered.AddRange(fullRevolutionConstantAxial.Select(d => d.Loop));
+ mixedOrdered.AddRange(otherDegenerate.Select(d => d.Loop));
+ mixedOrdered.AddRange(normalizedMixedInners);
+ return KernelResult<IReadOnlyList<LoopBuildData>>.Success(mixedOrdered);
+ }
+ if (infos.Count == 0)
+ {
if (degenerate.All(d => d.Analysis.Degeneracy == CylinderProjectionDegeneracy.FullRevolutionConstantAxial))
{
var canonical = degenerate
diff --git a/testdata/step242/manifests/nist.v0.report.json b/testdata/step242/manifests/nist.v0.report.json
index 92f6fef9..a6fe8516 100644
--- a/testdata/step242/manifests/nist.v0.report.json
+++ b/testdata/step242/manifests/nist.v0.report.json
@@ -117,7 +117,7 @@
"facePatches": 156,
"edgePolylines": 331
},
- "canonicalSha256": "a874ae135bd12d3cd9eed0b479853ca5db2146d93ff24fa106e6343cf7a25365"
+ "canonicalSha256": "29b2850267dd6755e96eb7f9f7a1f568b0da34ea5e273096f6a962ccbe746494"
},
{
"fileId": "testdata_step242_nist_FTC_nist_ftc_06_asme1_ap242-e2",
@@ -309,7 +309,7 @@
"facePatches": 144,
"edgePolylines": 310
},
- "canonicalSha256": "4f7b738853058eb8590b02aca67d6ce4e47988b7139282a20db88e21a40071fc"
+ "canonicalSha256": "ab158a7eb18ce3eabe4412821683c9eda11ab355b176792a699dbb89752b2859"
},
{
"fileId": "testdata_step242_nist_STC_nist_stc_07_asme1_ap242-e3",
@@ -388,18 +388,18 @@
"path": "testdata/step242/nist/STC/nist_stc_10_asme1_ap242-e2.stp",
"sizeBytes": 4807322,
"status": "importFail",
- "firstFailureLayer": "importer-topology",
+ "firstFailureLayer": "tessellator",
"firstDiagnostic": {
- "code": "ValidationFailed",
- "source": "Importer.LoopRole.CylinderAmbiguousOuter",
- "messagePrefix": "Unable to choose a unique cylindrical outer loop."
+ "code": "NotImplemented",
+ "source": "Viewer.Tessellation.PlanarNonConvexTriangulationFailed",
+ "messagePrefix": "Face 3 planar loop triangulation failed because the polygon is not simple."
},
"diagnosticCount": 1,
"exceptionEscaped": false,
"topologyCounts": {
- "vertices": 0,
- "edges": 0,
- "faces": 0
+ "vertices": 368,
+ "edges": 551,
+ "faces": 256
},
"tessellationCounts": {
"facePatches": 0,