Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

EDGE-X2.2: admit safe nonorthogonal concave planar AirChamfer lab patch

Yuechen Li7a0e9e71c1f4
diff --git a/Aetheris.Firmament.FrictionLab/CIRLab/AirChamferPatchLab.cs b/Aetheris.Firmament.FrictionLab/CIRLab/AirChamferPatchLab.cs
index b2319081..8fb35e18 100644
--- a/Aetheris.Firmament.FrictionLab/CIRLab/AirChamferPatchLab.cs
+++ b/Aetheris.Firmament.FrictionLab/CIRLab/AirChamferPatchLab.cs
@@ -10,6 +10,7 @@ public sealed record AirChamferPatchRow(string CaseName, LabProfileStatus Status
public static class AirChamferPatchLab
{
private const double Tol = 1e-9;
+ private const double MinStableNonOrthogonalAngleDeg = 12d;
public static readonly IReadOnlySet<string> AllowedRecommendations = new HashSet<string>(StringComparer.Ordinal)
{
"air-chamfer-patch-constructive-proof-succeeded",
@@ -34,6 +35,8 @@ public static class AirChamferPatchLab
[
Run(Canonical(10d, 1d)),
Run(Canonical(10d, 2d)),
+ Run(Canonical(10d, 1d) with { CaseName = "nonorthogonal-safe", FaceBNormal = Vector3.Normalize(new Vector3(1f, 1f, 0f)) }),
+ Run(Canonical(10d, 1d) with { CaseName = "nonorthogonal-shallow-unstable", FaceBNormal = Vector3.Normalize(new Vector3(1f, 0.05f, 0f)) }),
Run(Canonical(7.5d, 1d)),
Run(Canonical(10d, 0d) with { CaseName = "invalid-distance-zero" }),
Run(Canonical(10d, double.NaN) with { CaseName = "invalid-distance-nan" }),
@@ -65,8 +68,13 @@ public static class AirChamferPatchLab
var offA = Vector3.Cross(eDir, nA);
var offB = Vector3.Cross(nB, eDir);
- if (!TryNormalize(offA, out offA) || !TryNormalize(offB, out offB) || Math.Abs(Vector3.Dot(offA, offB)) >= 1d - 1e-8)
- return Reject(c.CaseName, d, "edge-x2-invalid-face-adjacency-rejected");
+ if (!TryNormalize(offA, out offA) || !TryNormalize(offB, out offB))
+ return Reject(c.CaseName, d, "edge-x2-2-nonorthogonal-patch-rejected:offset-direction-invalid");
+ var nonOrthAngle = AngleDeg(offA, offB);
+ if (!Finite(nonOrthAngle))
+ return Reject(c.CaseName, d, "edge-x2-2-nonorthogonal-patch-rejected:offset-angle-non-finite");
+ if (Math.Abs(Vector3.Dot(offA, offB)) >= 1d - 1e-8 || nonOrthAngle < MinStableNonOrthogonalAngleDeg)
+ return Reject(c.CaseName, d, "edge-x2-2-nonorthogonal-patch-rejected:offset-angle-unstable");
d.Add("edge-x2-concave-planar-edge-accepted");
@@ -76,6 +84,7 @@ public static class AirChamferPatchLab
var b0 = c.EdgeStart + offB * (float)c.ChamferDistance;
var b1 = c.EdgeEnd + offB * (float)c.ChamferDistance;
d.Add("edge-x2-offset-curve-b-constructed");
+ d.Add("edge-x2-2-nonorthogonal-offset-curves-constructed");
var verts = new[] { a0, a1, b1, b0 };
var normal = Vector3.Cross(a1 - a0, b0 - a0);
@@ -83,8 +92,12 @@ public static class AirChamferPatchLab
return Reject(c.CaseName, d, "edge-x2-invalid-face-adjacency-rejected");
var area = 0.5d * Vector3.Cross(a1 - a0, b1 - a0).Length() + 0.5d * Vector3.Cross(b1 - a0, b0 - a0).Length();
+ if (!Finite(area) || area <= Tol)
+ return Reject(c.CaseName, d, "edge-x2-2-nonorthogonal-patch-rejected:area-degenerate");
var artifact = new AirChamferPatchArtifact(verts, [(0, 1), (1, 2), (2, 3), (3, 0)], normal, area);
d.Add("edge-x2-ruled-chamfer-patch-constructed");
+ d.Add("edge-x2-2-nonorthogonal-patch-constructed");
+ d.Add("edge-x2-2-nonorthogonal-patch-planarity-validated");
d.Add("edge-x2-patch-topology-captured");
d.Add("edge-x2-step-smoke-deferred:open-patch-export-unsupported");
@@ -108,4 +121,10 @@ public static class AirChamferPatchLab
normalized = v / len;
return Finite(normalized);
}
+
+ private static double AngleDeg(Vector3 a, Vector3 b)
+ {
+ var dot = Math.Clamp(Vector3.Dot(a, b), -1f, 1f);
+ return Math.Acos(dot) * (180d / Math.PI);
+ }
}
diff --git a/Aetheris.Firmament.FrictionLab/CIRLab/AirChamferPolicyLab.cs b/Aetheris.Firmament.FrictionLab/CIRLab/AirChamferPolicyLab.cs
index c2dd80af..820345ba 100644
--- a/Aetheris.Firmament.FrictionLab/CIRLab/AirChamferPolicyLab.cs
+++ b/Aetheris.Firmament.FrictionLab/CIRLab/AirChamferPolicyLab.cs
@@ -30,6 +30,7 @@ public sealed record AirChamferPolicyRow(string CaseName, string Decision, AirCh
public static class AirChamferPolicyLab
{
private const double Tol = 1e-9;
+ private const double MinStablePlanarAngleDeg = 2d;
public static readonly IReadOnlySet<string> AllowedDecisions = new HashSet<string>(StringComparer.Ordinal)
{
"accept-air-chamfer-patch","fallback-legacy-chamfer","defer-nonorthogonal-policy","defer-convex-replacement-policy","defer-edge-chain-policy","defer-corner-policy","defer-unsupported-face-family","defer-legacy-dependent-topology","reject-invalid-distance","reject-invalid-edge","reject-invalid-face-adjacency","reject-ambiguous-classification"
@@ -38,7 +39,9 @@ public static class AirChamferPolicyLab
public static IReadOnlyList<AirChamferPolicyCase> Cases() =>
[
new("canonical-concave-planar", new(new(0,0,-5),new(0,0,5),new(1,0,0),new(0,1,0),1d,AirChamferFaceFamily.Planar,false,false,false,AirChamferRoutePreference.Auto,AirChamferClassificationExpectation.Concave,true), "accept-air-chamfer-patch"),
- new("nonorthogonal-concave-planar", new(new(0,0,-5),new(0,0,5),new(1,0,0),Vector3.Normalize(new Vector3(1,1,0)),1d,AirChamferFaceFamily.Planar,false,false,false,AirChamferRoutePreference.Auto,AirChamferClassificationExpectation.Concave,false), "defer-nonorthogonal-policy"),
+ new("nonorthogonal-concave-planar-safe", new(new(0,0,-5),new(0,0,5),new(1,0,0),Vector3.Normalize(new Vector3(1,1,0)),1d,AirChamferFaceFamily.Planar,false,false,false,AirChamferRoutePreference.Auto,AirChamferClassificationExpectation.Concave,false), "accept-air-chamfer-patch"),
+ new("nonorthogonal-concave-planar-shallow", new(new(0,0,-5),new(0,0,5),new(1,0,0),Vector3.Normalize(new Vector3(0.99f,0.1f,0f)),1d,AirChamferFaceFamily.Planar,false,false,false,AirChamferRoutePreference.Auto,AirChamferClassificationExpectation.Concave,false), "defer-nonorthogonal-policy"),
+ new("nonorthogonal-concave-planar-near-parallel", new(new(0,0,-5),new(0,0,5),new(1,0,0),new(1,0,0.000001f),1d,AirChamferFaceFamily.Planar,false,false,false,AirChamferRoutePreference.Auto,AirChamferClassificationExpectation.Concave,false), "reject-invalid-face-adjacency"),
new("convex-planar", new(new(0,0,-5),new(0,0,5),new(1,0,0),new(0,1,0),1d,AirChamferFaceFamily.Planar,false,false,false,AirChamferRoutePreference.Auto,AirChamferClassificationExpectation.Convex,true), "defer-convex-replacement-policy"),
new("edge-chain", new(new(0,0,-5),new(0,0,5),new(1,0,0),new(0,1,0),1d,AirChamferFaceFamily.Planar,true,false,false,AirChamferRoutePreference.Auto,AirChamferClassificationExpectation.Concave,true), "defer-edge-chain-policy"),
new("corner-chain", new(new(0,0,-5),new(0,0,5),new(1,0,0),new(0,1,0),1d,AirChamferFaceFamily.Planar,false,true,false,AirChamferRoutePreference.Auto,AirChamferClassificationExpectation.Concave,true), "defer-corner-policy"),
@@ -70,7 +73,11 @@ public static class AirChamferPolicyLab
else if (r.ClassificationExpectation == AirChamferClassificationExpectation.Convex) decision = "defer-convex-replacement-policy";
else if (r.LegacyDependency && r.RoutePreference == AirChamferRoutePreference.Legacy) decision = "fallback-legacy-chamfer";
else if (r.LegacyDependency) decision = "defer-legacy-dependent-topology";
- else if (!r.IsOrthogonalPlanarPair) decision = "defer-nonorthogonal-policy";
+ else if (!r.IsOrthogonalPlanarPair && !HasStableNonOrthogonalAdmissibility(r, out var nonOrthReason))
+ {
+ decision = nonOrthReason == "near-parallel" ? "reject-invalid-face-adjacency" : "defer-nonorthogonal-policy";
+ d.Add($"edge-x2-2-policy-nonorthogonal-concave-deferred:{nonOrthReason}");
+ }
else decision = "accept-air-chamfer-patch";
var score = Score(r, decision);
@@ -96,7 +103,9 @@ public static class AirChamferPolicyLab
if (decision == "accept-air-chamfer-patch")
{
d.Add("edge-x2-1-air-chamfer-patch-admitted");
- patch = AirChamferPatchLab.Run(AirChamferPatchLab.Canonical((r.EdgeEnd-r.EdgeStart).Length(), r.ChamferDistance));
+ if (!r.IsOrthogonalPlanarPair) d.Add("edge-x2-2-policy-nonorthogonal-concave-admitted");
+ var patchCase = new AirChamferPatchCase(c.CaseName, r.EdgeStart, r.EdgeEnd, r.FaceANormal!.Value, r.FaceBNormal!.Value, r.ChamferDistance);
+ patch = AirChamferPatchLab.Run(patchCase);
}
else if (decision.StartsWith("reject-", StringComparison.Ordinal)) d.Add($"edge-x2-1-air-chamfer-patch-rejected:{decision}");
else if (decision == "fallback-legacy-chamfer") d.Add("edge-x2-1-legacy-route-preferred:legacy-dependent-topology");
@@ -127,4 +136,16 @@ public static class AirChamferPolicyLab
var len = v.Length(); if (!float.IsFinite(len) || len <= Tol) { normalized = default; return false; }
normalized = v / len; return Finite(normalized);
}
+
+ private static bool HasStableNonOrthogonalAdmissibility(AirChamferPolicyRequest r, out string reason)
+ {
+ reason = "unsupported";
+ if (r.FaceANormal is null || r.FaceBNormal is null) { reason = "missing-face-normal"; return false; }
+ if (!TryNormalize(r.FaceANormal.Value, out var a) || !TryNormalize(r.FaceBNormal.Value, out var b)) { reason = "non-finite-normal"; return false; }
+ var angle = Math.Acos(Math.Clamp(Vector3.Dot(a, b), -1f, 1f)) * (180d / Math.PI);
+ if (!Finite(angle)) { reason = "non-finite-angle"; return false; }
+ if (angle < MinStablePlanarAngleDeg || (180d - angle) < MinStablePlanarAngleDeg) { reason = "near-parallel"; return false; }
+ if (angle < 20d) { reason = "shallow-angle-unstable"; return false; }
+ return true;
+ }
}
diff --git a/Aetheris.FrictionLab.Tests/CIRLab/AirChamferPatchLabTests.cs b/Aetheris.FrictionLab.Tests/CIRLab/AirChamferPatchLabTests.cs
index b13f5191..d9b88daa 100644
--- a/Aetheris.FrictionLab.Tests/CIRLab/AirChamferPatchLabTests.cs
+++ b/Aetheris.FrictionLab.Tests/CIRLab/AirChamferPatchLabTests.cs
@@ -1,3 +1,4 @@
+using System.Numerics;
using Aetheris.Firmament.FrictionLab.CIRLab;
namespace Aetheris.FrictionLab.Tests.CIRLab;
@@ -51,7 +52,7 @@ public sealed class AirChamferPatchLabTests
var c = AirChamferPatchLab.Canonical() with { FaceBNormal = new(1f, 0f, 0f) };
var row = AirChamferPatchLab.Run(c);
Assert.Equal(LabProfileStatus.Failed, row.Status);
- Assert.Contains("edge-x2-invalid-face-adjacency-rejected", row.Diagnostics);
+ Assert.Contains(row.Diagnostics, x => x is "edge-x2-invalid-face-adjacency-rejected" or "edge-x2-2-nonorthogonal-patch-rejected:offset-angle-unstable");
Assert.DoesNotContain("edge-x2-ruled-chamfer-patch-constructed", row.Diagnostics);
}
@@ -62,6 +63,20 @@ public sealed class AirChamferPatchLabTests
Assert.Contains(row.Recommendation, AirChamferPatchLab.AllowedRecommendations);
}
+ [Fact]
+ public void NonOrthogonalSafe_ConstructsPlanarPositivePatch()
+ {
+ var c = AirChamferPatchLab.Canonical() with { CaseName = "nonorthogonal-safe", FaceBNormal = Vector3.Normalize(new Vector3(1f, 1f, 0f)) };
+ var row = AirChamferPatchLab.Run(c);
+ Assert.Equal(LabProfileStatus.Succeeded, row.Status);
+ Assert.True(row.Topology.PatchProduced);
+ Assert.Equal(4, row.Topology.CoedgeCount);
+ Assert.True(row.Artifact!.Area > 0d);
+ Assert.Contains("edge-x2-2-nonorthogonal-offset-curves-constructed", row.Diagnostics);
+ Assert.Contains("edge-x2-2-nonorthogonal-patch-planarity-validated", row.Diagnostics);
+ Assert.Contains("edge-x2-no-3d-boolean-used", row.Diagnostics);
+ }
+
private static string Serialize(AirChamferPatchRow row)
=> $"{row.CaseName}|{row.Status}|{row.OffsetCurveAConstructed}|{row.OffsetCurveBConstructed}|{row.Topology.PatchProduced}|{row.Topology.VertexCount}|{row.Topology.EdgeCount}|{row.Topology.FaceCount}|{row.Topology.PlanarFaceCount}|{row.Topology.BoundaryLoopCount}|{row.Topology.CoedgeCount}|{row.Recommendation}|{string.Join(',', row.Diagnostics)}";
}
diff --git a/Aetheris.FrictionLab.Tests/CIRLab/AirChamferPolicyLabTests.cs b/Aetheris.FrictionLab.Tests/CIRLab/AirChamferPolicyLabTests.cs
index e5de8fb6..a0e46bc9 100644
--- a/Aetheris.FrictionLab.Tests/CIRLab/AirChamferPolicyLabTests.cs
+++ b/Aetheris.FrictionLab.Tests/CIRLab/AirChamferPolicyLabTests.cs
@@ -22,7 +22,9 @@ public sealed class AirChamferPolicyLabTests
}
[Theory]
- [InlineData("nonorthogonal-concave-planar", "defer-nonorthogonal-policy")]
+ [InlineData("nonorthogonal-concave-planar-safe", "accept-air-chamfer-patch")]
+ [InlineData("nonorthogonal-concave-planar-shallow", "defer-nonorthogonal-policy")]
+ [InlineData("nonorthogonal-concave-planar-near-parallel", "reject-invalid-face-adjacency")]
[InlineData("convex-planar", "defer-convex-replacement-policy")]
[InlineData("edge-chain", "defer-edge-chain-policy")]
[InlineData("corner-chain", "defer-corner-policy")]
@@ -52,6 +54,16 @@ public sealed class AirChamferPolicyLabTests
}
}
+ [Fact]
+ public void NonOrthogonalAcceptedCase_EmitsNo3dBooleanDiagnostic()
+ {
+ var result = AirChamferPolicyLab.Evaluate(AirChamferPolicyLab.Cases().Single(x => x.CaseName == "nonorthogonal-concave-planar-safe"));
+ Assert.Equal("accept-air-chamfer-patch", result.Decision.Decision);
+ Assert.NotNull(result.PatchRow);
+ Assert.Contains("edge-x2-no-3d-boolean-used", result.PatchRow!.Diagnostics);
+ Assert.Contains("edge-x2-2-policy-nonorthogonal-concave-admitted", result.Diagnostics);
+ }
+
private static string Serialize(AirChamferPolicyRow row)
=> $"{row.CaseName}|{row.Decision}|{row.Score.GeometrySupportScore}|{row.Score.TopologyRiskScore}|{row.Score.OffsetStabilityScore}|{row.Score.CornerPolicyScore}|{row.Score.LegacyDependencyScore}|{row.Score.OverallUtility}|{row.Recommendation}|{row.PatchConstructed}|{string.Join(',', row.Diagnostics)}";
}
diff --git a/docs/frictionlab/edge-x2-1-air-chamfer-policy-scaffold-lab.md b/docs/frictionlab/edge-x2-1-air-chamfer-policy-scaffold-lab.md
index f9cd1021..9d6550f7 100644
--- a/docs/frictionlab/edge-x2-1-air-chamfer-policy-scaffold-lab.md
+++ b/docs/frictionlab/edge-x2-1-air-chamfer-policy-scaffold-lab.md
@@ -65,3 +65,5 @@ This lab is policy-shaped scaffolding intended for future production integration
Based on policy results:
- EDGE-X2.2 non-orthogonal concave policy+geometry lab, **or**
- EDGE-X3 convex planar replacement policy lab.
+
+> Update (EDGE-X2.2): safe non-orthogonal concave planar single-edge fixtures are now admitted in lab policy when angle/offset admissibility checks pass; shallow/near-parallel cases remain deferred/rejected with explicit diagnostics.
diff --git a/docs/frictionlab/edge-x2-2-nonorthogonal-concave-air-chamfer-policy-patch-lab.md b/docs/frictionlab/edge-x2-2-nonorthogonal-concave-air-chamfer-policy-patch-lab.md
new file mode 100644
index 00000000..429d0400
--- /dev/null
+++ b/docs/frictionlab/edge-x2-2-nonorthogonal-concave-air-chamfer-policy-patch-lab.md
@@ -0,0 +1,85 @@
+# EDGE-X2.2 — Non-orthogonal concave planar AirChamfer policy+patch lab
+
+## Purpose and scope
+EDGE-X2.2 extends the EDGE-X2.1 lab-only policy scaffold to admit a bounded non-orthogonal concave planar single-edge case, then constructs a deterministic ruled planar chamfer patch artifact for accepted cases.
+
+This remains **lab-only**:
+- no production route changes,
+- no public API changes,
+- no STEP importer/exporter changes,
+- no Boolean core changes,
+- no production chamfer/fillet behavior changes.
+
+## References
+- `docs/edge-a0-air-edge-sweep-fillet-chamfer-audit.md`
+- `docs/frictionlab/edge-x1-chamfer-fillet-capability-matrix.md`
+- `docs/frictionlab/edge-x2-concave-planar-chamfer-patch-lab.md`
+- `docs/frictionlab/edge-x2-1-air-chamfer-policy-scaffold-lab.md`
+
+## Why this expansion
+EDGE-X2 proved canonical orthogonal concave planar patch construction and EDGE-X2.1 proved deterministic policy/score gating. Non-orthogonal concave planar single-edge chamfer is the next bounded expansion because it exercises realistic planar adjacency variation while still avoiding convex replacement, chains/corners, and production topology rewrites.
+
+## Policy changes in EDGE-X2.2
+- Safe non-orthogonal concave planar requests are now admissible (`accept-air-chamfer-patch`).
+- Shallow/unstable non-orthogonal cases defer (`defer-nonorthogonal-policy`).
+- Near-parallel adjacency remains rejected as invalid face adjacency (`reject-invalid-face-adjacency`).
+- Convex, chain, corner, unsupported face family, and legacy-dependent cases remain deferred/fallback/rejected as before.
+
+Deterministic score fields are preserved:
+- `GeometrySupportScore`
+- `TopologyRiskScore`
+- `OffsetStabilityScore`
+- `CornerPolicyScore`
+- `LegacyDependencyScore`
+- `OverallUtility`
+
+## Angle/offset admissibility rules
+- face normals must be finite and unit-normalizable,
+- edge direction must be finite and non-zero,
+- planar adjacency must not be parallel/anti-parallel within tolerance,
+- non-orthogonal face-normal angle must be stable (not shallow / not near-parallel),
+- offset directions must be finite/normalizable,
+- patch area must be finite and strictly positive above tolerance.
+
+## Fixtures and results
+Added fixtures include:
+- `nonorthogonal-concave-planar-safe` => accepted.
+- `nonorthogonal-concave-planar-shallow` => deferred with explicit policy diagnostic.
+- `nonorthogonal-concave-planar-near-parallel` => rejected as invalid adjacency.
+- existing `ambiguous-classification` => rejected.
+
+## Topology/artifact findings
+For accepted non-orthogonal cases, patch artifact remains deterministic:
+- vertices: 4
+- edges: 4
+- faces: 1
+- planar faces: 1
+- boundary loops: 1
+- coedges: 4
+
+Diagnostics include:
+- `edge-x2-2-nonorthogonal-offset-curves-constructed`
+- `edge-x2-2-nonorthogonal-patch-constructed`
+- `edge-x2-2-nonorthogonal-patch-planarity-validated`
+
+## STEP/export status
+Open patch STEP export remains deferred (`edge-x2-step-smoke-deferred:open-patch-export-unsupported`). No exporter/importer behavior changed.
+
+## No-3D-Boolean guarantee
+Accepted geometry paths still emit `edge-x2-no-3d-boolean-used` and policy rows still emit `edge-x2-1-no-3d-boolean-used`.
+
+## Invalid/deferred cases
+- Invalid distance/edge/face adjacency remain deterministic rejects.
+- Ambiguous classification remains deterministic reject.
+- Shallow unstable non-orthogonal remains deterministic defer before geometry path commitment.
+
+## Non-goals
+- convex replacement geometry
+- fillet geometry
+- edge chains/corner chains
+- triangle migration retry
+- sketch solver/clipping engine/NURBS/freeform
+- production AirEdgeSweep chamfer routing
+
+## Recommendation for next milestone
+Progress to convex planar replacement policy lab (EDGE-X3 lane) while keeping concave non-orthogonal proven path bounded and deterministic.
diff --git a/docs/frictionlab/edge-x2-concave-planar-chamfer-patch-lab.md b/docs/frictionlab/edge-x2-concave-planar-chamfer-patch-lab.md
index d7f4e217..d82197f6 100644
--- a/docs/frictionlab/edge-x2-concave-planar-chamfer-patch-lab.md
+++ b/docs/frictionlab/edge-x2-concave-planar-chamfer-patch-lab.md
@@ -80,3 +80,5 @@ Recommended next step: **EDGE-X2.1 non-orthogonal concave patch lab** to expand
> Note: EDGE-X2.1 adds a policy scaffold lane before any geometry expansion beyond canonical concave planar patch.
+>
+> Update (EDGE-X2.2): the canonical patch proof is now extended in lab-only code to include safe non-orthogonal concave planar single-edge cases, with deterministic topology/planarity checks and explicit unstable-angle rejection/defer diagnostics.