Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
Add profile-authored chamfer extrusion lab
Yuechen Lic26b83314b4b
diff --git a/Aetheris.Firmament.FrictionLab/CIRLab/ProfileChamferExtrudeLab.cs b/Aetheris.Firmament.FrictionLab/CIRLab/ProfileChamferExtrudeLab.csnew file mode 100644index 00000000..44636ef0--- /dev/null+++ b/Aetheris.Firmament.FrictionLab/CIRLab/ProfileChamferExtrudeLab.cs@@ -0,0 +1,307 @@+using Aetheris.Kernel.Core.Brep;+using Aetheris.Kernel.Core.Brep.Features;+using Aetheris.Kernel.Core.Geometry;+using Aetheris.Kernel.Core.Math;+using Aetheris.Kernel.Core.Step242;++namespace Aetheris.Firmament.FrictionLab.CIRLab;++public enum ProfileChamferCorner+{+ PositiveXPositiveY,+}++public sealed record ProfileChamferExtrudeCase(+ string Name,+ double Width,+ double Depth,+ double Height,+ double ChamferDistance,+ ProfileChamferCorner Corner = ProfileChamferCorner.PositiveXPositiveY);++public sealed record ProfileChamferExtrudeTopologySummary(+ bool BodyProduced,+ int VertexCount,+ int EdgeCount,+ int FaceCount,+ int PlanarFaceCount,+ int CylindricalFaceCount,+ int SideFaceCount,+ int ChamferFaceCount,+ int LoopCount,+ int CoedgeCount,+ string Bounds);++public sealed record ProfileChamferExtrudeStepSummary(+ bool Exported,+ IReadOnlyList<string> PresentMarkers,+ IReadOnlyList<string> MissingRequiredMarkers,+ IReadOnlyList<string> AbsentMarkers,+ IReadOnlyList<string> UnexpectedPresentMarkers);++public sealed record ProfileChamferExtrudeRow(+ string CaseName,+ LabProfileStatus Status,+ bool Succeeded,+ ProfileChamferExtrudeTopologySummary Topology,+ ProfileChamferExtrudeStepSummary Step,+ IReadOnlyList<string> Diagnostics,+ string Recommendation);++public static class ProfileChamferExtrudeLab+{+ private const double Tol = 1e-9;++ private static readonly string[] RequiredStepMarkers = ["ISO-10303-21", "MANIFOLD_SOLID_BREP", "ADVANCED_FACE", "PLANE"];+ private static readonly string[] ForbiddenStepMarkers = ["CYLINDRICAL_SURFACE", "BREP_WITH_VOIDS"];+ private static readonly HashSet<string> AllowedRecommendations =+ [+ "profile-chamfer-extrude-ready-for-production-evaluation",+ "profile-chamfer-extrude-needs-profile-validation-hardening",+ "profile-chamfer-extrude-needs-emitter-parity-work",+ "profile-chamfer-extrude-invalid-rejected",+ "profile-chamfer-extrude-deferred",+ ];++ public static IReadOnlyList<ProfileChamferExtrudeRow> RunAll() =>+ [+ Run(new("canonical-centered-box", 10, 8, 6, 1)),+ Run(new("larger-valid-chamfer", 10, 8, 6, 2)),+ Run(new("non-square-rectangle", 12, 5, 7, 1)),+ Run(new("invalid-zero-chamfer-distance", 10, 8, 6, 0)),+ Run(new("invalid-too-large-chamfer-distance", 10, 8, 6, 4)),+ Run(new("invalid-width", 0, 8, 6, 1)),+ Run(new("invalid-depth", 10, -8, 6, 1)),+ Run(new("invalid-height", 10, 8, 0, 1)),+ Run(new("invalid-non-finite-width", double.PositiveInfinity, 8, 6, 1)),+ ];++ public static ProfileChamferExtrudeRow Run(ProfileChamferExtrudeCase c)+ {+ var diagnostics = new List<string> { "edge-profile-x1-profile-chamfer-lab-started" };++ if (!FinitePositive(c.Width) || !FinitePositive(c.Depth) || !FinitePositive(c.Height))+ {+ diagnostics.Add("edge-profile-x1-invalid-dimensions-rejected");+ return Stop(c.Name, LabProfileStatus.Failed, diagnostics, "profile-chamfer-extrude-invalid-rejected");+ }++ if (!double.IsFinite(c.ChamferDistance) || c.ChamferDistance <= Tol)+ {+ diagnostics.Add("edge-profile-x1-invalid-chamfer-distance-rejected");+ return Stop(c.Name, LabProfileStatus.Failed, diagnostics, "profile-chamfer-extrude-invalid-rejected");+ }++ var safeLimit = Math.Min(c.Width, c.Depth) * 0.5d;+ if (c.ChamferDistance >= safeLimit - Tol)+ {+ diagnostics.Add("edge-profile-x1-chamfer-distance-too-large-rejected");+ return Stop(c.Name, LabProfileStatus.Failed, diagnostics, "profile-chamfer-extrude-invalid-rejected");+ }++ var profilePoints = BuildChamferedRectangle(c.Width, c.Depth, c.ChamferDistance, c.Corner);+ diagnostics.Add("edge-profile-x1-chamfered-profile-created");++ var labProfile = ToLabProfile(profilePoints);+ var validation = ResolvedProfile2DLab.Evaluate(c.Name, labProfile);+ diagnostics.AddRange(validation.Diagnostics);+ if (validation.Diagnostics.Contains("profile-loop-self-intersection", StringComparer.Ordinal))+ {+ diagnostics.Add("edge-profile-x1-profile-self-intersection-rejected");+ }++ if (validation.Status != LabProfileStatus.Succeeded)+ {+ var rec = validation.Diagnostics.Contains("profile-loop-self-intersection", StringComparer.Ordinal)+ ? "profile-chamfer-extrude-needs-profile-validation-hardening"+ : "profile-chamfer-extrude-invalid-rejected";+ return Stop(c.Name, validation.Status, diagnostics, rec);+ }++ diagnostics.Add("edge-profile-x1-profile-validated");+ diagnostics.Add("edge-profile-x1-profile-extrude-attempted");++ var profileResult = PolylineProfile2D.Create(profilePoints.Select(p => new ProfilePoint2D(p.X, p.Y)).ToArray());+ if (!profileResult.IsSuccess || profileResult.Value is null)+ {+ diagnostics.Add("edge-profile-x1-profile-extrude-failed:polyline-profile-validation");+ return Stop(c.Name, LabProfileStatus.Failed, diagnostics, "profile-chamfer-extrude-needs-profile-validation-hardening");+ }++ var frame = new ExtrudeFrame3D(+ new Point3D(0, 0, 0),+ Direction3D.Create(new Vector3D(0, 0, 1)),+ Direction3D.Create(new Vector3D(1, 0, 0)));+ var bodyResult = BrepExtrude.Create(profileResult.Value, frame, c.Height);+ if (!bodyResult.IsSuccess || bodyResult.Value is null)+ {+ diagnostics.Add("edge-profile-x1-profile-extrude-failed:brep-extrude-create");+ return Stop(c.Name, LabProfileStatus.Failed, diagnostics, "profile-chamfer-extrude-needs-emitter-parity-work");+ }++ var body = bodyResult.Value;+ diagnostics.Add("edge-profile-x1-profile-extrude-succeeded");+ diagnostics.Add("edge-profile-x1-no-air-edge-sweep-used");+ diagnostics.Add("edge-profile-x1-no-brep-bounded-chamfer-used");+ diagnostics.Add("edge-profile-x1-no-topology-graft-used");+ diagnostics.Add("edge-profile-x1-no-3d-boolean-used");++ var topology = SummarizeTopology(body, c);+ if (topology.ChamferFaceCount == 1)+ {+ diagnostics.Add("edge-profile-x1-chamfer-face-identified");+ }++ var step = SummarizeStep(body);+ var stepSucceeded = step.Exported && step.MissingRequiredMarkers.Count == 0 && step.UnexpectedPresentMarkers.Count == 0;+ diagnostics.Add(stepSucceeded ? "edge-profile-x1-step-smoke-succeeded" : "edge-profile-x1-step-smoke-failed:markers");++ var topologySucceeded = topology.BodyProduced+ && topology.VertexCount == 10+ && topology.EdgeCount == 15+ && topology.FaceCount == 7+ && topology.PlanarFaceCount == 7+ && topology.CylindricalFaceCount == 0+ && topology.SideFaceCount == 5+ && topology.ChamferFaceCount == 1;++ var recommendation = topologySucceeded && stepSucceeded+ ? "profile-chamfer-extrude-ready-for-production-evaluation"+ : "profile-chamfer-extrude-needs-emitter-parity-work";++ return new(+ c.Name,+ LabProfileStatus.Succeeded,+ topologySucceeded && stepSucceeded,+ topology,+ step,+ StableDiagnostics(diagnostics),+ recommendation);+ }++ private static IReadOnlyList<(double X, double Y)> BuildChamferedRectangle(double width, double depth, double chamferDistance, ProfileChamferCorner corner)+ {+ if (corner != ProfileChamferCorner.PositiveXPositiveY)+ {+ throw new ArgumentOutOfRangeException(nameof(corner), corner, "EDGE-PROFILE-X1 only supports the +X,+Y rectangle corner.");+ }++ var halfWidth = width * 0.5d;+ var halfDepth = depth * 0.5d;+ return+ [+ (-halfWidth, -halfDepth),+ (halfWidth, -halfDepth),+ (halfWidth, halfDepth - chamferDistance),+ (halfWidth - chamferDistance, halfDepth),+ (-halfWidth, halfDepth),+ ];+ }++ private static LabResolvedProfile2D ToLabProfile(IReadOnlyList<(double X, double Y)> points)+ {+ var curves = new List<LabAirCurve2D>(points.Count);+ for (var i = 0; i < points.Count; i++)+ {+ curves.Add(new LabAirLineSegment2D(points[i], points[(i + 1) % points.Count]));+ }++ return new LabResolvedProfile2D([new LabAirLoop2D(curves, "outer")]);+ }++ private static ProfileChamferExtrudeTopologySummary SummarizeTopology(BrepBody body, ProfileChamferExtrudeCase c)+ {+ var faceCount = body.Topology.Faces.Count();+ var planarFaceCount = body.Topology.Faces.Count(f => body.GetFaceSurface(f.Id).Kind == SurfaceGeometryKind.Plane);+ var cylindricalFaceCount = body.Topology.Faces.Count(f => body.GetFaceSurface(f.Id).Kind == SurfaceGeometryKind.Cylinder);+ var sideFaceCount = Math.Max(0, faceCount - 2);+ var chamferFaceCount = body.Topology.Faces.Count(f => IsChamferSideFace(body, f.Id, c));+ var bounds = FormattableString.Invariant($"[{(-c.Width * 0.5d):0.###},{(-c.Depth * 0.5d):0.###},0]..[{(c.Width * 0.5d):0.###},{(c.Depth * 0.5d):0.###},{c.Height:0.###}]");++ return new(+ true,+ body.Topology.Vertices.Count(),+ body.Topology.Edges.Count(),+ faceCount,+ planarFaceCount,+ cylindricalFaceCount,+ sideFaceCount,+ chamferFaceCount,+ body.Topology.Loops.Count(),+ body.Topology.Coedges.Count(),+ bounds);+ }++ private static bool IsChamferSideFace(BrepBody body, Aetheris.Kernel.Core.Topology.FaceId faceId, ProfileChamferExtrudeCase c)+ {+ var edges = body.GetEdges(faceId);+ var hasBottomBevel = false;+ var hasTopBevel = false;+ foreach (var edge in edges)+ {+ var curve = body.GetEdgeCurve(edge);+ if (curve.Kind != Aetheris.Kernel.Core.Geometry.CurveGeometryKind.Line3 || curve.Line3 is null)+ {+ continue;+ }++ var line = curve.Line3.Value;+ var origin = line.Origin;+ var direction = line.Direction.ToVector();+ var expectedLength = c.ChamferDistance * Math.Sqrt(2d);+ var isBevelDirection = Math.Abs(Math.Abs(direction.X) - (1d / Math.Sqrt(2d))) <= 1e-6+ && Math.Abs(Math.Abs(direction.Y) - (1d / Math.Sqrt(2d))) <= 1e-6+ && Math.Abs(direction.Z) <= 1e-6;+ if (!isBevelDirection)+ {+ continue;+ }++ var binding = body.Bindings.GetEdgeBinding(edge);+ var lengthMatches = binding.TrimInterval is { } trim && Math.Abs((trim.End - trim.Start) - expectedLength) <= 1e-6;+ if (!lengthMatches)+ {+ continue;+ }++ if (Math.Abs(origin.Z) <= 1e-6)+ {+ hasBottomBevel = true;+ }+ else if (Math.Abs(origin.Z - c.Height) <= 1e-6)+ {+ hasTopBevel = true;+ }+ }++ return hasBottomBevel && hasTopBevel;+ }++ private static ProfileChamferExtrudeStepSummary SummarizeStep(BrepBody body)+ {+ var export = Step242Exporter.ExportBody(body);+ if (!export.IsSuccess || export.Value is null)+ {+ return new(false, [], RequiredStepMarkers, ForbiddenStepMarkers, []);+ }++ var text = export.Value;+ var present = RequiredStepMarkers.Where(m => text.Contains(m, StringComparison.Ordinal)).OrderBy(m => m, StringComparer.Ordinal).ToArray();+ var missing = RequiredStepMarkers.Except(present, StringComparer.Ordinal).OrderBy(m => m, StringComparer.Ordinal).ToArray();+ var absent = ForbiddenStepMarkers.Where(m => !text.Contains(m, StringComparison.Ordinal)).OrderBy(m => m, StringComparer.Ordinal).ToArray();+ var unexpected = ForbiddenStepMarkers.Where(m => text.Contains(m, StringComparison.Ordinal)).OrderBy(m => m, StringComparer.Ordinal).ToArray();+ return new(true, present, missing, absent, unexpected);+ }++ private static ProfileChamferExtrudeRow Stop(string name, LabProfileStatus status, List<string> diagnostics, string recommendation)+ {+ var rec = AllowedRecommendations.Contains(recommendation) ? recommendation : "profile-chamfer-extrude-deferred";+ return new(name, status, false, EmptyTopology(), new(false, [], RequiredStepMarkers, ForbiddenStepMarkers, []), StableDiagnostics(diagnostics), rec);+ }++ private static ProfileChamferExtrudeTopologySummary EmptyTopology() => new(false, 0, 0, 0, 0, 0, 0, 0, 0, 0, "empty");++ private static string[] StableDiagnostics(IEnumerable<string> diagnostics) => diagnostics.Distinct(StringComparer.Ordinal).OrderBy(x => x, StringComparer.Ordinal).ToArray();++ private static bool FinitePositive(double value) => double.IsFinite(value) && value > Tol;+}diff --git a/Aetheris.FrictionLab.Tests/CIRLab/ProfileChamferExtrudeLabTests.cs b/Aetheris.FrictionLab.Tests/CIRLab/ProfileChamferExtrudeLabTests.csnew file mode 100644index 00000000..5c158588--- /dev/null+++ b/Aetheris.FrictionLab.Tests/CIRLab/ProfileChamferExtrudeLabTests.cs@@ -0,0 +1,125 @@+using Aetheris.Firmament.FrictionLab.CIRLab;++namespace Aetheris.FrictionLab.Tests.CIRLab;++public class ProfileChamferExtrudeLabTests+{+ private static string Stable(ProfileChamferExtrudeRow r) => string.Join("|",+ r.CaseName,+ r.Status,+ r.Succeeded,+ r.Topology.VertexCount,+ r.Topology.EdgeCount,+ r.Topology.FaceCount,+ r.Topology.PlanarFaceCount,+ r.Topology.CylindricalFaceCount,+ r.Topology.SideFaceCount,+ r.Topology.ChamferFaceCount,+ r.Topology.LoopCount,+ r.Topology.CoedgeCount,+ r.Topology.Bounds,+ string.Join(",", r.Step.PresentMarkers.OrderBy(x => x, StringComparer.Ordinal)),+ string.Join(",", r.Step.MissingRequiredMarkers.OrderBy(x => x, StringComparer.Ordinal)),+ string.Join(",", r.Step.AbsentMarkers.OrderBy(x => x, StringComparer.Ordinal)),+ string.Join(",", r.Step.UnexpectedPresentMarkers.OrderBy(x => x, StringComparer.Ordinal)),+ string.Join(",", r.Diagnostics.OrderBy(x => x, StringComparer.Ordinal)),+ r.Recommendation);++ [Fact]+ public void ProfileChamferExtrudeLab_IsDeterministic()+ {+ var first = ProfileChamferExtrudeLab.RunAll();+ var second = ProfileChamferExtrudeLab.RunAll();++ Assert.Equal(first.Select(Stable), second.Select(Stable));+ }++ [Theory]+ [InlineData("canonical-centered-box", "[-5,-4,0]..[5,4,6]")]+ [InlineData("larger-valid-chamfer", "[-5,-4,0]..[5,4,6]")]+ [InlineData("non-square-rectangle", "[-6,-2.5,0]..[6,2.5,7]")]+ public void ProfileChamferExtrudeLab_ValidCasesEmitExpectedTopology(string caseName, string expectedBounds)+ {+ var row = ProfileChamferExtrudeLab.RunAll().Single(x => x.CaseName == caseName);++ Assert.True(row.Succeeded);+ Assert.Equal(LabProfileStatus.Succeeded, row.Status);+ Assert.True(row.Topology.BodyProduced);+ Assert.Equal(10, row.Topology.VertexCount);+ Assert.Equal(15, row.Topology.EdgeCount);+ Assert.Equal(7, row.Topology.FaceCount);+ Assert.Equal(7, row.Topology.PlanarFaceCount);+ Assert.Equal(0, row.Topology.CylindricalFaceCount);+ Assert.Equal(5, row.Topology.SideFaceCount);+ Assert.Equal(1, row.Topology.ChamferFaceCount);+ Assert.Equal(7, row.Topology.LoopCount);+ Assert.Equal(30, row.Topology.CoedgeCount);+ Assert.Equal(expectedBounds, row.Topology.Bounds);+ Assert.Equal("profile-chamfer-extrude-ready-for-production-evaluation", row.Recommendation);+ }++ [Fact]+ public void ProfileChamferExtrudeLab_StepSmokePasses()+ {+ var row = ProfileChamferExtrudeLab.RunAll().Single(x => x.CaseName == "canonical-centered-box");++ Assert.True(row.Step.Exported);+ Assert.Empty(row.Step.MissingRequiredMarkers);+ Assert.Empty(row.Step.UnexpectedPresentMarkers);+ Assert.Contains("ISO-10303-21", row.Step.PresentMarkers);+ Assert.Contains("MANIFOLD_SOLID_BREP", row.Step.PresentMarkers);+ Assert.Contains("ADVANCED_FACE", row.Step.PresentMarkers);+ Assert.Contains("PLANE", row.Step.PresentMarkers);+ Assert.Contains("CYLINDRICAL_SURFACE", row.Step.AbsentMarkers);+ Assert.Contains("BREP_WITH_VOIDS", row.Step.AbsentMarkers);+ Assert.Contains("edge-profile-x1-step-smoke-succeeded", row.Diagnostics);+ }++ [Fact]+ public void ProfileChamferExtrudeLab_CandidatePathExcludesEdgeSweepChamferMutationAndBoolean()+ {+ var row = ProfileChamferExtrudeLab.RunAll().Single(x => x.CaseName == "canonical-centered-box");++ Assert.Contains("edge-profile-x1-no-air-edge-sweep-used", row.Diagnostics);+ Assert.Contains("edge-profile-x1-no-brep-bounded-chamfer-used", row.Diagnostics);+ Assert.Contains("edge-profile-x1-no-topology-graft-used", row.Diagnostics);+ Assert.Contains("edge-profile-x1-no-3d-boolean-used", row.Diagnostics);+ Assert.Contains("edge-profile-x1-chamfer-face-identified", row.Diagnostics);+ }++ [Theory]+ [InlineData("invalid-zero-chamfer-distance", "edge-profile-x1-invalid-chamfer-distance-rejected")]+ [InlineData("invalid-too-large-chamfer-distance", "edge-profile-x1-chamfer-distance-too-large-rejected")]+ [InlineData("invalid-width", "edge-profile-x1-invalid-dimensions-rejected")]+ [InlineData("invalid-depth", "edge-profile-x1-invalid-dimensions-rejected")]+ [InlineData("invalid-height", "edge-profile-x1-invalid-dimensions-rejected")]+ [InlineData("invalid-non-finite-width", "edge-profile-x1-invalid-dimensions-rejected")]+ public void ProfileChamferExtrudeLab_InvalidCasesRejectBeforeExtrusion(string caseName, string expectedDiagnostic)+ {+ var row = ProfileChamferExtrudeLab.RunAll().Single(x => x.CaseName == caseName);++ Assert.False(row.Succeeded);+ Assert.False(row.Topology.BodyProduced);+ Assert.Contains(expectedDiagnostic, row.Diagnostics);+ Assert.DoesNotContain("edge-profile-x1-profile-extrude-attempted", row.Diagnostics);+ Assert.Equal("profile-chamfer-extrude-invalid-rejected", row.Recommendation);+ }++ [Fact]+ public void ProfileChamferExtrudeLab_RecommendationsAreFinite()+ {+ var allowed = new HashSet<string>(StringComparer.Ordinal)+ {+ "profile-chamfer-extrude-ready-for-production-evaluation",+ "profile-chamfer-extrude-needs-profile-validation-hardening",+ "profile-chamfer-extrude-needs-emitter-parity-work",+ "profile-chamfer-extrude-invalid-rejected",+ "profile-chamfer-extrude-deferred",+ };++ foreach (var row in ProfileChamferExtrudeLab.RunAll())+ {+ Assert.Contains(row.Recommendation, allowed);+ }+ }+}diff --git a/docs/aetheris-v2-sweep-first-architecture.md b/docs/aetheris-v2-sweep-first-architecture.mdindex 35d1976e..56c62c31 100644--- a/docs/aetheris-v2-sweep-first-architecture.md+++ b/docs/aetheris-v2-sweep-first-architecture.md@@ -86,7 +86,7 @@ V2 directive:- Prefer subtractive intent realization in profile/AIR space (e.g., profile-stack intervals, layered radii, resolved profile region normalization).- Use 3D subtract only when intent cannot be declared from bounded constructive relations.-EDGE-A2 constructive chamfer note: chamfers follow the same rule. When construction context is available, a chamfer may be a profile modification, a profile-stack/section transition, or a direct final-topology construction manifest. Do not trim a BRep, edge-sweep a local patch, or mutate an already-emitted sharp body when the chamfered final topology can be emitted from the constructive profile/stack/corner context from the start.+EDGE-A2 constructive chamfer note: chamfers follow the same rule. When construction context is available, a chamfer may be a profile modification, a profile-stack/section transition, or a direct final-topology construction manifest. Do not trim a BRep, edge-sweep a local patch, or mutate an already-emitted sharp body when the chamfered final topology can be emitted from the constructive profile/stack/corner context from the start. EDGE-PROFILE-X1 validates the simplest vertical-edge case as `rectangle -> chamfered pentagon -> extrude`, with the bevel face emitted as an ordinary side face and no AirEdgeSweep, BRep chamfer mutation, topology graft, or 3D Boolean fallback.This direction is consistent with:diff --git a/docs/edge-a1-chamfer-fillet-support-compatibility-matrix.md b/docs/edge-a1-chamfer-fillet-support-compatibility-matrix.mdindex 64225eca..22d397db 100644--- a/docs/edge-a1-chamfer-fillet-support-compatibility-matrix.md+++ b/docs/edge-a1-chamfer-fillet-support-compatibility-matrix.md@@ -8,7 +8,7 @@ The current AirChamfer golden path is strong but narrow: controlled convex planaLegacy bounded chamfer/fillet behavior remains authoritative wherever production behavior exists. In particular, `BrepBoundedChamfer` and `BrepBoundedFillet` are still the production routes for the currently supported bounded cases, and AirEdgeSweep/AirChamfer evidence must not be read as route replacement.-EDGE-A2 reclassifies some chamfer cases as profile/profile-stack candidates rather than AirEdgeSweep candidates: vertical edges of history-known extrusions should be tested as profile modifications, and top/bottom extrusion edges should be tested as profile-stack or section-transition constructions. Matrix statuses remain unchanged until those labs produce evidence.+EDGE-A2 reclassifies some chamfer cases as profile/profile-stack candidates rather than AirEdgeSweep candidates: vertical edges of history-known extrusions should be tested as profile modifications, and top/bottom extrusion edges should be tested as profile-stack or section-transition constructions. EDGE-PROFILE-X1 now provides lab evidence for the vertical-edge/profile-authored subset only; production statuses remain unchanged until a production-adjacent route is admitted.The matrix separates five concerns that were previously easy to conflate:@@ -142,7 +142,7 @@ This path is not production-authoritative. It does not support chains, corners,|---|---|---|---|---|---|---|---|---|---|---|---|---|| CH-01 | concave/additive | plane-plane, orthogonal | single edge | constant chamfer distance | no corner | plane | `production-legacy-supported` where bounded internal concave route applies | `lab-supported`; `policy-supported` | EDGE-X1 inventory; EDGE-X2 concave planar patch proof; EDGE-X2.1 policy scaffold | production Air route, shadow parity, corpus | Legacy production only; Air is lab/policy evidence | Preserve legacy; use as concave AirChamfer baseline || CH-02 | concave/additive | plane-plane, non-orthogonal | single edge | constant chamfer distance | no corner | plane | `unknown/no-test` to `production-legacy-supported` only where existing bounded trusted contexts admit it | `lab-supported`; `policy-supported` | EDGE-X2.2 non-orthogonal concave planar policy+patch | production body mutation, feature-recognition parity, corpus | Not production Air-ready | Add parity/shadow fixture after convex route stabilizes |-| CH-03 | convex/replacement | plane-plane, orthogonal controlled body | single edge | constant chamfer distance | no corner | plane | `production-legacy-supported` for legacy bounded box/simple contexts | `production-adjacent-air-prototype`; `shadow-supported`; `artifact-corpus-supported`; `closed-witness-supported`; `gated-opt-in-route-supported` | EDGE-X3 through EDGE-X13, EDGE-V1/V2/V3/V4, CLI tests, FrictionLab AirChamfer tests, Firmament shadow-diagnostics and opt-in route tests | default production authority, arbitrary body mutation beyond controlled fixture | Best current AirChamfer row; EDGE-V4 adds gated internal/test-only controlled route evidence, still not default production-authoritative | EDGE-V5 one additional controlled opt-in fixture or EDGE-V4.1 fallback injection hardening |+| CH-03 | convex/replacement | plane-plane, orthogonal controlled body | single edge | constant chamfer distance | no corner | plane | `production-legacy-supported` for legacy bounded box/simple contexts | `production-adjacent-air-prototype`; `shadow-supported`; `artifact-corpus-supported`; `closed-witness-supported`; `gated-opt-in-route-supported`; `profile-authored-lab-supported` for history-known vertical extrusion edges | EDGE-X3 through EDGE-X13, EDGE-V1/V2/V3/V4, EDGE-PROFILE-X1, CLI tests, FrictionLab AirChamfer tests, ProfileChamfer tests, Firmament shadow-diagnostics and opt-in route tests | default production authority, arbitrary body mutation beyond controlled fixture, production-adjacent profile chamfer admission | Best current AirChamfer row for no-history/local-edge fixtures; EDGE-PROFILE-X1 separately proves history-known vertical-edge chamfer can be emitted as profile extrusion, still not production-authoritative | EDGE-PROFILE-V1 profile-authored production-adjacent emitter or EDGE-V5 one additional controlled opt-in fixture || CH-04 | convex/replacement | plane-plane, non-orthogonal controlled body | single edge | constant chamfer distance | no corner | plane | `production-legacy-supported` only for admitted trusted/triangle-like bounded contexts; otherwise `unknown/no-test` | `shadow-supported`; `artifact-corpus-supported`; `production-adjacent-air-prototype` for safe controlled case | EDGE-X11 non-orthogonal corpus row; EDGE-X12 stability; EDGE-V3 shadow route | broader topology mutation, richer feature-recognition parity, production fallback | Non-authoritative controlled evidence only | Harden controlled non-orthogonal shadow diagnostics || CH-05 | convex/replacement | plane-plane | single edge on arbitrary production body | constant chamfer distance | no corner or endpoint transition as needed | plane | `production-legacy-supported` only for legacy recognized bounded cases | `deferred`; `blocked-by-body-mutation`; partial `production-adjacent-air-prototype` for controlled body | EDGE-V2/V3 controlled prototype and shadow docs | arbitrary edge selection, grafting, identity, regression corpus | Not production Air-ready | EDGE-X15 convex AirChamfer controlled body mutation hardening || CH-06 | convex/replacement | plane-plane | edge chain | constant chamfer distance | chain termination; endpoint transitions | plane sequence plus transition patches | legacy support is bounded/contextual; generic status `unknown/no-test` | `deferred`; `blocked-by-corner-policy`; `blocked-by-body-mutation` | EDGE-V3 deferred edge-chain diagnostics; EDGE-X1 notes | chain policy, termination policy, topology plan, feature-recognition parity | Not ready | EDGE-X16 AirChamfer edge-chain policy lab |diff --git a/docs/edge-a2-constructive-chamfer-reframing-audit.md b/docs/edge-a2-constructive-chamfer-reframing-audit.mdindex 1e74db4d..c21424e4 100644--- a/docs/edge-a2-constructive-chamfer-reframing-audit.md+++ b/docs/edge-a2-constructive-chamfer-reframing-audit.md@@ -19,6 +19,8 @@ This audit concludes:The recommended convergence state is **success** for a docs/design audit: no production route changed, the theory is classified, and the smallest falsifiable lab sequence is now explicit.+EDGE-PROFILE-X1 follow-up: `ProfileChamferExtrudeLab` now exercises that smallest vertical-edge profile-chamfer sequence. It builds a chamfered rectangle/pentagon, emits it with `BrepExtrude.Create`, exports it through `Step242Exporter`, and records `10` vertices, `15` edges, `7` planar faces, `0` cylindrical faces, and one bevel side face without AirEdgeSweep, `BrepBoundedChamfer`, topology grafting, or 3D Boolean fallback. See `docs/frictionlab/edge-profile-x1-vertical-edge-chamfer-profile-extrude-lab.md`.+## 2. Theory under auditThe audit tests a V2-compatible chamfer decomposition: do not trim if construction history can emit the final body directly.diff --git a/docs/frictionlab/edge-profile-x1-vertical-edge-chamfer-profile-extrude-lab.md b/docs/frictionlab/edge-profile-x1-vertical-edge-chamfer-profile-extrude-lab.mdnew file mode 100644index 00000000..07fffd9b--- /dev/null+++ b/docs/frictionlab/edge-profile-x1-vertical-edge-chamfer-profile-extrude-lab.md@@ -0,0 +1,154 @@+# EDGE-PROFILE-X1 — Vertical-edge chamfer as profile extrusion lab++## Purpose and scope++EDGE-PROFILE-X1 is a lab-only proof that a vertical-edge chamfer on a rectangular prism can be authored as profile geometry before extrusion. It validates the EDGE-A2 constructive chamfer reframing for the narrow history-known case where the selected edge is parallel to the extrusion axis.++The lab does **not** change production chamfer or fillet behavior. It does not change public APIs, STEP export/import, Boolean core behavior, AirEdgeSweep behavior, triangle migration, sketch solving, clipping, or NURBS/freeform support.++## EDGE-A2 reference++`docs/edge-a2-constructive-chamfer-reframing-audit.md` classifies vertical extrusion-edge chamfers as profile modifications: the sharp edge should not be emitted and then trimmed. Instead, the rectangle corner is replaced by a bevel segment in 2D, and the final pentagonal profile is extruded directly.++## Theory++For a centered rectangle with width `w` and depth `d`, the unchamfered profile is:++1. `(-w/2, -d/2)`+2. `( w/2, -d/2)`+3. `( w/2, d/2)`+4. `(-w/2, d/2)`++For the `+X,+Y` vertical edge, EDGE-PROFILE-X1 replaces corner `(w/2, d/2)` with two offset points:++- `(w/2, d/2 - chamferDistance)`+- `(w/2 - chamferDistance, d/2)`++The result is a five-line pentagon. Extruding that pentagon along +Z directly emits the chamfered rectangular prism. The bevel face is the side face corresponding to the inserted bevel segment.++## Candidate construction++The lab implementation is `ProfileChamferExtrudeLab` in `Aetheris.Firmament.FrictionLab/CIRLab/ProfileChamferExtrudeLab.cs`.++Construction steps:++1. Validate finite positive `width`, `depth`, and `height`.+2. Validate finite positive `chamferDistance` and reject distances greater than or equal to half of the smaller adjacent rectangle dimension.+3. Build the line-only pentagon profile for the `+X,+Y` corner.+4. Validate the profile through the lab `ResolvedProfile2DLab` contract.+5. Lower through `BrepExtrude.Create` using an `ExtrudeFrame3D` with origin `(0,0,0)`, +Z normal, and +X U axis.+6. Export the resulting body with the existing `Step242Exporter`.+7. Summarize topology, STEP smoke markers, diagnostics, and recommendation.++`BrepExtrude.Create` was used because it is the direct existing polyline extrusion route for a single line-only outer loop. The result remains aligned with the V2 profile doctrine: the candidate path authors the chamfer in 2D profile space and emits the final prism directly.++## Test cases and results++Valid cases:++| Case | Width | Depth | Height | Chamfer distance | Result |+|---|---:|---:|---:|---:|---|+| `canonical-centered-box` | 10 | 8 | 6 | 1 | Succeeds |+| `larger-valid-chamfer` | 10 | 8 | 6 | 2 | Succeeds |+| `non-square-rectangle` | 12 | 5 | 7 | 1 | Succeeds |++Invalid cases reject before extrusion:++| Case | Reason |+|---|---|+| `invalid-zero-chamfer-distance` | `chamferDistance <= 0` |+| `invalid-too-large-chamfer-distance` | `chamferDistance >= min(width, depth) / 2` |+| `invalid-width` | non-positive width |+| `invalid-depth` | non-positive depth |+| `invalid-height` | non-positive height |+| `invalid-non-finite-width` | non-finite dimension |++## Topology findings++The valid EDGE-PROFILE-X1 cases produce the expected one-corner vertical-edge chamfered prism topology:++| Metric | Expected | Observed |+|---|---:|---:|+| Profile vertices | 5 | 5 |+| Body vertices | 10 | 10 |+| Edges | 15 | 15 |+| Faces | 7 | 7 |+| Cap faces | 2 | 2 |+| Side faces | 5 | 5 |+| Chamfer/bevel side faces | 1 | 1 |+| Planar faces | 7 | 7 |+| Cylindrical faces | 0 | 0 |+| Loops | 7 | 7 |+| Coedges | 30 | 30 |++Canonical bounds are `[-5,-4,0]..[5,4,6]`.++## STEP smoke findings++The existing `Step242Exporter` successfully exports the valid lab body.++Required markers are present:++- `ISO-10303-21`+- `MANIFOLD_SOLID_BREP`+- `ADVANCED_FACE`+- `PLANE`++Forbidden markers are absent:++- `CYLINDRICAL_SURFACE`+- `BREP_WITH_VOIDS`++## Optional legacy comparison status++Legacy comparison is deferred for this milestone. The expected count pattern matches the bounded one-corner box chamfer family (`10` vertices, `15` edges, `7` faces, all planar), but EDGE-PROFILE-X1 intentionally avoids contorting the lab around legacy face/edge identifiers or corner conventions. The lab evidence is the direct profile-extrusion construction itself.++## No-trim/no-graft/no-AirEdgeSweep/no-Boolean guarantee++The candidate path does not call or route through:++- `AirEdgeSweep`+- `BrepBoundedChamfer`+- topology graft/body mutation code+- 3D Boolean fallback+- BRep trimming/splitting/stitching++The lab records deterministic diagnostics for successful candidate cases:++- `edge-profile-x1-no-air-edge-sweep-used`+- `edge-profile-x1-no-brep-bounded-chamfer-used`+- `edge-profile-x1-no-topology-graft-used`+- `edge-profile-x1-no-3d-boolean-used`++## Invalid/rejected cases++Invalid cases are rejected before extrusion with machine-checkable diagnostics:++- `edge-profile-x1-invalid-dimensions-rejected`+- `edge-profile-x1-invalid-chamfer-distance-rejected`+- `edge-profile-x1-chamfer-distance-too-large-rejected`++The profile validation path can also surface `edge-profile-x1-profile-self-intersection-rejected` if a future case introduces a self-intersecting profile.++## Non-goals++EDGE-PROFILE-X1 does not attempt:++- production route replacement;+- top-edge or horizontal-edge chamfers;+- profile-stack chamfers;+- three-edge/corner chamfers;+- AirEdgeSweep route changes;+- STEP exporter/importer changes;+- Boolean core changes;+- triangle migration;+- sketch solver work;+- clipping engine work;+- NURBS/freeform support.++## Recommendation++The lab converges on `profile-chamfer-extrude-ready-for-production-evaluation` for the supported rectangular-prism vertical-edge case. Recommended next milestones:++1. **EDGE-PROFILE-V1**: production-adjacent profile chamfer emitter/admissibility work for history-known line-only prism edges.+2. **EDGE-PROFILE-X2**: profile-stack top-edge chamfer lab for edges perpendicular to the extrusion axis.