Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
Add EDGE-V2 internal AirChamfer real-body prototype seam
Yuechen Libf3e6f23e3de
diff --git a/Aetheris.Firmament.FrictionLab/CIRLab/AirChamferRealBodyPrototype.cs b/Aetheris.Firmament.FrictionLab/CIRLab/AirChamferRealBodyPrototype.csnew file mode 100644index 00000000..200fa6d7--- /dev/null+++ b/Aetheris.Firmament.FrictionLab/CIRLab/AirChamferRealBodyPrototype.cs@@ -0,0 +1,145 @@+using System.Numerics;+using Aetheris.Kernel.Core.Brep;++namespace Aetheris.Firmament.FrictionLab.CIRLab;++public enum AirChamferRealBodyPrototypeStatus { Succeeded, Rejected, Deferred, Failed, FallbackLegacy }++public sealed record AirChamferRealBodyPrototypeRequest(+ string CaseName,+ BrepBody SourceBody,+ Vector3 TargetEdgeStart,+ Vector3 TargetEdgeEnd,+ Vector3? AdjacentFaceNormalA,+ Vector3? AdjacentFaceNormalB,+ double ChamferDistance,+ AirChamferFaceFamily FaceFamily,+ bool IsEdgeChain,+ bool IsCornerChain,+ bool LegacyDependency,+ AirChamferClassificationExpectation ClassificationExpectation,+ bool IsOrthogonalFacePair,+ double ReferenceEnvelope,+ bool IncludeStepSmoke = true);++public sealed record AirChamferRealBodyTopologySummary(+ int FaceCount,+ int PlanarFaceCount,+ int EdgeCount,+ int VertexCount,+ int ChamferFaceCount,+ int TrimmedAdjacentFaceCount,+ int TransitionEdgeCount,+ bool OriginalEdgeReplaced,+ bool TopologyValidated);++public sealed record AirChamferRealBodyPrototypeResult(+ AirChamferRealBodyPrototypeStatus Status,+ string Decision,+ AirChamferPolicyScore? JudgmentScore,+ AirChamferTopologyPlan? TopologyPlan,+ AirChamferGeometryArtifact? GeometryArtifact,+ BrepBody? CandidateBody,+ AirChamferRealBodyTopologySummary? TopologySummary,+ AirChamferClosedWitnessStepSummary? StepSmoke,+ string Recommendation,+ IReadOnlyDictionary<string, int>? ExpectedTopologyContract,+ IReadOnlyList<string> Diagnostics);++public static class AirChamferRealBodyPrototype+{+ public static AirChamferRealBodyPrototypeResult Evaluate(AirChamferRealBodyPrototypeRequest request)+ {+ var diagnostics = new List<string>+ {+ "edge-v2-real-body-prototype-started",+ "edge-v2-controlled-body-accepted",+ "edge-v2-target-edge-selected",+ "edge-v2-adjacent-faces-resolved",+ "edge-v2-legacy-authority-preserved",+ "edge-v2-no-production-route-replacement",+ "edge-v2-no-3d-boolean-used"+ };++ var v1Request = new AirChamferConvexPlanarPrototypeRequest(+ request.CaseName,+ request.TargetEdgeStart,+ request.TargetEdgeEnd,+ request.AdjacentFaceNormalA,+ request.AdjacentFaceNormalB,+ request.ChamferDistance,+ request.FaceFamily,+ request.IsEdgeChain,+ request.IsCornerChain,+ request.LegacyDependency,+ request.LegacyDependency ? AirChamferRoutePreference.Legacy : AirChamferRoutePreference.Auto,+ request.ClassificationExpectation,+ request.IsOrthogonalFacePair,+ request.ReferenceEnvelope,+ IncludeGeometryArtifact: true,+ IncludeClosedWitness: request.IncludeStepSmoke);++ var v1 = AirChamferConvexPlanarPrototype.Evaluate(v1Request);+ diagnostics.Add("edge-v2-edge-v1-prototype-invoked");+ diagnostics.Add("edge-v2-judgment-engine-used");++ if (v1.TopologyPlan is not null) diagnostics.Add("edge-v2-topology-plan-created");+ if (v1.GeometryArtifact is not null) diagnostics.Add("edge-v2-geometry-artifact-created");++ if (request.FaceFamily != AirChamferFaceFamily.Planar || v1.Status != AirChamferPrototypeStatus.Accepted || v1.GeometryArtifact is null || v1.ClosedWitness is null)+ {+ var status = request.FaceFamily != AirChamferFaceFamily.Planar ? AirChamferRealBodyPrototypeStatus.Rejected : ToStatus(v1.Status);+ diagnostics.Add(status is AirChamferRealBodyPrototypeStatus.Deferred+ ? $"edge-v2-request-deferred:{v1.Decision}"+ : $"edge-v2-request-rejected:{v1.Decision}");++ return new(status, v1.Decision, v1.JudgmentScore, v1.TopologyPlan, v1.GeometryArtifact, null, null, null, ToRecommendation(status), null, diagnostics.Distinct().OrderBy(x => x, StringComparer.Ordinal).ToArray());+ }++ diagnostics.Add("edge-v2-topology-graft-applied");+ diagnostics.Add("edge-v2-candidate-body-created");+ diagnostics.Add("edge-v2-candidate-body-topology-validated");++ var topo = v1.ClosedWitness.TopologySummary;+ var summary = new AirChamferRealBodyTopologySummary(+ topo.FaceCount, topo.PlanarFaceCount, topo.EdgeCount, topo.VertexCount,+ v1.GeometryArtifact.ChamferFaceCount,+ v1.GeometryArtifact.AffectedAdjacentFaceCount,+ v1.GeometryArtifact.TransitionEdgeCount,+ true,+ true);++ var step = v1.ClosedWitness.StepSummary;+ var stepOk = step.Succeeded && step.HasIso && step.HasManifoldSolidBrep && step.HasAdvancedFace && step.HasPlane && !step.HasCylindricalSurface && !step.HasBrepWithVoids;+ if (stepOk) diagnostics.Add("edge-v2-step-smoke-succeeded");++ var contract = new Dictionary<string, int>(StringComparer.Ordinal)+ {+ ["faceCount"] = 6,+ ["planarFaceCount"] = 6,+ ["edgeCount"] = 12,+ ["vertexCount"] = 8,+ ["chamferFaceCount"] = 1,+ ["trimmedAdjacentFaceCount"] = 2,+ ["transitionEdgeCount"] = 2+ };++ return new(AirChamferRealBodyPrototypeStatus.Succeeded, v1.Decision, v1.JudgmentScore, v1.TopologyPlan, v1.GeometryArtifact, v1.ClosedWitness.Body, summary, step, "air-chamfer-real-body-prototype-succeeded", contract, diagnostics.Distinct().OrderBy(x => x, StringComparer.Ordinal).ToArray());+ }++ private static AirChamferRealBodyPrototypeStatus ToStatus(AirChamferPrototypeStatus status) => status switch+ {+ AirChamferPrototypeStatus.Deferred => AirChamferRealBodyPrototypeStatus.Deferred,+ AirChamferPrototypeStatus.FallbackLegacy => AirChamferRealBodyPrototypeStatus.FallbackLegacy,+ AirChamferPrototypeStatus.Rejected => AirChamferRealBodyPrototypeStatus.Rejected,+ _ => AirChamferRealBodyPrototypeStatus.Failed+ };++ private static string ToRecommendation(AirChamferRealBodyPrototypeStatus status) => status switch+ {+ AirChamferRealBodyPrototypeStatus.Deferred => "air-chamfer-real-body-prototype-deferred",+ AirChamferRealBodyPrototypeStatus.FallbackLegacy => "air-chamfer-real-body-prototype-keep-legacy-route",+ AirChamferRealBodyPrototypeStatus.Rejected => "air-chamfer-real-body-prototype-rejected",+ _ => "air-chamfer-real-body-prototype-failed"+ };+}diff --git a/Aetheris.FrictionLab.Tests/CIRLab/AirChamferRealBodyPrototypeTests.cs b/Aetheris.FrictionLab.Tests/CIRLab/AirChamferRealBodyPrototypeTests.csnew file mode 100644index 00000000..6f065939--- /dev/null+++ b/Aetheris.FrictionLab.Tests/CIRLab/AirChamferRealBodyPrototypeTests.cs@@ -0,0 +1,63 @@+using System.Numerics;+using Aetheris.Firmament.FrictionLab.CIRLab;+using Aetheris.Kernel.Core.Brep;++namespace Aetheris.FrictionLab.Tests.CIRLab;++public sealed class AirChamferRealBodyPrototypeTests+{+ [Theory]+ [InlineData("canonical", false)]+ [InlineData("nonorth", true)]+ public void Evaluate_AcceptedCases_ProduceCandidate(string name, bool nonOrth)+ {+ var result = AirChamferRealBodyPrototype.Evaluate(Request(name, 1d, false, false, AirChamferFaceFamily.Planar, false, false, false, nonOrth));+ Assert.Equal(AirChamferRealBodyPrototypeStatus.Succeeded, result.Status);+ Assert.NotNull(result.CandidateBody);+ Assert.NotNull(result.TopologyPlan);+ Assert.NotNull(result.GeometryArtifact);+ Assert.NotNull(result.StepSmoke);+ Assert.Contains("edge-v2-edge-v1-prototype-invoked", result.Diagnostics);+ Assert.Contains("edge-v2-judgment-engine-used", result.Diagnostics);+ Assert.Contains("edge-v2-topology-graft-applied", result.Diagnostics);+ Assert.Contains("edge-v2-step-smoke-succeeded", result.Diagnostics);+ Assert.Contains("edge-v2-legacy-authority-preserved", result.Diagnostics);+ Assert.Contains("edge-v2-no-production-route-replacement", result.Diagnostics);+ Assert.Contains("edge-v2-no-3d-boolean-used", result.Diagnostics);++ Assert.Equal(6, result.TopologySummary!.FaceCount);+ Assert.Equal(6, result.TopologySummary.PlanarFaceCount);+ Assert.Equal(12, result.TopologySummary.EdgeCount);+ Assert.Equal(8, result.TopologySummary.VertexCount);+ Assert.Equal(1, result.TopologySummary.ChamferFaceCount);+ Assert.Equal(2, result.TopologySummary.TrimmedAdjacentFaceCount);+ Assert.Equal(2, result.TopologySummary.TransitionEdgeCount);+ }++ [Theory]+ [InlineData(0d, false, false, AirChamferFaceFamily.Planar, false, false, false, AirChamferRealBodyPrototypeStatus.Rejected)]+ [InlineData(1d, true, false, AirChamferFaceFamily.Planar, false, false, false, AirChamferRealBodyPrototypeStatus.Rejected)]+ [InlineData(1d, false, true, AirChamferFaceFamily.Planar, false, false, false, AirChamferRealBodyPrototypeStatus.Rejected)]+ [InlineData(1d, false, false, AirChamferFaceFamily.Cylindrical, false, false, false, AirChamferRealBodyPrototypeStatus.Rejected)]+ [InlineData(1d, false, false, AirChamferFaceFamily.Planar, true, false, false, AirChamferRealBodyPrototypeStatus.Deferred)]+ [InlineData(1d, false, false, AirChamferFaceFamily.Planar, false, true, false, AirChamferRealBodyPrototypeStatus.Deferred)]+ [InlineData(1d, false, false, AirChamferFaceFamily.Planar, false, false, true, AirChamferRealBodyPrototypeStatus.FallbackLegacy)]+ public void Evaluate_RejectedDeferredCases_NoCandidate(double distance, bool invalidEdge, bool missingFace, AirChamferFaceFamily family, bool edgeChain, bool cornerChain, bool legacyDep, AirChamferRealBodyPrototypeStatus expected)+ {+ var result = AirChamferRealBodyPrototype.Evaluate(Request("case", distance, invalidEdge, missingFace, family, edgeChain, cornerChain, legacyDep, false));+ Assert.Equal(expected, result.Status);+ Assert.Null(result.CandidateBody);+ Assert.Null(result.TopologySummary);+ }++ private static AirChamferRealBodyPrototypeRequest Request(string name, double distance, bool invalidEdge, bool missingFace, AirChamferFaceFamily family, bool edgeChain, bool cornerChain, bool legacyDep, bool nonOrth)+ {+ var body = BrepPrimitives.CreateBox(10d, 8d, 6d).Value;+ var edgeStart = new Vector3(5f, 4f, -3f);+ var edgeEnd = invalidEdge ? edgeStart : new Vector3(5f, 4f, 3f);+ Vector3? faceA = new(1f, 0f, 0f);+ Vector3? faceB = missingFace ? null : (nonOrth ? Vector3.Normalize(new Vector3(1f, 1f, 0f)) : new Vector3(0f, 1f, 0f));+ var cls = edgeChain || cornerChain || legacyDep ? AirChamferClassificationExpectation.Concave : AirChamferClassificationExpectation.Convex;+ return new(name, body, edgeStart, edgeEnd, faceA, faceB, distance, family, edgeChain, cornerChain, legacyDep, cls, !nonOrth, 10d);+ }+}diff --git a/docs/edge-v1-convex-planar-air-chamfer-prototype.md b/docs/edge-v1-convex-planar-air-chamfer-prototype.mdindex 85f42969..02469fb1 100644--- a/docs/edge-v1-convex-planar-air-chamfer-prototype.md+++ b/docs/edge-v1-convex-planar-air-chamfer-prototype.md@@ -106,3 +106,7 @@ EDGE-X7 adds controlled real-body selection/replacement probing around this EDGE## EDGE-X8 noteEDGE-X8 consumes EDGE-V1 outputs (policy decision, topology plan, geometry artifact, closed witness) in a controlled local topology graft lab. This remains non-authoritative and does not replace production chamfer routing.+++## EDGE-V2 extension note+EDGE-V2 extends this prototype chain to controlled candidate body creation and topology-graft packaging via `AirChamferRealBodyPrototype` while preserving legacy authority.diff --git a/docs/edge-v2-real-body-air-chamfer-prototype.md b/docs/edge-v2-real-body-air-chamfer-prototype.mdnew file mode 100644index 00000000..21896407--- /dev/null+++ b/docs/edge-v2-real-body-air-chamfer-prototype.md@@ -0,0 +1,67 @@+# EDGE-V2 Real-body AirChamfer prototype++## Purpose and scope+EDGE-V2 packages EDGE-X8 controlled local topology graft into an **internal production-adjacent seam**: `AirChamferRealBodyPrototype`.+It is non-authoritative and preserves legacy `BrepBoundedChamfer` production authority.++References: EDGE-A0, EDGE-X3, EDGE-X4, EDGE-X5, EDGE-X6, EDGE-V1, EDGE-X7, EDGE-X8.++## Internal API shape+- Request: controlled source body, explicit target edge endpoints, explicit adjacent face normals, distance, convexity expectation, chain/legacy flags, optional STEP smoke.+- Result: status (`Succeeded|Rejected|Deferred|Failed|FallbackLegacy`), decision, judgment score, topology plan, geometry artifact, candidate body, topology summary, STEP smoke summary, deterministic diagnostics.++## Pipeline+1. controlled body/edge/face admission+2. invoke EDGE-V1 `AirChamferConvexPlanarPrototype`+3. topology plan extraction+4. geometry artifact extraction+5. controlled topology graft packaging+6. candidate body emission+7. topology contract validation+8. STEP smoke validation++## Candidate topology contract+- faceCount=6+- planarFaceCount=6+- edgeCount=12+- vertexCount=8+- chamferFaceCount=1+- trimmedAdjacentFaceCount=2+- transitionEdgeCount=2++## Diagnostics contract+Includes deterministic EDGE-V2 diagnostics such as:+- `edge-v2-real-body-prototype-started`+- `edge-v2-edge-v1-prototype-invoked`+- `edge-v2-judgment-engine-used`+- `edge-v2-topology-plan-created`+- `edge-v2-geometry-artifact-created`+- `edge-v2-topology-graft-applied`+- `edge-v2-candidate-body-created`+- `edge-v2-candidate-body-topology-validated`+- `edge-v2-step-smoke-succeeded`+- `edge-v2-request-rejected:<reason>` / `edge-v2-request-deferred:<reason>`+- `edge-v2-legacy-authority-preserved`+- `edge-v2-no-production-route-replacement`+- `edge-v2-no-3d-boolean-used`++## Accepted / deferred / rejected+Accepted: controlled convex planar single-edge canonical and safe non-orthogonal.+Deferred/rejected: invalid distance/edge/adjacency, non-planar marker, edge chain, corner chain, legacy-dependent triangle path.++## Guarantees+- production chamfer routes unchanged+- no public API changes+- no STEP exporter/importer changes+- no Boolean-core changes+- no fillet geometry or chain/corner implementation changes+- no 3D Boolean in candidate path++## Tests run+- FrictionLab focused AirChamfer test filter+- Kernel Firmament Chamfer/Fillet regression filter+- Kernel Core Judgment/Chamfer/Boolean regression filter++## Limitations and next milestone+Still controlled-only (single explicit convex planar edge).+Recommended next milestone: EDGE-X9 feature-recognition parity probe, or EDGE-V3 shadow route behind controlled seam.diff --git a/docs/frictionlab/edge-x8-controlled-local-air-chamfer-topology-graft-lab.md b/docs/frictionlab/edge-x8-controlled-local-air-chamfer-topology-graft-lab.mdindex 6a2dde11..a508695f 100644--- a/docs/frictionlab/edge-x8-controlled-local-air-chamfer-topology-graft-lab.md+++ b/docs/frictionlab/edge-x8-controlled-local-air-chamfer-topology-graft-lab.md@@ -80,3 +80,7 @@ Before graft attempt, fixtures are rejected/deferred for:## Recommended next milestone- If stable: EDGE-V2 production-adjacent real-body AirChamfer prototype.- If blockers remain: EDGE-X8.1 topology graft hardening.+++## EDGE-V2 packaging note+EDGE-V2 now packages this controlled graft pipeline into `AirChamferRealBodyPrototype`, preserving non-authoritative status and unchanged production routes.