Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Add canonical cylindrical source geometry evidence for retained loop binding

Yuechen Li414bd05b803e
diff --git a/Aetheris.Kernel.Firmament.Tests/FacePatchCandidateDryRunTests.cs b/Aetheris.Kernel.Firmament.Tests/FacePatchCandidateDryRunTests.cs
index 17db3e98..10de59f7 100644
--- a/Aetheris.Kernel.Firmament.Tests/FacePatchCandidateDryRunTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FacePatchCandidateDryRunTests.cs
@@ -130,7 +130,7 @@ public sealed class FacePatchCandidateDryRunTests
}
[Fact]
- public void RetainedLoopBinding_PlanarCylinder_RealPipeline_DefersWithoutRadiusEvidence()
+ public void RetainedLoopBinding_BoxMinusCylinder_RealPipeline_BindsInnerCircle()
{
var root = new CirSubtractNode(new CirBoxNode(10, 10, 10), new CirCylinderNode(2, 8));
var result = FacePatchCandidateGenerator.Generate(root);
@@ -142,15 +142,15 @@ public sealed class FacePatchCandidateDryRunTests
.Select(l => l.CircularGeometry!.Value)
.ToArray();
- Assert.Empty(bound);
- Assert.Contains(result.Candidates.SelectMany(c => c.RetainedRegionLoops).Select(l => l.Diagnostic), d => d.Contains("loop-special-case-ready", StringComparison.OrdinalIgnoreCase));
+ Assert.NotEmpty(bound);
+ Assert.Contains(bound.Select(b => b.Diagnostic), d => d.Contains("canonical planar/cylindrical inner-circle geometry bound", StringComparison.OrdinalIgnoreCase));
}
[Fact]
- public void RetainedLoopBinding_PlanarCylinder_CreatesInnerCircleGeometry_WithManualRadiusEvidence()
+ public void RetainedLoopBinding_PlanarCylinder_CreatesInnerCircleGeometry_WithCylindricalEvidence()
{
- var source = new SourceSurfaceDescriptor(SurfacePatchFamily.Planar, null, BoundedPlanarPatchGeometry.CreateRectangle(new Point3D(-1, -1, 0), new Point3D(1, -1, 0), new Point3D(1, 1, 0), new Point3D(-1, 1, 0), new Vector3D(0, 0, 1)), Transform3D.Identity, "source", nameof(CirBoxNode), 1, FacePatchOrientationRole.Forward);
- var opposite = new SourceSurfaceDescriptor(SurfacePatchFamily.Cylindrical, "radius:2", null, Transform3D.Identity, "tool", nameof(CirCylinderNode), 2, FacePatchOrientationRole.Forward);
+ var source = new SourceSurfaceDescriptor(SurfacePatchFamily.Planar, null, BoundedPlanarPatchGeometry.CreateRectangle(new Point3D(-1, -1, 0), new Point3D(1, -1, 0), new Point3D(1, 1, 0), new Point3D(-1, 1, 0), new Vector3D(0, 0, 1)), null, Transform3D.Identity, "source", nameof(CirBoxNode), 1, FacePatchOrientationRole.Forward);
+ var opposite = new SourceSurfaceDescriptor(SurfacePatchFamily.Cylindrical, "side", null, new CylindricalSurfaceGeometryEvidence(new Point3D(0, 0, -4), new Vector3D(0, 0, 8), 2d, 8d, new Point3D(0, 0, -4), new Point3D(0, 0, 4)), Transform3D.Identity, "tool", nameof(CirCylinderNode), 2, FacePatchOrientationRole.Forward);
var ok = RetainedLoopGeometryBinder.TryBindCircularLoop(source, opposite, TrimCurveFamily.Circle, RetainedRegionLoopStatus.SpecialCaseReady, isBase: true, out _, out var circular);
@@ -167,12 +167,13 @@ public sealed class FacePatchCandidateDryRunTests
SurfacePatchFamily.Planar,
null,
BoundedPlanarPatchGeometry.CreateRectangle(new Point3D(0, 0, 0), new Point3D(1, 0, 0), new Point3D(1, 1, 0), new Point3D(0, 1, 0), new Vector3D(0, 0, 1)),
+ null,
Transform3D.Identity,
"source",
nameof(CirBoxNode),
1,
FacePatchOrientationRole.Forward);
- var opposite = new SourceSurfaceDescriptor(SurfacePatchFamily.Cylindrical, null, null, Transform3D.CreateRotationX(Math.PI * 0.5d), "tool", nameof(CirCylinderNode), 2, FacePatchOrientationRole.Forward);
+ var opposite = new SourceSurfaceDescriptor(SurfacePatchFamily.Cylindrical, null, null, null, Transform3D.CreateRotationX(Math.PI * 0.5d), "tool", nameof(CirCylinderNode), 2, FacePatchOrientationRole.Forward);
var ok = RetainedLoopGeometryBinder.TryBindCircularLoop(source, opposite, TrimCurveFamily.Circle, RetainedRegionLoopStatus.ExactReady, isBase: true, out var diagnostic, out var circular);
@@ -184,8 +185,8 @@ public sealed class FacePatchCandidateDryRunTests
[Fact]
public void RetainedLoopBinding_DoesNotBypassReadiness()
{
- var source = new SourceSurfaceDescriptor(SurfacePatchFamily.Planar, null, BoundedPlanarPatchGeometry.CreateRectangle(new Point3D(0, 0, 0), new Point3D(1, 0, 0), new Point3D(1, 1, 0), new Point3D(0, 1, 0), new Vector3D(0, 0, 1)), Transform3D.Identity, "source", nameof(CirBoxNode), 1, FacePatchOrientationRole.Forward);
- var opposite = new SourceSurfaceDescriptor(SurfacePatchFamily.Cylindrical, null, null, Transform3D.Identity, "tool", nameof(CirCylinderNode), 2, FacePatchOrientationRole.Forward);
+ var source = new SourceSurfaceDescriptor(SurfacePatchFamily.Planar, null, BoundedPlanarPatchGeometry.CreateRectangle(new Point3D(0, 0, 0), new Point3D(1, 0, 0), new Point3D(1, 1, 0), new Point3D(0, 1, 0), new Vector3D(0, 0, 1)), null, Transform3D.Identity, "source", nameof(CirBoxNode), 1, FacePatchOrientationRole.Forward);
+ var opposite = new SourceSurfaceDescriptor(SurfacePatchFamily.Cylindrical, null, null, null, Transform3D.Identity, "tool", nameof(CirCylinderNode), 2, FacePatchOrientationRole.Forward);
var ok = RetainedLoopGeometryBinder.TryBindCircularLoop(source, opposite, TrimCurveFamily.Circle, RetainedRegionLoopStatus.Deferred, isBase: true, out _, out var circular);
diff --git a/Aetheris.Kernel.Firmament.Tests/SurfacePatchDescriptorScaffoldTests.cs b/Aetheris.Kernel.Firmament.Tests/SurfacePatchDescriptorScaffoldTests.cs
index 45e5020b..d7f20d6a 100644
--- a/Aetheris.Kernel.Firmament.Tests/SurfacePatchDescriptorScaffoldTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/SurfacePatchDescriptorScaffoldTests.cs
@@ -11,7 +11,7 @@ public sealed class SurfacePatchDescriptorScaffoldTests
public void SourceSurfaceDescriptor_Box_ProducesSixPlanarDescriptors()
{
var descriptors = Enumerable.Range(0, 6)
- .Select(i => new SourceSurfaceDescriptor(SurfacePatchFamily.Planar, $"box-face-{i}", null, Transform3D.Identity, "cir:box", nameof(Aetheris.Kernel.Core.Cir.CirBoxNode), 0, FacePatchOrientationRole.Forward))
+ .Select(i => new SourceSurfaceDescriptor(SurfacePatchFamily.Planar, $"box-face-{i}", null, null, Transform3D.Identity, "cir:box", nameof(Aetheris.Kernel.Core.Cir.CirBoxNode), 0, FacePatchOrientationRole.Forward))
.ToArray();
Assert.Equal(6, descriptors.Length);
@@ -22,9 +22,9 @@ public sealed class SurfacePatchDescriptorScaffoldTests
[Fact]
public void SourceSurfaceDescriptor_Cylinder_ProducesCylindricalAndPlanarDescriptors()
{
- var side = new SourceSurfaceDescriptor(SurfacePatchFamily.Cylindrical, "side", null, Transform3D.Identity, "cir:cylinder:side", nameof(Aetheris.Kernel.Core.Cir.CirCylinderNode), 1, FacePatchOrientationRole.Forward);
- var top = new SourceSurfaceDescriptor(SurfacePatchFamily.Planar, "cap-top", null, Transform3D.Identity, "cir:cylinder:cap-top", nameof(Aetheris.Kernel.Core.Cir.CirCylinderNode), 1, FacePatchOrientationRole.Forward);
- var bottom = new SourceSurfaceDescriptor(SurfacePatchFamily.Planar, "cap-bottom", null, Transform3D.Identity, "cir:cylinder:cap-bottom", nameof(Aetheris.Kernel.Core.Cir.CirCylinderNode), 1, FacePatchOrientationRole.Reversed);
+ var side = new SourceSurfaceDescriptor(SurfacePatchFamily.Cylindrical, "side", null, null, Transform3D.Identity, "cir:cylinder:side", nameof(Aetheris.Kernel.Core.Cir.CirCylinderNode), 1, FacePatchOrientationRole.Forward);
+ var top = new SourceSurfaceDescriptor(SurfacePatchFamily.Planar, "cap-top", null, null, Transform3D.Identity, "cir:cylinder:cap-top", nameof(Aetheris.Kernel.Core.Cir.CirCylinderNode), 1, FacePatchOrientationRole.Forward);
+ var bottom = new SourceSurfaceDescriptor(SurfacePatchFamily.Planar, "cap-bottom", null, null, Transform3D.Identity, "cir:cylinder:cap-bottom", nameof(Aetheris.Kernel.Core.Cir.CirCylinderNode), 1, FacePatchOrientationRole.Reversed);
Assert.Equal(SurfacePatchFamily.Cylindrical, side.Family);
Assert.Equal(SurfacePatchFamily.Planar, top.Family);
@@ -34,14 +34,14 @@ public sealed class SurfacePatchDescriptorScaffoldTests
[Fact]
public void SourceSurfaceDescriptor_Sphere_ProducesSphericalDescriptor()
{
- var sphere = new SourceSurfaceDescriptor(SurfacePatchFamily.Spherical, "sphere", null, Transform3D.Identity, "cir:sphere", nameof(Aetheris.Kernel.Core.Cir.CirSphereNode), 2, FacePatchOrientationRole.Forward);
+ var sphere = new SourceSurfaceDescriptor(SurfacePatchFamily.Spherical, "sphere", null, null, Transform3D.Identity, "cir:sphere", nameof(Aetheris.Kernel.Core.Cir.CirSphereNode), 2, FacePatchOrientationRole.Forward);
Assert.Equal(SurfacePatchFamily.Spherical, sphere.Family);
}
[Fact]
public void SourceSurfaceDescriptor_Torus_ProducesToroidalDescriptorUnsupportedMaterializer()
{
- var source = new SourceSurfaceDescriptor(SurfacePatchFamily.Toroidal, "torus", null, Transform3D.Identity, "cir:torus", nameof(Aetheris.Kernel.Core.Cir.CirTorusNode), 3, FacePatchOrientationRole.Forward);
+ var source = new SourceSurfaceDescriptor(SurfacePatchFamily.Toroidal, "torus", null, null, Transform3D.Identity, "cir:torus", nameof(Aetheris.Kernel.Core.Cir.CirTorusNode), 3, FacePatchOrientationRole.Forward);
var patch = new FacePatchDescriptor(source, [], [], FacePatchOrientationRole.Forward, "tool-surface", []);
var eval = SurfaceFamilyMaterializerRegistry.Evaluate(patch);
@@ -53,7 +53,7 @@ public sealed class SurfacePatchDescriptorScaffoldTests
[Fact]
public void SurfaceFamilyRegistry_SelectsPlanarForPlanarPatch()
{
- var source = new SourceSurfaceDescriptor(SurfacePatchFamily.Planar, "plane", null, Transform3D.Identity, "cir:box", nameof(Aetheris.Kernel.Core.Cir.CirBoxNode), 0, FacePatchOrientationRole.Forward);
+ var source = new SourceSurfaceDescriptor(SurfacePatchFamily.Planar, "plane", null, null, Transform3D.Identity, "cir:box", nameof(Aetheris.Kernel.Core.Cir.CirBoxNode), 0, FacePatchOrientationRole.Forward);
var trim = new TrimCurveDescriptor(TrimCurveFamily.Line, "edge-0", "loop:outer", 0, new ParameterInterval(0, 1), TrimCurveCapability.ExactSupported);
var patch = new FacePatchDescriptor(source, [trim], [], FacePatchOrientationRole.Forward, "outer", []);
@@ -66,7 +66,7 @@ public sealed class SurfacePatchDescriptorScaffoldTests
[Fact]
public void SurfaceFamilyRegistry_RejectsWrongFamilyWithReasons()
{
- var source = new SourceSurfaceDescriptor(SurfacePatchFamily.Spherical, "sphere", null, Transform3D.Identity, "cir:sphere", nameof(Aetheris.Kernel.Core.Cir.CirSphereNode), 4, FacePatchOrientationRole.Forward);
+ var source = new SourceSurfaceDescriptor(SurfacePatchFamily.Spherical, "sphere", null, null, Transform3D.Identity, "cir:sphere", nameof(Aetheris.Kernel.Core.Cir.CirSphereNode), 4, FacePatchOrientationRole.Forward);
var patch = new FacePatchDescriptor(source, [], [], FacePatchOrientationRole.Forward, "outer", []);
var eval = SurfaceFamilyMaterializerRegistry.Evaluate(patch);
@@ -79,7 +79,7 @@ public sealed class SurfacePatchDescriptorScaffoldTests
[Fact]
public void PlanarSurfaceMaterializer_UntrimmedBoxFace_EmitsPlanarTopology()
{
- var source = new SourceSurfaceDescriptor(SurfacePatchFamily.Planar, "rect3d:-1,-1,0;1,-1,0;1,1,0;-1,1,0", null, Transform3D.Identity, "cir:box:face", nameof(CirBoxNode), 0, FacePatchOrientationRole.Forward);
+ var source = new SourceSurfaceDescriptor(SurfacePatchFamily.Planar, "rect3d:-1,-1,0;1,-1,0;1,1,0;-1,1,0", null, null, Transform3D.Identity, "cir:box:face", nameof(CirBoxNode), 0, FacePatchOrientationRole.Forward);
var patch = new FacePatchDescriptor(source, [], [], FacePatchOrientationRole.Forward, "outer", []);
var readiness = new MaterializationReadinessReport(true, EmissionReadiness.EvidenceReadyForEmission, [], [], 1, 1, 1, 0, 0, 0, 0, [], false);
@@ -96,7 +96,7 @@ public sealed class SurfacePatchDescriptorScaffoldTests
[Fact]
public void PlanarSurfaceMaterializer_RejectsDeferredReadiness()
{
- var source = new SourceSurfaceDescriptor(SurfacePatchFamily.Planar, "rect3d:0,0,0;1,0,0;1,1,0;0,1,0", null, Transform3D.Identity, "cir:box:face", nameof(CirBoxNode), 0, FacePatchOrientationRole.Forward);
+ var source = new SourceSurfaceDescriptor(SurfacePatchFamily.Planar, "rect3d:0,0,0;1,0,0;1,1,0;0,1,0", null, null, Transform3D.Identity, "cir:box:face", nameof(CirBoxNode), 0, FacePatchOrientationRole.Forward);
var patch = new FacePatchDescriptor(source, [], [], FacePatchOrientationRole.Forward, "outer", []);
var readiness = new MaterializationReadinessReport(true, EmissionReadiness.Deferred, [EmissionBlockingReason.TopologyPlanning], [], 1, 1, 1, 0, 0, 0, 0, [], false);
@@ -109,7 +109,7 @@ public sealed class SurfacePatchDescriptorScaffoldTests
[Fact]
public void PlanarSurfaceMaterializer_RejectsNonPlanarPatch()
{
- var source = new SourceSurfaceDescriptor(SurfacePatchFamily.Spherical, "sphere", null, Transform3D.Identity, "cir:sphere", nameof(CirSphereNode), 0, FacePatchOrientationRole.Forward);
+ var source = new SourceSurfaceDescriptor(SurfacePatchFamily.Spherical, "sphere", null, null, Transform3D.Identity, "cir:sphere", nameof(CirSphereNode), 0, FacePatchOrientationRole.Forward);
var patch = new FacePatchDescriptor(source, [], [], FacePatchOrientationRole.Forward, "outer", []);
var readiness = new MaterializationReadinessReport(true, EmissionReadiness.EvidenceReadyForEmission, [], [], 1, 1, 1, 0, 0, 0, 0, [], false);
@@ -121,7 +121,7 @@ public sealed class SurfacePatchDescriptorScaffoldTests
[Fact]
public void PlanarSurfaceMaterializer_RejectsTrimmedCircularPatch()
{
- var source = new SourceSurfaceDescriptor(SurfacePatchFamily.Planar, "rect3d:0,0,0;1,0,0;1,1,0;0,1,0", null, Transform3D.Identity, "cir:box:face", nameof(CirBoxNode), 0, FacePatchOrientationRole.Forward);
+ var source = new SourceSurfaceDescriptor(SurfacePatchFamily.Planar, "rect3d:0,0,0;1,0,0;1,1,0;0,1,0", null, null, Transform3D.Identity, "cir:box:face", nameof(CirBoxNode), 0, FacePatchOrientationRole.Forward);
var trim = new TrimCurveDescriptor(TrimCurveFamily.Circle, "circle", "outer", 0, new ParameterInterval(0, 2 * double.Pi), TrimCurveCapability.ExactSupported);
var patch = new FacePatchDescriptor(source, [trim], [], FacePatchOrientationRole.Forward, "outer", []);
var readiness = new MaterializationReadinessReport(true, EmissionReadiness.EvidenceReadyForEmission, [], [], 1, 1, 1, 0, 0, 0, 0, [], false);
@@ -146,7 +146,7 @@ public sealed class SurfacePatchDescriptorScaffoldTests
[Fact]
public void PlanarSurfaceMaterializer_TrimmedCircularInnerLoop_RespectsPolicy()
{
- var source = new SourceSurfaceDescriptor(SurfacePatchFamily.Planar, "rect3d:-2,-2,0;2,-2,0;2,2,0;-2,2,0", null, Transform3D.Identity, "cir:box:face", nameof(CirBoxNode), 0, FacePatchOrientationRole.Forward);
+ var source = new SourceSurfaceDescriptor(SurfacePatchFamily.Planar, "rect3d:-2,-2,0;2,-2,0;2,2,0;-2,2,0", null, null, Transform3D.Identity, "cir:box:face", nameof(CirBoxNode), 0, FacePatchOrientationRole.Forward);
var inner = new TrimCurveDescriptor(TrimCurveFamily.Circle, "inner-circle", "inner", 1, new ParameterInterval(0, 2 * double.Pi), TrimCurveCapability.ExactSupported);
var patch = new FacePatchDescriptor(source, [], [[inner]], FacePatchOrientationRole.Forward, "outer", []);
var readiness = new MaterializationReadinessReport(true, EmissionReadiness.EvidenceReadyForEmission, [], [], 1, 1, 1, 0, 0, 0, 0, [], false);
@@ -161,7 +161,7 @@ public sealed class SurfacePatchDescriptorScaffoldTests
[Fact]
public void PlanarSurfaceMaterializer_RejectsMultipleInnerLoops()
{
- var source = new SourceSurfaceDescriptor(SurfacePatchFamily.Planar, "rect3d:-2,-2,0;2,-2,0;2,2,0;-2,2,0", null, Transform3D.Identity, "cir:box:face", nameof(CirBoxNode), 0, FacePatchOrientationRole.Forward);
+ var source = new SourceSurfaceDescriptor(SurfacePatchFamily.Planar, "rect3d:-2,-2,0;2,-2,0;2,2,0;-2,2,0", null, null, Transform3D.Identity, "cir:box:face", nameof(CirBoxNode), 0, FacePatchOrientationRole.Forward);
var innerA = new TrimCurveDescriptor(TrimCurveFamily.Circle, "inner-circle-a", "inner", 1, new ParameterInterval(0, 2 * double.Pi), TrimCurveCapability.ExactSupported);
var innerB = new TrimCurveDescriptor(TrimCurveFamily.Circle, "inner-circle-b", "inner", 2, new ParameterInterval(0, 2 * double.Pi), TrimCurveCapability.ExactSupported);
var patch = new FacePatchDescriptor(source, [], [[innerA], [innerB]], FacePatchOrientationRole.Forward, "outer", []);
@@ -177,7 +177,7 @@ public sealed class SurfacePatchDescriptorScaffoldTests
[Fact]
public void PlanarPayloadBuilder_RejectsNonPlanarSource()
{
- var source = new SourceSurfaceDescriptor(SurfacePatchFamily.Spherical, "sphere", null, Transform3D.Identity, "cir:sphere", nameof(CirSphereNode), 0, FacePatchOrientationRole.Forward);
+ var source = new SourceSurfaceDescriptor(SurfacePatchFamily.Spherical, "sphere", null, null, Transform3D.Identity, "cir:sphere", nameof(CirSphereNode), 0, FacePatchOrientationRole.Forward);
var success = PlanarPatchPayloadBuilder.TryBuildRectanglePayload(source, out _, out var diagnostic);
Assert.False(success);
Assert.Contains("not planar", diagnostic, StringComparison.OrdinalIgnoreCase);
@@ -234,6 +234,31 @@ public sealed class SurfacePatchDescriptorScaffoldTests
Assert.Equal(5d, bottom.BoundedPlanarGeometry!.Value.Radius, 8);
}
+ [Fact]
+ public void SourceSurfaceExtractor_CylinderSide_HasCylindricalEvidence()
+ {
+ var extraction = SourceSurfaceExtractor.Extract(new CirCylinderNode(5, 20));
+ var side = Assert.Single(extraction.Descriptors.Where(d => d.Family == SurfacePatchFamily.Cylindrical));
+ var evidence = Assert.IsType<CylindricalSurfaceGeometryEvidence>(side.CylindricalGeometryEvidence!.Value);
+ Assert.Equal(new Point3D(0, 0, -10), evidence.AxisOrigin);
+ Assert.Equal(5d, evidence.Radius, 8);
+ Assert.Equal(20d, evidence.Height, 8);
+ Assert.Equal(new Point3D(0, 0, -10), evidence.BottomCenter);
+ Assert.Equal(new Point3D(0, 0, 10), evidence.TopCenter);
+ }
+
+ [Fact]
+ public void SourceSurfaceExtractor_CylinderSide_TranslationTransform_PreservesEvidence()
+ {
+ var extraction = SourceSurfaceExtractor.Extract(new CirTransformNode(new CirCylinderNode(5, 20), Transform3D.CreateTranslation(new Vector3D(2, -3, 7))));
+ var side = Assert.Single(extraction.Descriptors.Where(d => d.Family == SurfacePatchFamily.Cylindrical));
+ var evidence = Assert.IsType<CylindricalSurfaceGeometryEvidence>(side.CylindricalGeometryEvidence!.Value);
+ Assert.Equal(new Point3D(2, -3, -3), evidence.AxisOrigin);
+ Assert.Equal(new Point3D(2, -3, -3), evidence.BottomCenter);
+ Assert.Equal(new Point3D(2, -3, 17), evidence.TopCenter);
+ Assert.Equal(5d, evidence.Radius, 8);
+ }
+
[Fact]
public void PlanarPayloadBuilder_RejectsCircularCapGeometry()
{
@@ -355,7 +380,7 @@ public sealed class SurfacePatchDescriptorScaffoldTests
[Fact]
public void PlanarPayloadBuilder_RejectsDescriptorWithoutBoundedGeometry()
{
- var roleOnly = new SourceSurfaceDescriptor(SurfacePatchFamily.Planar, "top", null, Transform3D.Identity, "cir:box:top", nameof(CirBoxNode), 0, FacePatchOrientationRole.Forward);
+ var roleOnly = new SourceSurfaceDescriptor(SurfacePatchFamily.Planar, "top", null, null, Transform3D.Identity, "cir:box:top", nameof(CirBoxNode), 0, FacePatchOrientationRole.Forward);
var success = PlanarPatchPayloadBuilder.TryBuildRectanglePayload(roleOnly, out _, out var diagnostic);
Assert.False(success);
Assert.Contains("does not encode bounded rectangle corners", diagnostic, StringComparison.OrdinalIgnoreCase);
diff --git a/Aetheris.Kernel.Firmament/Execution/FacePatchCandidateDryRun.cs b/Aetheris.Kernel.Firmament/Execution/FacePatchCandidateDryRun.cs
index 03f20f5d..9cb72aab 100644
--- a/Aetheris.Kernel.Firmament/Execution/FacePatchCandidateDryRun.cs
+++ b/Aetheris.Kernel.Firmament/Execution/FacePatchCandidateDryRun.cs
@@ -564,7 +564,13 @@ internal static class RetainedLoopGeometryBinder
return false;
}
- var axisPoint = opposite.Transform.Apply(Point3D.Origin);
+ if (opposite.CylindricalGeometryEvidence is not { } cylindrical)
+ {
+ diagnostic = "loop-geometry-bind-deferred: cylindrical source descriptor does not yet carry canonical cylindrical geometry evidence.";
+ return false;
+ }
+
+ var axisPoint = cylindrical.AxisOrigin;
var planePoint = planar.Kind == BoundedPlanarPatchGeometryKind.Circle ? planar.Center : planar.Corner00;
var denom = normal.Dot(axis);
if (Math.Abs(denom) < 1e-12)
@@ -575,11 +581,7 @@ internal static class RetainedLoopGeometryBinder
var t = normal.Dot(planePoint - axisPoint) / denom;
var center = axisPoint + (axis * t);
- if (!TryReadCylindricalRadiusEvidence(opposite, out var radius))
- {
- diagnostic = "loop-geometry-bind-deferred: cylindrical source descriptor does not yet carry canonical radius evidence.";
- return false;
- }
+ var radius = cylindrical.Radius;
if (radius <= 1e-12)
{
@@ -594,11 +596,4 @@ internal static class RetainedLoopGeometryBinder
return true;
}
- private static bool TryReadCylindricalRadiusEvidence(SourceSurfaceDescriptor opposite, out double radius)
- {
- radius = 0d;
- if (opposite.ParameterPayloadReference is null) return false;
- if (!opposite.ParameterPayloadReference.StartsWith("radius:", StringComparison.Ordinal)) return false;
- return double.TryParse(opposite.ParameterPayloadReference[7..], out radius);
- }
}
diff --git a/Aetheris.Kernel.Firmament/Execution/SourceSurfaceExtraction.cs b/Aetheris.Kernel.Firmament/Execution/SourceSurfaceExtraction.cs
index 1bb93a4a..cdb11a24 100644
--- a/Aetheris.Kernel.Firmament/Execution/SourceSurfaceExtraction.cs
+++ b/Aetheris.Kernel.Firmament/Execution/SourceSurfaceExtraction.cs
@@ -90,10 +90,10 @@ internal static class SourceSurfaceExtractor
AddCylinderDescriptors(cylinder, accumulated, descriptors, replayLog, diagnostics, nameof(CirCylinderNode));
return;
case CirSphereNode:
- descriptors.Add(CreateDescriptor(SurfacePatchFamily.Spherical, "sphere", null, accumulated, node, replayLog, FacePatchOrientationRole.Forward));
+ descriptors.Add(CreateDescriptor(SurfacePatchFamily.Spherical, "sphere", null, null, accumulated, node, replayLog, FacePatchOrientationRole.Forward));
return;
case CirTorusNode:
- descriptors.Add(CreateDescriptor(SurfacePatchFamily.Toroidal, "torus", null, accumulated, node, replayLog, FacePatchOrientationRole.Forward));
+ descriptors.Add(CreateDescriptor(SurfacePatchFamily.Toroidal, "torus", null, null, accumulated, node, replayLog, FacePatchOrientationRole.Forward));
diagnostics.Add(new("torus-materialization-deferred", "Toroidal source surface extracted; downstream materialization remains deferred."));
return;
case CirSubtractNode subtract:
@@ -119,17 +119,23 @@ internal static class SourceSurfaceExtractor
var hx = box.Width * 0.5d;
var hy = box.Height * 0.5d;
var hz = box.Depth * 0.5d;
- descriptors.Add(CreateDescriptor(SurfacePatchFamily.Planar, "top", CreateBoundedPatch(transform, new(-hx, -hy, hz), new(hx, -hy, hz), new(hx, hy, hz), new(-hx, hy, hz)), transform, CirNodeKind.Box, replayLog, FacePatchOrientationRole.Forward, owningKind));
- descriptors.Add(CreateDescriptor(SurfacePatchFamily.Planar, "bottom", CreateBoundedPatch(transform, new(-hx, hy, -hz), new(hx, hy, -hz), new(hx, -hy, -hz), new(-hx, -hy, -hz)), transform, CirNodeKind.Box, replayLog, FacePatchOrientationRole.Forward, owningKind));
- descriptors.Add(CreateDescriptor(SurfacePatchFamily.Planar, "left", CreateBoundedPatch(transform, new(-hx, -hy, -hz), new(-hx, hy, -hz), new(-hx, hy, hz), new(-hx, -hy, hz)), transform, CirNodeKind.Box, replayLog, FacePatchOrientationRole.Forward, owningKind));
- descriptors.Add(CreateDescriptor(SurfacePatchFamily.Planar, "right", CreateBoundedPatch(transform, new(hx, -hy, hz), new(hx, hy, hz), new(hx, hy, -hz), new(hx, -hy, -hz)), transform, CirNodeKind.Box, replayLog, FacePatchOrientationRole.Forward, owningKind));
- descriptors.Add(CreateDescriptor(SurfacePatchFamily.Planar, "front", CreateBoundedPatch(transform, new(-hx, hy, -hz), new(hx, hy, -hz), new(hx, hy, hz), new(-hx, hy, hz)), transform, CirNodeKind.Box, replayLog, FacePatchOrientationRole.Forward, owningKind));
- descriptors.Add(CreateDescriptor(SurfacePatchFamily.Planar, "back", CreateBoundedPatch(transform, new(-hx, -hy, hz), new(hx, -hy, hz), new(hx, -hy, -hz), new(-hx, -hy, -hz)), transform, CirNodeKind.Box, replayLog, FacePatchOrientationRole.Forward, owningKind));
+ descriptors.Add(CreateDescriptor(SurfacePatchFamily.Planar, "top", CreateBoundedPatch(transform, new(-hx, -hy, hz), new(hx, -hy, hz), new(hx, hy, hz), new(-hx, hy, hz)), null, transform, CirNodeKind.Box, replayLog, FacePatchOrientationRole.Forward, owningKind));
+ descriptors.Add(CreateDescriptor(SurfacePatchFamily.Planar, "bottom", CreateBoundedPatch(transform, new(-hx, hy, -hz), new(hx, hy, -hz), new(hx, -hy, -hz), new(-hx, -hy, -hz)), null, transform, CirNodeKind.Box, replayLog, FacePatchOrientationRole.Forward, owningKind));
+ descriptors.Add(CreateDescriptor(SurfacePatchFamily.Planar, "left", CreateBoundedPatch(transform, new(-hx, -hy, -hz), new(-hx, hy, -hz), new(-hx, hy, hz), new(-hx, -hy, hz)), null, transform, CirNodeKind.Box, replayLog, FacePatchOrientationRole.Forward, owningKind));
+ descriptors.Add(CreateDescriptor(SurfacePatchFamily.Planar, "right", CreateBoundedPatch(transform, new(hx, -hy, hz), new(hx, hy, hz), new(hx, hy, -hz), new(hx, -hy, -hz)), null, transform, CirNodeKind.Box, replayLog, FacePatchOrientationRole.Forward, owningKind));
+ descriptors.Add(CreateDescriptor(SurfacePatchFamily.Planar, "front", CreateBoundedPatch(transform, new(-hx, hy, -hz), new(hx, hy, -hz), new(hx, hy, hz), new(-hx, hy, hz)), null, transform, CirNodeKind.Box, replayLog, FacePatchOrientationRole.Forward, owningKind));
+ descriptors.Add(CreateDescriptor(SurfacePatchFamily.Planar, "back", CreateBoundedPatch(transform, new(-hx, -hy, hz), new(hx, -hy, hz), new(hx, -hy, -hz), new(-hx, -hy, -hz)), null, transform, CirNodeKind.Box, replayLog, FacePatchOrientationRole.Forward, owningKind));
}
private static void AddCylinderDescriptors(CirCylinderNode cylinder, Transform3D transform, List<SourceSurfaceDescriptor> descriptors, NativeGeometryReplayLog? replayLog, List<SourceSurfaceExtractionDiagnostic> diagnostics, string owningKind)
{
- descriptors.Add(CreateDescriptor(SurfacePatchFamily.Cylindrical, "side", null, transform, CirNodeKind.Cylinder, replayLog, FacePatchOrientationRole.Forward, owningKind));
+ var sideEvidence = TryCreateCylindricalSideGeometryEvidence(cylinder, transform, out var sideDiagnostic);
+ if (sideDiagnostic is not null)
+ {
+ diagnostics.Add(sideDiagnostic);
+ }
+
+ descriptors.Add(CreateDescriptor(SurfacePatchFamily.Cylindrical, "side", null, sideEvidence, transform, CirNodeKind.Cylinder, replayLog, FacePatchOrientationRole.Forward, owningKind));
var topCap = TryCreateCircularCapGeometry(cylinder, transform, isTopCap: true, out var topDiagnostic);
var bottomCap = TryCreateCircularCapGeometry(cylinder, transform, isTopCap: false, out var bottomDiagnostic);
if (topDiagnostic is not null)
@@ -142,8 +148,8 @@ internal static class SourceSurfaceExtractor
diagnostics.Add(bottomDiagnostic);
}
- descriptors.Add(CreateDescriptor(SurfacePatchFamily.Planar, "cap-top", topCap, transform, CirNodeKind.Cylinder, replayLog, FacePatchOrientationRole.Forward, owningKind));
- descriptors.Add(CreateDescriptor(SurfacePatchFamily.Planar, "cap-bottom", bottomCap, transform, CirNodeKind.Cylinder, replayLog, FacePatchOrientationRole.Reversed, owningKind));
+ descriptors.Add(CreateDescriptor(SurfacePatchFamily.Planar, "cap-top", topCap, null, transform, CirNodeKind.Cylinder, replayLog, FacePatchOrientationRole.Forward, owningKind));
+ descriptors.Add(CreateDescriptor(SurfacePatchFamily.Planar, "cap-bottom", bottomCap, null, transform, CirNodeKind.Cylinder, replayLog, FacePatchOrientationRole.Reversed, owningKind));
}
@@ -183,17 +189,45 @@ internal static class SourceSurfaceExtractor
return BoundedPlanarPatchGeometry.CreateCircle(worldCenter, worldNormal, radiusX);
}
- private static SourceSurfaceDescriptor CreateDescriptor(SurfacePatchFamily family, string provenanceRole, BoundedPlanarPatchGeometry? boundedPlanarGeometry, Transform3D transform, CirNodeKind nodeKind, NativeGeometryReplayLog? replayLog, FacePatchOrientationRole orientation, string owningKind)
+ private static CylindricalSurfaceGeometryEvidence? TryCreateCylindricalSideGeometryEvidence(CirCylinderNode cylinder, Transform3D transform, out SourceSurfaceExtractionDiagnostic? diagnostic)
+ {
+ diagnostic = null;
+ var localBottom = new Point3D(0d, 0d, -cylinder.Height * 0.5d);
+ var localTop = new Point3D(0d, 0d, cylinder.Height * 0.5d);
+ var worldBottom = transform.Apply(localBottom);
+ var worldTop = transform.Apply(localTop);
+ var axis = worldTop - worldBottom;
+ var height = axis.Length;
+ if (height <= 1e-12d)
+ {
+ diagnostic = new("cylinder-side-geometry-deferred", "Cylinder side transformed to degenerate axis span; cylindrical geometry evidence omitted.");
+ return null;
+ }
+
+ var worldRadialX = transform.Apply(new Vector3D(cylinder.Radius, 0d, 0d));
+ var worldRadialY = transform.Apply(new Vector3D(0d, cylinder.Radius, 0d));
+ var radiusX = worldRadialX.Length;
+ var radiusY = worldRadialY.Length;
+ if (double.Abs(radiusX - radiusY) > 1e-9d)
+ {
+ diagnostic = new("cylinder-side-geometry-deferred", "Cylinder side transformed with non-uniform radial scaling/shear; canonical circular cylindrical evidence omitted.");
+ return null;
+ }
+
+ return new CylindricalSurfaceGeometryEvidence(worldBottom, axis, radiusX, height, worldBottom, worldTop);
+ }
+
+ private static SourceSurfaceDescriptor CreateDescriptor(SurfacePatchFamily family, string provenanceRole, BoundedPlanarPatchGeometry? boundedPlanarGeometry, CylindricalSurfaceGeometryEvidence? cylindricalGeometryEvidence, Transform3D transform, CirNodeKind nodeKind, NativeGeometryReplayLog? replayLog, FacePatchOrientationRole orientation, string owningKind)
{
var op = replayLog?.Operations.LastOrDefault();
var placementSuffix = op is null ? "" : $"|placement:{op.ResolvedPlacement.Kind}";
- return new SourceSurfaceDescriptor(family, provenanceRole, boundedPlanarGeometry, transform, $"cir:{nodeKind.ToString().ToLowerInvariant()}:{provenanceRole}{placementSuffix}", owningKind, op?.OpIndex, orientation);
+ return new SourceSurfaceDescriptor(family, provenanceRole, boundedPlanarGeometry, cylindricalGeometryEvidence, transform, $"cir:{nodeKind.ToString().ToLowerInvariant()}:{provenanceRole}{placementSuffix}", owningKind, op?.OpIndex, orientation);
}
- private static SourceSurfaceDescriptor CreateDescriptor(SurfacePatchFamily family, string provenanceRole, BoundedPlanarPatchGeometry? boundedPlanarGeometry, Transform3D transform, CirNode node, NativeGeometryReplayLog? replayLog, FacePatchOrientationRole orientation, string? owningKind = null)
+ private static SourceSurfaceDescriptor CreateDescriptor(SurfacePatchFamily family, string provenanceRole, BoundedPlanarPatchGeometry? boundedPlanarGeometry, CylindricalSurfaceGeometryEvidence? cylindricalGeometryEvidence, Transform3D transform, CirNode node, NativeGeometryReplayLog? replayLog, FacePatchOrientationRole orientation, string? owningKind = null)
{
var op = replayLog?.Operations.LastOrDefault();
var placementSuffix = op is null ? "" : $"|placement:{op.ResolvedPlacement.Kind}";
- return new SourceSurfaceDescriptor(family, provenanceRole, boundedPlanarGeometry, transform, $"cir:{node.Kind.ToString().ToLowerInvariant()}:{provenanceRole}{placementSuffix}", owningKind ?? node.GetType().Name, op?.OpIndex, orientation);
+ return new SourceSurfaceDescriptor(family, provenanceRole, boundedPlanarGeometry, cylindricalGeometryEvidence, transform, $"cir:{node.Kind.ToString().ToLowerInvariant()}:{provenanceRole}{placementSuffix}", owningKind ?? node.GetType().Name, op?.OpIndex, orientation);
}
}
diff --git a/Aetheris.Kernel.Firmament/Execution/SurfacePatchDescriptorScaffold.cs b/Aetheris.Kernel.Firmament/Execution/SurfacePatchDescriptorScaffold.cs
index 82799d02..4ec7be2c 100644
--- a/Aetheris.Kernel.Firmament/Execution/SurfacePatchDescriptorScaffold.cs
+++ b/Aetheris.Kernel.Firmament/Execution/SurfacePatchDescriptorScaffold.cs
@@ -54,6 +54,7 @@ internal sealed record SourceSurfaceDescriptor(
SurfacePatchFamily Family,
string? ParameterPayloadReference,
BoundedPlanarPatchGeometry? BoundedPlanarGeometry,
+ CylindricalSurfaceGeometryEvidence? CylindricalGeometryEvidence,
Transform3D Transform,
string Provenance,
string? OwningCirNodeKind,
@@ -83,6 +84,14 @@ internal readonly record struct BoundedPlanarPatchGeometry(
=> new(BoundedPlanarPatchGeometryKind.Circle, Point3D.Origin, Point3D.Origin, Point3D.Origin, Point3D.Origin, center, normal, radius);
}
+internal readonly record struct CylindricalSurfaceGeometryEvidence(
+ Point3D AxisOrigin,
+ Vector3D AxisDirection,
+ double Radius,
+ double Height,
+ Point3D BottomCenter,
+ Point3D TopCenter);
+
internal sealed record TrimCurveDescriptor(
TrimCurveFamily Family,
string? ParameterPayloadReference,
diff --git a/docs/cir-f106-cylindrical-source-geometry-evidence.md b/docs/cir-f106-cylindrical-source-geometry-evidence.md
new file mode 100644
index 00000000..725aa6f3
--- /dev/null
+++ b/docs/cir-f106-cylindrical-source-geometry-evidence.md
@@ -0,0 +1,47 @@
+# CIR-F10.6: canonical cylindrical source geometry evidence
+
+## Why this milestone was needed
+
+CIR-F10.5 introduced canonical retained circular loop binding, but the real box-minus-cylinder path still deferred because real cylindrical source descriptors only carried family/role/provenance. They did not carry canonical axis/radius/span evidence.
+
+## What was added
+
+`SourceSurfaceDescriptor` now carries optional `CylindricalSurfaceGeometryEvidence` with:
+
+- `AxisOrigin`
+- `AxisDirection`
+- `Radius`
+- `Height`
+- `BottomCenter`
+- `TopCenter`
+
+This evidence is internal-only dry-run geometry evidence and does not introduce generated topology naming (SEM-A0 preserved).
+
+## Extractor behavior
+
+For `CirCylinderNode` side descriptors:
+
+- canonical cylindrical evidence is populated from real cylinder semantics,
+- identity and translation transforms preserve evidence,
+- non-uniform radial transforms (shear/non-uniform scale-like behavior) are deferred with diagnostics.
+
+Cap descriptors keep existing F10.2 circular bounded planar geometry behavior.
+
+## Binder behavior
+
+`RetainedLoopGeometryBinder.TryBindCircularLoop(...)` now consumes cylindrical evidence directly (rather than ad hoc payload radius parsing), verifies planar normal and cylinder axis compatibility, computes plane/axis intersection center, and binds canonical `RetainedCircularLoopGeometry` when safe.
+
+## What now succeeds
+
+Real `Subtract(Box, Cylinder)` dry-run candidate generation can now produce retained inner circular loop geometry on base-side planar candidates using real extracted cylindrical source evidence.
+
+## Still deferred
+
+- inner-loop BRep emission (F10.4 policy still blocks),
+- annular planar face emission,
+- cylindrical side BRep emission,
+- torus and other higher-order special cases.
+
+## Recommended next step
+
+Consume `RetainedCircularLoopGeometry` in a tightly scoped planar inner-loop emitter milestone (outer loop + single inner circle), retaining readiness gates and explicit orientation policy.