Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Add bounded planar box face geometry for real rect3d derivation

Yuechen Li927085602702
diff --git a/Aetheris.Kernel.Firmament.Tests/SurfacePatchDescriptorScaffoldTests.cs b/Aetheris.Kernel.Firmament.Tests/SurfacePatchDescriptorScaffoldTests.cs
index 470a22b3..677def3f 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}", Transform3D.Identity, "cir:box", nameof(Aetheris.Kernel.Core.Cir.CirBoxNode), 0, FacePatchOrientationRole.Forward))
+ .Select(i => new SourceSurfaceDescriptor(SurfacePatchFamily.Planar, $"box-face-{i}", 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", Transform3D.Identity, "cir:cylinder:side", nameof(Aetheris.Kernel.Core.Cir.CirCylinderNode), 1, FacePatchOrientationRole.Forward);
- var top = new SourceSurfaceDescriptor(SurfacePatchFamily.Planar, "cap-top", Transform3D.Identity, "cir:cylinder:cap-top", nameof(Aetheris.Kernel.Core.Cir.CirCylinderNode), 1, FacePatchOrientationRole.Forward);
- var bottom = new SourceSurfaceDescriptor(SurfacePatchFamily.Planar, "cap-bottom", Transform3D.Identity, "cir:cylinder:cap-bottom", nameof(Aetheris.Kernel.Core.Cir.CirCylinderNode), 1, FacePatchOrientationRole.Reversed);
+ 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);
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", Transform3D.Identity, "cir:sphere", nameof(Aetheris.Kernel.Core.Cir.CirSphereNode), 2, FacePatchOrientationRole.Forward);
+ var sphere = new SourceSurfaceDescriptor(SurfacePatchFamily.Spherical, "sphere", 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", Transform3D.Identity, "cir:torus", nameof(Aetheris.Kernel.Core.Cir.CirTorusNode), 3, FacePatchOrientationRole.Forward);
+ var source = new SourceSurfaceDescriptor(SurfacePatchFamily.Toroidal, "torus", 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", Transform3D.Identity, "cir:box", nameof(Aetheris.Kernel.Core.Cir.CirBoxNode), 0, FacePatchOrientationRole.Forward);
+ var source = new SourceSurfaceDescriptor(SurfacePatchFamily.Planar, "plane", 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", Transform3D.Identity, "cir:sphere", nameof(Aetheris.Kernel.Core.Cir.CirSphereNode), 4, FacePatchOrientationRole.Forward);
+ var source = new SourceSurfaceDescriptor(SurfacePatchFamily.Spherical, "sphere", 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", 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, 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", 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, 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", Transform3D.Identity, "cir:sphere", nameof(CirSphereNode), 0, FacePatchOrientationRole.Forward);
+ var source = new SourceSurfaceDescriptor(SurfacePatchFamily.Spherical, "sphere", 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", 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, 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);
@@ -134,36 +134,66 @@ public sealed class SurfacePatchDescriptorScaffoldTests
[Fact]
public void PlanarPayloadBuilder_RejectsNonPlanarSource()
{
- var source = new SourceSurfaceDescriptor(SurfacePatchFamily.Spherical, "sphere", Transform3D.Identity, "cir:sphere", nameof(CirSphereNode), 0, FacePatchOrientationRole.Forward);
+ var source = new SourceSurfaceDescriptor(SurfacePatchFamily.Spherical, "sphere", 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);
}
[Fact]
- public void PlanarPayloadBuilder_RejectsDescriptorWithoutRectangleGeometry()
+ public void SourceSurfaceExtractor_BoxFaces_HaveBoundedPlanarGeometry()
{
var extraction = SourceSurfaceExtractor.Extract(new CirBoxNode(10, 6, 4));
- var top = Assert.Single(extraction.Descriptors.Where(d => d.ParameterPayloadReference == "top"));
+ var planar = extraction.Descriptors.Where(d => d.Family == SurfacePatchFamily.Planar && d.OwningCirNodeKind == nameof(CirBoxNode)).ToArray();
+ Assert.Equal(6, planar.Length);
+ Assert.Equal(["top", "bottom", "left", "right", "front", "back"], planar.Select(d => d.ParameterPayloadReference).ToArray());
+ Assert.All(planar, d => Assert.NotNull(d.BoundedPlanarGeometry));
+ Assert.All(planar, d =>
+ {
+ var g = d.BoundedPlanarGeometry!.Value;
+ Assert.True((g.Corner10 - g.Corner00).Length > 0d);
+ Assert.True((g.Corner01 - g.Corner00).Length > 0d);
+ Assert.True(g.Normal.Length > 0d);
+ });
+ }
+ [Fact]
+ public void PlanarPayloadBuilder_BoxTopFace_DerivesRect3d()
+ {
+ var extraction = SourceSurfaceExtractor.Extract(new CirBoxNode(10, 6, 4));
+ var top = Assert.Single(extraction.Descriptors.Where(d => d.ParameterPayloadReference == "top"));
var success = PlanarPatchPayloadBuilder.TryBuildRectanglePayload(top, out _, out var diagnostic);
- Assert.False(success);
- Assert.Contains("does not encode bounded rectangle corners", diagnostic, StringComparison.OrdinalIgnoreCase);
+ Assert.True(success);
+ Assert.Contains("derived rect3d payload from bounded planar source geometry", diagnostic, StringComparison.OrdinalIgnoreCase);
}
[Fact]
- public void PlanarSurfaceMaterializer_FromRealDescriptor_RespectsReadinessGate()
+ public void PlanarSurfaceMaterializer_BoxTopFace_FromSourceSurface_EmitsTopology()
{
var extraction = SourceSurfaceExtractor.Extract(new CirBoxNode(10, 6, 4));
var top = Assert.Single(extraction.Descriptors.Where(d => d.ParameterPayloadReference == "top"));
var ready = PlanarPatchPayloadBuilder.TryBuildRectanglePayload(top, out var payload, out var payloadDiagnostic);
- Assert.False(ready);
- Assert.Contains("rejected", payloadDiagnostic, StringComparison.OrdinalIgnoreCase);
+ Assert.True(ready);
+ Assert.StartsWith("rect3d:", payload);
+ Assert.Contains("derived rect3d payload", payloadDiagnostic, StringComparison.OrdinalIgnoreCase);
var patch = new FacePatchDescriptor(top with { ParameterPayloadReference = payload }, [], [], FacePatchOrientationRole.Forward, "outer", []);
- var readiness = new MaterializationReadinessReport(true, EmissionReadiness.Deferred, [EmissionBlockingReason.TopologyPlanning], [], 1, 1, 0, 0, 0, 0, 0, [], false);
+ var readiness = new MaterializationReadinessReport(true, EmissionReadiness.EvidenceReadyForEmission, [], [], 1, 1, 1, 0, 0, 0, 0, [], false);
var result = new PlanarSurfaceMaterializer().Emit(patch, readiness);
- Assert.False(result.Success);
- Assert.Contains(result.Diagnostics, d => d.Contains("no readiness, no emission", StringComparison.OrdinalIgnoreCase));
+ Assert.True(result.Success);
+ Assert.NotNull(result.Body);
+ Assert.Single(result.Body!.Topology.Faces);
+ Assert.Single(result.Body.Topology.Loops);
+ Assert.Equal(4, result.Body.Topology.Edges.Count());
+ Assert.Equal(4, result.Body.Topology.Vertices.Count());
+ }
+
+ [Fact]
+ public void PlanarPayloadBuilder_RejectsDescriptorWithoutBoundedGeometry()
+ {
+ var roleOnly = new SourceSurfaceDescriptor(SurfacePatchFamily.Planar, "top", 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/SourceSurfaceExtraction.cs b/Aetheris.Kernel.Firmament/Execution/SourceSurfaceExtraction.cs
index 3b8aebd3..cceca09b 100644
--- a/Aetheris.Kernel.Firmament/Execution/SourceSurfaceExtraction.cs
+++ b/Aetheris.Kernel.Firmament/Execution/SourceSurfaceExtraction.cs
@@ -83,17 +83,17 @@ internal static class SourceSurfaceExtractor
case CirTransformNode transformNode:
Visit(transformNode.Child, Transform3D.Compose(accumulated, transformNode.Transform), descriptors, diagnostics, unsupported, replayLog);
return;
- case CirBoxNode:
- AddBoxDescriptors(accumulated, descriptors, replayLog, nameof(CirBoxNode));
+ case CirBoxNode box:
+ AddBoxDescriptors(box, accumulated, descriptors, replayLog, nameof(CirBoxNode));
return;
case CirCylinderNode:
AddCylinderDescriptors(accumulated, descriptors, replayLog, nameof(CirCylinderNode));
return;
case CirSphereNode:
- descriptors.Add(CreateDescriptor(SurfacePatchFamily.Spherical, "sphere", accumulated, node, replayLog, FacePatchOrientationRole.Forward));
+ descriptors.Add(CreateDescriptor(SurfacePatchFamily.Spherical, "sphere", null, accumulated, node, replayLog, FacePatchOrientationRole.Forward));
return;
case CirTorusNode:
- descriptors.Add(CreateDescriptor(SurfacePatchFamily.Toroidal, "torus", accumulated, node, replayLog, FacePatchOrientationRole.Forward));
+ descriptors.Add(CreateDescriptor(SurfacePatchFamily.Toroidal, "torus", null, accumulated, node, replayLog, FacePatchOrientationRole.Forward));
diagnostics.Add(new("torus-materialization-deferred", "Toroidal source surface extracted; downstream materialization remains deferred."));
return;
case CirSubtractNode subtract:
@@ -114,34 +114,47 @@ internal static class SourceSurfaceExtractor
}
}
- private static void AddBoxDescriptors(Transform3D transform, List<SourceSurfaceDescriptor> descriptors, NativeGeometryReplayLog? replayLog, string owningKind)
+ private static void AddBoxDescriptors(CirBoxNode box, Transform3D transform, List<SourceSurfaceDescriptor> descriptors, NativeGeometryReplayLog? replayLog, string owningKind)
{
- var roles = new[] { "top", "bottom", "left", "right", "front", "back" };
- foreach (var role in roles)
- {
- descriptors.Add(CreateDescriptor(SurfacePatchFamily.Planar, role, transform, CirNodeKind.Box, replayLog, FacePatchOrientationRole.Forward, owningKind));
- }
+ 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));
}
private static void AddCylinderDescriptors(Transform3D transform, List<SourceSurfaceDescriptor> descriptors, NativeGeometryReplayLog? replayLog, string owningKind)
{
- descriptors.Add(CreateDescriptor(SurfacePatchFamily.Cylindrical, "side", transform, CirNodeKind.Cylinder, replayLog, FacePatchOrientationRole.Forward, owningKind));
- descriptors.Add(CreateDescriptor(SurfacePatchFamily.Planar, "cap-top", transform, CirNodeKind.Cylinder, replayLog, FacePatchOrientationRole.Forward, owningKind));
- descriptors.Add(CreateDescriptor(SurfacePatchFamily.Planar, "cap-bottom", transform, CirNodeKind.Cylinder, replayLog, FacePatchOrientationRole.Reversed, owningKind));
+ descriptors.Add(CreateDescriptor(SurfacePatchFamily.Cylindrical, "side", null, transform, CirNodeKind.Cylinder, replayLog, FacePatchOrientationRole.Forward, owningKind));
+ descriptors.Add(CreateDescriptor(SurfacePatchFamily.Planar, "cap-top", null, transform, CirNodeKind.Cylinder, replayLog, FacePatchOrientationRole.Forward, owningKind));
+ descriptors.Add(CreateDescriptor(SurfacePatchFamily.Planar, "cap-bottom", null, transform, CirNodeKind.Cylinder, replayLog, FacePatchOrientationRole.Reversed, owningKind));
}
- private static SourceSurfaceDescriptor CreateDescriptor(SurfacePatchFamily family, string provenanceRole, Transform3D transform, CirNodeKind nodeKind, NativeGeometryReplayLog? replayLog, FacePatchOrientationRole orientation, string owningKind)
+ private static BoundedPlanarPatchGeometry CreateBoundedPatch(Transform3D transform, Point3D c00, Point3D c10, Point3D c11, Point3D c01)
+ {
+ var w00 = transform.Apply(c00);
+ var w10 = transform.Apply(c10);
+ var w11 = transform.Apply(c11);
+ var w01 = transform.Apply(c01);
+ return new(w00, w10, w11, w01, (w10 - w00).Cross(w01 - w00));
+ }
+
+ private static SourceSurfaceDescriptor CreateDescriptor(SurfacePatchFamily family, string provenanceRole, BoundedPlanarPatchGeometry? boundedPlanarGeometry, 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, transform, $"cir:{nodeKind.ToString().ToLowerInvariant()}:{provenanceRole}{placementSuffix}", owningKind, op?.OpIndex, orientation);
+ return new SourceSurfaceDescriptor(family, provenanceRole, boundedPlanarGeometry, transform, $"cir:{nodeKind.ToString().ToLowerInvariant()}:{provenanceRole}{placementSuffix}", owningKind, op?.OpIndex, orientation);
}
- private static SourceSurfaceDescriptor CreateDescriptor(SurfacePatchFamily family, string provenanceRole, Transform3D transform, CirNode node, NativeGeometryReplayLog? replayLog, FacePatchOrientationRole orientation, string? owningKind = null)
+ private static SourceSurfaceDescriptor CreateDescriptor(SurfacePatchFamily family, string provenanceRole, BoundedPlanarPatchGeometry? boundedPlanarGeometry, 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, transform, $"cir:{node.Kind.ToString().ToLowerInvariant()}:{provenanceRole}{placementSuffix}", owningKind ?? node.GetType().Name, op?.OpIndex, orientation);
+ return new SourceSurfaceDescriptor(family, provenanceRole, boundedPlanarGeometry, 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 87fff820..fdb902b2 100644
--- a/Aetheris.Kernel.Firmament/Execution/SurfacePatchDescriptorScaffold.cs
+++ b/Aetheris.Kernel.Firmament/Execution/SurfacePatchDescriptorScaffold.cs
@@ -53,12 +53,20 @@ internal enum FacePatchOrientationRole
internal sealed record SourceSurfaceDescriptor(
SurfacePatchFamily Family,
string? ParameterPayloadReference,
+ BoundedPlanarPatchGeometry? BoundedPlanarGeometry,
Transform3D Transform,
string Provenance,
string? OwningCirNodeKind,
int? ReplayOpIndex,
FacePatchOrientationRole OrientationRole);
+internal readonly record struct BoundedPlanarPatchGeometry(
+ Point3D Corner00,
+ Point3D Corner10,
+ Point3D Corner11,
+ Point3D Corner01,
+ Vector3D Normal);
+
internal sealed record TrimCurveDescriptor(
TrimCurveFamily Family,
string? ParameterPayloadReference,
@@ -257,9 +265,18 @@ internal static class PlanarPatchPayloadBuilder
return true;
}
+ if (source.BoundedPlanarGeometry is { } bounded)
+ {
+ payload = $"rect3d:{FormatPoint(bounded.Corner00)};{FormatPoint(bounded.Corner10)};{FormatPoint(bounded.Corner11)};{FormatPoint(bounded.Corner01)}";
+ diagnostic = "payload-derivation-succeeded: derived rect3d payload from bounded planar source geometry.";
+ return true;
+ }
+
diagnostic = $"payload-derivation-rejected: planar source payload '{source.ParameterPayloadReference}' does not encode bounded rectangle corners; descriptor needs explicit rectangle geometry.";
return false;
}
+
+ private static string FormatPoint(Point3D p) => $"{p.X:G17},{p.Y:G17},{p.Z:G17}";
}
internal sealed record SurfaceMaterializationResult(
diff --git a/docs/cir-f10-real-planar-source-emission.md b/docs/cir-f10-real-planar-source-emission.md
index 100d0b48..858ebca6 100644
--- a/docs/cir-f10-real-planar-source-emission.md
+++ b/docs/cir-f10-real-planar-source-emission.md
@@ -52,3 +52,5 @@ Current descriptor payload role strings (`top`, `bottom`, `left`, ...) are insuf
## Recommended next step
Extend the source-surface evidence contract for box planar faces with deterministic bounded geometry fields (corners or equivalent local frame/extents) so the payload builder can produce `rect3d:` without inference/fabrication.
+
+- CIR-F10.1 follow-up: box face descriptors now include bounded planar corner geometry so real-source planar payload derivation can produce rect3d without relying on role tokens.
diff --git a/docs/cir-f101-bounded-planar-source-geometry.md b/docs/cir-f101-bounded-planar-source-geometry.md
new file mode 100644
index 00000000..c636551e
--- /dev/null
+++ b/docs/cir-f101-bounded-planar-source-geometry.md
@@ -0,0 +1,53 @@
+# CIR-F10.1: bounded planar geometry for real `SourceSurfaceDescriptor` box faces
+
+## Why F10 blocked
+
+CIR-F10 bridged real extracted descriptors into `PlanarPatchPayloadBuilder`, but box planar faces were emitted as role tokens (`top`, `bottom`, etc.) without bounded geometry. Role identity is insufficient to reconstruct deterministic rectangular corners.
+
+## New bounded planar geometry contract
+
+`SourceSurfaceDescriptor` now carries optional `BoundedPlanarPatchGeometry`:
+
+- `Corner00`
+- `Corner10`
+- `Corner11`
+- `Corner01`
+- `Normal`
+
+Corner ordering is deterministic and explicitly defines the rectangle perimeter for `rect3d:` derivation.
+
+## Supported scope
+
+Implemented only for planar faces extracted from `CirBoxNode`.
+
+- all six box faces now include bounded planar geometry,
+- corners are transformed to world-space during extraction,
+- normals are computed from transformed corner vectors.
+
+No generalized planar inference was added for non-box sources.
+
+## Transform behavior
+
+CIR-F10.1 applies the current `Transform3D` directly to box face corners and derives normals from transformed vectors. This supports translation and other affine transforms already represented by `Transform3D`; no new transform policy gates were introduced in this milestone.
+
+## Payload derivation flow
+
+`PlanarPatchPayloadBuilder.TryBuildRectanglePayload` now follows:
+
+1. keep existing fast-path for existing `rect3d:` payload;
+2. otherwise, if bounded planar geometry is present, derive `rect3d:` from corners;
+3. otherwise keep existing rejection for missing bounded rectangle geometry.
+
+## Non-goals preserved
+
+- no full box materialization,
+- no multi-face shell assembly path changes,
+- no trimmed planar patch support,
+- no cylindrical/spherical/toroidal emission changes,
+- no STEP export behavior changes,
+- no Boolean behavior expansion,
+- no generated topology naming.
+
+## Recommended next step
+
+Use the same bounded-source evidence pattern for other truly bounded planar primitives (for example cylinder caps where bounded curves are explicitly represented), while retaining explicit rejection for sources lacking trustworthy bounds.