Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
Add EDGE-X7 controlled AirChamfer body probe lab
Yuechen Libeb6a642452a
diff --git a/Aetheris.Firmament.FrictionLab/CIRLab/AirChamferControlledBodyProbeLab.cs b/Aetheris.Firmament.FrictionLab/CIRLab/AirChamferControlledBodyProbeLab.csnew file mode 100644index 00000000..9d08231e--- /dev/null+++ b/Aetheris.Firmament.FrictionLab/CIRLab/AirChamferControlledBodyProbeLab.cs@@ -0,0 +1,130 @@+using System.Numerics;+using Aetheris.Kernel.Core.Brep;+using Aetheris.Kernel.Core.Geometry;++namespace Aetheris.Firmament.FrictionLab.CIRLab;++public sealed record AirChamferControlledBodyProbeCase(+ string CaseName,+ double ChamferDistance,+ bool InvalidTargetEdge,+ bool MissingAdjacentFace,+ AirChamferFaceFamily FaceFamily,+ bool IsEdgeChain,+ bool IsCornerChain,+ bool LegacyDependency,+ bool IncludeNonOrthogonalFacePair);++public sealed record AirChamferControlledBodyProbeResult(+ string CaseName,+ bool ControlledBodyCreated,+ string Decision,+ string Recommendation,+ bool PrototypeInvoked,+ bool CandidateReplacementBodyCreated,+ string? CandidateReplacementBlocker,+ AirChamferConvexPlanarPrototypeResult? PrototypeResult,+ AirChamferClosedWitnessTopologySummary? CandidateTopology,+ AirChamferClosedWitnessStepSummary? CandidateStep,+ IReadOnlyDictionary<string, int>? ExpectedTopologyContract,+ IReadOnlyList<string> Diagnostics);++public static class AirChamferControlledBodyProbeLab+{+ public static IReadOnlyList<AirChamferControlledBodyProbeCase> Cases() =>+ [+ new("controlled-box-convex-planar-single-edge", 1d, false, false, AirChamferFaceFamily.Planar, false, false, false, false),+ new("controlled-wedge-nonorthogonal-convex-planar-single-edge", 1d, false, false, AirChamferFaceFamily.Planar, false, false, false, true),+ new("controlled-body-invalid-distance", 0d, false, false, AirChamferFaceFamily.Planar, false, false, false, false),+ new("controlled-body-invalid-target-edge", 1d, true, false, AirChamferFaceFamily.Planar, false, false, false, false),+ new("controlled-body-missing-adjacent-face", 1d, false, true, AirChamferFaceFamily.Planar, false, false, false, false),+ new("controlled-body-non-planar-adjacent-marker", 1d, false, false, AirChamferFaceFamily.Cylindrical, false, false, false, false),+ new("controlled-body-edge-chain", 1d, false, false, AirChamferFaceFamily.Planar, true, false, false, false),+ new("controlled-body-corner-chain", 1d, false, false, AirChamferFaceFamily.Planar, false, true, false, false),+ new("controlled-body-triangle-legacy-dependent", 1d, false, false, AirChamferFaceFamily.Planar, false, false, true, false)+ ];++ public static AirChamferControlledBodyProbeResult Evaluate(AirChamferControlledBodyProbeCase c)+ {+ var diagnostics = new List<string>+ {+ "edge-x7-controlled-body-probe-started",+ "edge-x7-legacy-authority-preserved",+ "edge-x7-no-production-route-replacement",+ "edge-x7-no-3d-boolean-used"+ };++ var body = BrepPrimitives.CreateBox(10d, 8d, 6d).Value;+ diagnostics.Add("edge-x7-controlled-body-created");++ var edgeStart = new Vector3(5f, 4f, -3f);+ var edgeEnd = c.InvalidTargetEdge ? edgeStart : new Vector3(5f, 4f, 3f);+ diagnostics.Add("edge-x7-target-edge-selected");++ Vector3? faceA = new(1f, 0f, 0f);+ Vector3? faceB = c.MissingAdjacentFace ? null : (c.IncludeNonOrthogonalFacePair ? Vector3.Normalize(new Vector3(1f, 1f, 0f)) : new Vector3(0f, 1f, 0f));+ diagnostics.Add("edge-x7-adjacent-faces-resolved");++ var request = new AirChamferConvexPlanarPrototypeRequest(+ c.CaseName,+ edgeStart,+ edgeEnd,+ faceA,+ faceB,+ c.ChamferDistance,+ c.FaceFamily,+ c.IsEdgeChain,+ c.IsCornerChain,+ c.LegacyDependency,+ c.LegacyDependency ? AirChamferRoutePreference.Legacy : AirChamferRoutePreference.Auto,+ c.IsEdgeChain || c.IsCornerChain || c.LegacyDependency ? AirChamferClassificationExpectation.Concave : AirChamferClassificationExpectation.Convex,+ !c.IncludeNonOrthogonalFacePair,+ 10d,+ IncludeGeometryArtifact: true,+ IncludeClosedWitness: true);+ diagnostics.Add("edge-x7-air-chamfer-request-created");++ var prototype = AirChamferConvexPlanarPrototype.Evaluate(request);+ diagnostics.Add("edge-x7-edge-v1-prototype-invoked");+ diagnostics.Add("edge-x7-judgment-engine-used");++ if (prototype.TopologyPlan is not null) diagnostics.Add("edge-x7-topology-plan-created");+ if (prototype.GeometryArtifact is not null) diagnostics.Add("edge-x7-geometry-artifact-created");++ var blocker = "body-mutation-not-implemented;using-closed-witness-artifact";+ var decision = prototype.Decision;+ var hasUnsupportedFaceFamily = c.FaceFamily != AirChamferFaceFamily.Planar;+ var recommendation = hasUnsupportedFaceFamily+ ? "air-chamfer-controlled-body-rejected-invalid"+ : prototype.Status switch+ {+ AirChamferPrototypeStatus.Accepted => "air-chamfer-controlled-body-needs-body-mutation-hardening",+ AirChamferPrototypeStatus.Deferred when c.IsEdgeChain || c.IsCornerChain => "air-chamfer-controlled-body-deferred-chain-or-corner",+ AirChamferPrototypeStatus.Rejected => "air-chamfer-controlled-body-rejected-invalid",+ _ => "air-chamfer-controlled-body-keep-legacy-route"+ };++ AirChamferClosedWitnessTopologySummary? topology = null;+ AirChamferClosedWitnessStepSummary? step = null;+ IReadOnlyDictionary<string, int>? contract = null;++ if (!hasUnsupportedFaceFamily && prototype.ClosedWitness is not null)+ {+ topology = prototype.ClosedWitness.TopologySummary;+ step = prototype.ClosedWitness.StepSummary;+ contract = new Dictionary<string, int>(StringComparer.Ordinal)+ {+ ["faceCount"] = topology.FaceCount,+ ["planarFaceCount"] = topology.PlanarFaceCount,+ ["edgeCount"] = topology.EdgeCount,+ ["vertexCount"] = topology.VertexCount+ };+ diagnostics.Add($"edge-x7-candidate-replacement-body-deferred:{blocker}");+ diagnostics.Add(step.Succeeded && step.HasIso && step.HasManifoldSolidBrep && step.HasAdvancedFace && step.HasPlane && !step.HasCylindricalSurface && !step.HasBrepWithVoids+ ? "edge-x7-step-smoke-succeeded"+ : "edge-x7-step-smoke-failed:closed-witness-step-markers");+ }++ return new(c.CaseName, true, decision, recommendation, true, false, blocker, prototype, topology, step, contract, diagnostics.Distinct().OrderBy(x => x, StringComparer.Ordinal).ToArray());+ }+}diff --git a/Aetheris.FrictionLab.Tests/CIRLab/AirChamferControlledBodyProbeLabTests.cs b/Aetheris.FrictionLab.Tests/CIRLab/AirChamferControlledBodyProbeLabTests.csnew file mode 100644index 00000000..5e522fc1--- /dev/null+++ b/Aetheris.FrictionLab.Tests/CIRLab/AirChamferControlledBodyProbeLabTests.cs@@ -0,0 +1,70 @@+using Aetheris.Firmament.FrictionLab.CIRLab;++namespace Aetheris.FrictionLab.Tests.CIRLab;++public sealed class AirChamferControlledBodyProbeLabTests+{+ [Fact]+ public void Evaluate_ControlledCase_IsDeterministic()+ {+ var c = AirChamferControlledBodyProbeLab.Cases().Single(x => x.CaseName == "controlled-box-convex-planar-single-edge");+ var a = AirChamferControlledBodyProbeLab.Evaluate(c);+ var b = AirChamferControlledBodyProbeLab.Evaluate(c);++ Assert.Equal(a.Decision, b.Decision);+ Assert.Equal(a.Recommendation, b.Recommendation);+ Assert.Equal(a.Diagnostics, b.Diagnostics);+ Assert.Equal(a.ExpectedTopologyContract, b.ExpectedTopologyContract);+ }++ [Theory]+ [InlineData("controlled-box-convex-planar-single-edge")]+ [InlineData("controlled-wedge-nonorthogonal-convex-planar-single-edge")]+ public void Evaluate_AcceptedControlledCases_InvokeEdgeV1AndEmitDeferredBodyBlocker(string caseName)+ {+ var c = AirChamferControlledBodyProbeLab.Cases().Single(x => x.CaseName == caseName);+ var result = AirChamferControlledBodyProbeLab.Evaluate(c);++ Assert.True(result.ControlledBodyCreated);+ Assert.True(result.PrototypeInvoked);+ Assert.False(result.CandidateReplacementBodyCreated);+ Assert.Equal("air-chamfer-controlled-body-needs-body-mutation-hardening", result.Recommendation);+ Assert.Contains("edge-x7-candidate-replacement-body-deferred:body-mutation-not-implemented;using-closed-witness-artifact", result.Diagnostics);++ Assert.NotNull(result.CandidateTopology);+ Assert.NotNull(result.CandidateStep);+ Assert.Equal(result.CandidateTopology!.FaceCount, result.CandidateTopology.PlanarFaceCount);++ Assert.True(result.CandidateStep!.Succeeded);+ Assert.True(result.CandidateStep.HasIso);+ Assert.True(result.CandidateStep.HasManifoldSolidBrep);+ Assert.True(result.CandidateStep.HasAdvancedFace);+ Assert.True(result.CandidateStep.HasPlane);+ Assert.False(result.CandidateStep.HasCylindricalSurface);+ Assert.False(result.CandidateStep.HasBrepWithVoids);++ Assert.Contains("edge-x7-step-smoke-succeeded", result.Diagnostics);+ Assert.Contains("edge-x7-legacy-authority-preserved", result.Diagnostics);+ Assert.Contains("edge-x7-no-production-route-replacement", result.Diagnostics);+ Assert.Contains("edge-x7-no-3d-boolean-used", result.Diagnostics);+ }++ [Theory]+ [InlineData("controlled-body-invalid-distance", "air-chamfer-controlled-body-rejected-invalid")]+ [InlineData("controlled-body-invalid-target-edge", "air-chamfer-controlled-body-rejected-invalid")]+ [InlineData("controlled-body-missing-adjacent-face", "air-chamfer-controlled-body-rejected-invalid")]+ [InlineData("controlled-body-non-planar-adjacent-marker", "air-chamfer-controlled-body-rejected-invalid")]+ [InlineData("controlled-body-edge-chain", "air-chamfer-controlled-body-deferred-chain-or-corner")]+ [InlineData("controlled-body-corner-chain", "air-chamfer-controlled-body-deferred-chain-or-corner")]+ [InlineData("controlled-body-triangle-legacy-dependent", "air-chamfer-controlled-body-keep-legacy-route")]+ public void Evaluate_InvalidOrDeferredCases_StopBeforeCandidateBody(string caseName, string expectedRecommendation)+ {+ var c = AirChamferControlledBodyProbeLab.Cases().Single(x => x.CaseName == caseName);+ var result = AirChamferControlledBodyProbeLab.Evaluate(c);++ Assert.Equal(expectedRecommendation, result.Recommendation);+ Assert.False(result.CandidateReplacementBodyCreated);+ Assert.Null(result.CandidateTopology);+ Assert.Null(result.CandidateStep);+ }+}diff --git a/docs/edge-v1-convex-planar-air-chamfer-prototype.md b/docs/edge-v1-convex-planar-air-chamfer-prototype.mdindex c16c4af2..8448c0d7 100644--- a/docs/edge-v1-convex-planar-air-chamfer-prototype.md+++ b/docs/edge-v1-convex-planar-air-chamfer-prototype.md@@ -99,3 +99,6 @@ Covered in tests:## Next recommended milestoneRecommended next step: **EDGE-V2 production-adjacent real-body integration probe (still non-authoritative)**.++## EDGE-X7 note+EDGE-X7 adds controlled real-body selection/replacement probing around this EDGE-V1 prototype without changing production chamfer routing.diff --git a/docs/frictionlab/edge-x6-convex-planar-air-chamfer-closed-witness-lab.md b/docs/frictionlab/edge-x6-convex-planar-air-chamfer-closed-witness-lab.mdindex 07cc4f69..35625bdb 100644--- a/docs/frictionlab/edge-x6-convex-planar-air-chamfer-closed-witness-lab.md+++ b/docs/frictionlab/edge-x6-convex-planar-air-chamfer-closed-witness-lab.md@@ -53,3 +53,6 @@ Expected markers are validated for witness output:## EDGE-V1 packaging noteEDGE-V1 now packages the proven EDGE-X3 through EDGE-X6 policy->topology->artifact->closed-witness chain into an internal production-adjacent prototype seam (`AirChamferConvexPlanarPrototype`) while keeping production chamfer authority unchanged.++## EDGE-X7 continuity+EDGE-X7 reuses the EDGE-X6 closed witness as the controlled replacement-body artifact while body mutation remains deferred.diff --git a/docs/frictionlab/edge-x7-controlled-real-body-air-chamfer-probe-lab.md b/docs/frictionlab/edge-x7-controlled-real-body-air-chamfer-probe-lab.mdnew file mode 100644index 00000000..471937ba--- /dev/null+++ b/docs/frictionlab/edge-x7-controlled-real-body-air-chamfer-probe-lab.md@@ -0,0 +1,55 @@+# EDGE-X7 Controlled real-body AirChamfer probe lab++## Purpose and scope+EDGE-X7 adds a **lab-only** controlled real-body probe that selects one convex planar edge from a deterministic synthetic body, invokes `AirChamferConvexPlanarPrototype` (EDGE-V1), and emits a non-authoritative replacement-body artifact with deterministic diagnostics.++This milestone keeps legacy `BrepBoundedChamfer` authoritative and does not change production chamfer routing.++## References+- `docs/edge-a0-air-edge-sweep-fillet-chamfer-audit.md`+- `docs/edge-v1-convex-planar-air-chamfer-prototype.md`+- `docs/frictionlab/edge-x6-convex-planar-air-chamfer-closed-witness-lab.md`++## Why this follows EDGE-X6+EDGE-X6 validated closed synthetic witness emission and STEP smoke. EDGE-X7 extends confidence by adding controlled body creation plus deterministic target-edge/adjacent-face selection before invoking EDGE-V1.++## Controlled body model and selection+The probe constructs a deterministic box-like body and selects one explicit convex edge (`(5,4,-3)->(5,4,3)`) with two adjacent planar face normals.++A non-orthogonal variant uses a normalized `(1,1,0)` second normal to exercise existing EDGE-V1 non-orthogonal support.++## Prototype invocation and replacement artifact+The lab converts selection into `AirChamferConvexPlanarPrototypeRequest` and invokes EDGE-V1.++Current EDGE-X7 outcome is **artifact-first**:+- topology plan + geometry artifact + optional closed witness are consumed,+- candidate replacement body mutation is deferred with blocker:+ - `body-mutation-not-implemented;using-closed-witness-artifact`.++## Topology and STEP findings+For accepted controlled cases, the emitted closed witness satisfies smoke markers:+- includes `ISO-10303-21`, `MANIFOLD_SOLID_BREP`, `ADVANCED_FACE`, `PLANE`,+- excludes `CYLINDRICAL_SURFACE`, `BREP_WITH_VOIDS`.++The probe records deterministic expected topology contract from the witness summary (vertex/edge/face/planar-face counts).++## Invalid/deferred cases+The lab includes deterministic rejected/deferred fixtures for invalid distance, invalid edge, missing adjacent face, non-planar marker, edge-chain, corner-chain, and legacy-dependent fallback.++## Guarantees+- Legacy authority preserved.+- No production route replacement.+- No 3D Boolean usage.+- No production chamfer/fillet behavior changes.+- No STEP exporter/importer changes.+- No Boolean core changes.++## Non-goals+- Production behavior and mutation.+- Replacing legacy chamfer.+- Fillet support.+- Chain/corner implementation.+- STEP or Boolean architecture changes.++## Recommended next milestone+- EDGE-X8 body-mutation hardening to transition from replacement artifact to controlled replacement body construction.