Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Support reflex profile fillets with horn-torus junctions

Yuechen Li350684db5034
diff --git a/Aetheris.CLI/CliRunner.cs b/Aetheris.CLI/CliRunner.cs
index eede481a..a421485f 100644
--- a/Aetheris.CLI/CliRunner.cs
+++ b/Aetheris.CLI/CliRunner.cs
@@ -3238,7 +3238,8 @@ public static class CliRunner
private sealed record ProfileConvexFilletJunctionInspection(
string VertexId, string Classification, double InteriorAngleDegrees, double Radius,
double[] SphereCenter, IReadOnlyList<double[]> RollAxes, IReadOnlyList<double[]> RollExternalCenters,
- IReadOnlyList<double[]> RollJunctionCenters);
+ IReadOnlyList<double[]> RollJunctionCenters, string SurfaceFamily, double? MajorRadius,
+ double? MinorRadius, double[]? ParametricBounds);
private static ProfileStraightEdgeFilletInspection? DescribeProfileStraightEdgeFillet(ResolvedProfile2D profile, string source, string hostBodyId)
{
@@ -3253,7 +3254,8 @@ public static class CliRunner
if (result.Plan is not null)
{
var plan = result.Plan;
- var junction = new ProfileConvexFilletJunctionInspection(plan.Junction.VertexId, plan.Junction.Classification.Classification.ToString(), plan.Junction.Classification.MaterialInteriorAngleRadians * 180d / Math.PI, plan.Junction.Radius, P(plan.Junction.Center), plan.Rolls.Select(roll => V(roll.Tangent)).ToArray(), plan.Rolls.Select(roll => P(roll.ExternalCenter)).ToArray(), plan.Rolls.Select(roll => P(roll.JunctionCenter)).ToArray());
+ var reflex = plan.Junction as ProfileReflexFilletJunctionPlan;
+ var junction = new ProfileConvexFilletJunctionInspection(plan.Junction.VertexId, plan.Junction.Classification.Classification.ToString(), plan.Junction.Classification.MaterialInteriorAngleRadians * 180d / Math.PI, plan.Junction.Radius, P(plan.Junction.Center), plan.Rolls.Select(roll => V(roll.Tangent)).ToArray(), plan.Rolls.Select(roll => P(roll.ExternalCenter)).ToArray(), plan.Rolls.Select(roll => P(roll.JunctionCenter)).ToArray(), reflex is null ? "Sphere" : "HornTorus", reflex?.Torus.MajorRadius, reflex?.Torus.MinorRadius, reflex is null ? null : [reflex.MajorStartRadians, reflex.MajorEndRadians, reflex.MinorStartRadians, reflex.MinorEndRadians]);
return new(true, null, target!.StableId, target.ProfileId, target.LoopId, target.ChainKind.ToString(), target.SegmentIds, target.Side.ToString(), radius, clearance, plan.EndpointPolicy,
null, null, null, null, null, null, null, "DisjointNoCavitiesInBareProfileM2", result.Correspondence?.Descendants.Select(x => x.StableId).OrderBy(x => x, StringComparer.Ordinal).ToArray() ?? [], result.Correspondence?.ProvenanceChain ?? [], junction);
}
diff --git a/Aetheris.Kernel.Core/Brep/Tessellation/BrepDisplayTessellator.cs b/Aetheris.Kernel.Core/Brep/Tessellation/BrepDisplayTessellator.cs
index 279d45f5..e5fe41cb 100644
--- a/Aetheris.Kernel.Core/Brep/Tessellation/BrepDisplayTessellator.cs
+++ b/Aetheris.Kernel.Core/Brep/Tessellation/BrepDisplayTessellator.cs
@@ -1298,11 +1298,25 @@ public static class BrepDisplayTessellator
var axial = offset.Dot(axis);
var planar = offset - (axis * axial);
var planarLength = planar.Length;
- if (!double.IsFinite(planarLength) || planarLength <= 1e-9d)
+ if (!double.IsFinite(planarLength))
{
return null;
}
+ // A bounded horn-torus patch may legitimately end at its single
+ // collapsed inner-circle point. That point has no unique major angle,
+ // but (u=0,v=pi) evaluates exactly to it and permits deterministic
+ // trimmed-face tessellation; it does not relax projection for ordinary
+ // torus points away from the horn singularity.
+ if (planarLength <= 1e-9d)
+ {
+ if (double.Abs(torus.MajorRadius - torus.MinorRadius) <= 1e-9d && double.Abs(axial) <= 1e-9d)
+ {
+ return (0d, double.Pi);
+ }
+ return null;
+ }
+
var u = NormalizeToZeroTwoPi(double.Atan2(planar.Dot(yAxis), planar.Dot(xAxis)));
var radialFromMajor = planarLength - torus.MajorRadius;
var v = NormalizeToZeroTwoPi(double.Atan2(axial, radialFromMajor));
diff --git a/Aetheris.Kernel.Firmament.Tests/Integration/ProfileBoundaryChamferFixtureTests.cs b/Aetheris.Kernel.Firmament.Tests/Integration/ProfileBoundaryChamferFixtureTests.cs
index 461f8d41..1f2f0b54 100644
--- a/Aetheris.Kernel.Firmament.Tests/Integration/ProfileBoundaryChamferFixtureTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/Integration/ProfileBoundaryChamferFixtureTests.cs
@@ -132,11 +132,43 @@ public sealed class ProfileBoundaryChamferFixtureTests
Assert.Equal(conceptResult.Value.Export.StepText, lowLevelResult.Value.Export.StepText);
}
+ [Theory]
+ [InlineData("profile-fillet-reflex-two-segment-top.firmament")]
+ [InlineData("profile-fillet-reflex-two-segment-bottom.firmament")]
+ public void ReflexTwoSegmentFilletFixture_ExportsDeterministicTwoCylindersAndHornTorus(string fixtureName)
+ {
+ var source = FirmamentCorpusHarness.ResolveFixtureFullPath($"fixtures/FirmamentV2/Canonical/valid/{fixtureName}");
+ var first = FirmamentBuildAndExport.Run(source, Path.Combine(Path.GetTempPath(), $"aetheris-{Guid.NewGuid():N}.step"));
+ var second = FirmamentBuildAndExport.Run(source, Path.Combine(Path.GetTempPath(), $"aetheris-{Guid.NewGuid():N}.step"));
+ Assert.True(first.IsSuccess, string.Join(Environment.NewLine, first.Diagnostics.Select(item => item.Message)));
+ Assert.True(second.IsSuccess, string.Join(Environment.NewLine, second.Diagnostics.Select(item => item.Message)));
+ Assert.Equal(first.Value.Export.StepText, second.Value.Export.StepText);
+ var imported = Step242Importer.ImportBody(first.Value.Export.StepText);
+ Assert.True(imported.IsSuccess, string.Join(Environment.NewLine, imported.Diagnostics.Select(item => item.Message)));
+ Assert.Equal(2, imported.Value!.Geometry.Surfaces.Count(item => item.Value.Kind == SurfaceGeometryKind.Cylinder));
+ Assert.Equal(1, imported.Value.Geometry.Surfaces.Count(item => item.Value.Kind == SurfaceGeometryKind.Torus));
+ var mass = BrepMassProperties.Evaluate(imported.Value);
+ Assert.True(mass.IsEnclosed);
+ Assert.True(mass.IsOrientationConsistent);
+ }
+
+ [Fact]
+ public void ReflexTwoSegmentFillet_ConceptPathAndExplicitSegmentsAreStepEquivalent()
+ {
+ var concept = FirmamentCorpusHarness.ResolveFixtureFullPath("fixtures/FirmamentV2/Canonical/valid/profile-fillet-reflex-two-segment-concept-path.firmament");
+ var lowLevel = FirmamentCorpusHarness.ResolveFixtureFullPath("fixtures/FirmamentV2/Canonical/valid/profile-fillet-reflex-two-segment-low-level.firmament");
+ var conceptResult = FirmamentBuildAndExport.Run(concept, Path.Combine(Path.GetTempPath(), $"aetheris-{Guid.NewGuid():N}.step"));
+ var lowLevelResult = FirmamentBuildAndExport.Run(lowLevel, Path.Combine(Path.GetTempPath(), $"aetheris-{Guid.NewGuid():N}.step"));
+ Assert.True(conceptResult.IsSuccess, string.Join(Environment.NewLine, conceptResult.Diagnostics.Select(item => item.Message)));
+ Assert.True(lowLevelResult.IsSuccess, string.Join(Environment.NewLine, lowLevelResult.Diagnostics.Select(item => item.Message)));
+ Assert.Equal(conceptResult.Value.Export.StepText, lowLevelResult.Value.Export.StepText);
+ }
+
[Theory]
[InlineData("profile-compose-reflex-chamfer-shaft-collision.firmament", "ProfileBoundaryChamferIntersectsShaft")]
[InlineData("profile-compose-reflex-chamfer-counterbore-collision.firmament", "ProfileBoundaryChamferIntersectsCounterbore")]
[InlineData("profile-chamfer-reflex-inset-collapse.firmament", "ProfileBoundaryChamferInsetCollapse")]
- [InlineData("profile-fillet-reflex-junction-not-materialized.firmament", "ProfileBoundaryFilletReflexJunctionUnsupported")]
+ [InlineData("profile-fillet-reflex-junction-not-materialized.firmament", "ProfileBoundaryFilletReflexRadiusTooLarge")]
[InlineData("profile-straight-edge-fillet-shaft-collision.firmament", "ProfileBoundaryFilletIntersectsShaft")]
public void InvalidFixture_ProducesTypedProfileBoundaryDiagnostic(string fixtureName, string diagnostic)
{
diff --git a/Aetheris.Kernel.Firmament.Tests/Integration/ProfileBoundaryChamferTests.cs b/Aetheris.Kernel.Firmament.Tests/Integration/ProfileBoundaryChamferTests.cs
index 8d6fc719..a75f1ba2 100644
--- a/Aetheris.Kernel.Firmament.Tests/Integration/ProfileBoundaryChamferTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/Integration/ProfileBoundaryChamferTests.cs
@@ -177,11 +177,21 @@ public sealed class ProfileBoundaryChamferTests
}
[Fact]
- public void RejectsReflexAndThreeSegmentFilletChainsBeforeTopology()
+ public void PlansOrthogonalReflexAsTwoRollsAndOneHornTorusAndRejectsThreeSegmentChains()
{
const string reflex = "Selection Notch { Source: Bracket.Outer.[Inner, Upright] Require: ConnectedChain } Modify Body { EdgeFinish Round { Target: Notch On: Top Kind: Fillet Radius: 2mm } }";
Assert.True(ProfileBoundaryChamferSourceBinder.TryBindFillet(reflex, LProfile(), "Bracket", out var reflexTarget, out var reflexRadius, out var reflexClearance, out var diagnostic), diagnostic);
- Assert.Contains("ProfileBoundaryFilletReflexJunctionUnsupported", ProfileFilletShellPlanner.TryPlan(LProfile(), reflexTarget!, reflexRadius, reflexClearance).Diagnostics);
+ var reflexPlan = ProfileFilletShellPlanner.TryPlan(LProfile(), reflexTarget!, reflexRadius, reflexClearance);
+ Assert.True(reflexPlan.Succeeded, string.Join("; ", reflexPlan.Diagnostics));
+ var junction = Assert.IsType<ProfileReflexFilletJunctionPlan>(reflexPlan.Plan!.Junction);
+ Assert.Equal(ProfileJunctionKind.ReflexProfileJunction, junction.Classification.Classification);
+ Assert.Equal(3d * Math.PI / 2d, junction.Classification.MaterialInteriorAngleRadians, 8);
+ Assert.Equal(junction.Radius, junction.Torus.MajorRadius, 8);
+ Assert.Equal(junction.Radius, junction.Torus.MinorRadius, 8);
+ Assert.Equal(2, reflexPlan.Body!.Geometry.Surfaces.Count(item => item.Value.Kind == SurfaceGeometryKind.Cylinder));
+ Assert.Equal(1, reflexPlan.Body.Geometry.Surfaces.Count(item => item.Value.Kind == SurfaceGeometryKind.Torus));
+ Assert.Contains(reflexPlan.Correspondence!.Descendants, item => item.Role == SemanticTopologyRole.ReflexJunctionPatch);
+ Assert.Equal(2, reflexPlan.Correspondence.Descendants.Count(item => item.Role is SemanticTopologyRole.StartTerminationFace or SemanticTopologyRole.EndTerminationFace));
const string three = "Selection Three { Source: Bracket.Outer.[South, East, North] Require: ConnectedChain } Modify Body { EdgeFinish Round { Target: Three On: Top Kind: Fillet Radius: 2mm } }";
Assert.True(ProfileBoundaryChamferSourceBinder.TryBindFillet(three, Profile(), "Bracket", out var threeTarget, out var threeRadius, out var threeClearance, out diagnostic), diagnostic);
diff --git a/Aetheris.Kernel.Firmament/Materializer/ProfileBoundaryChamfer.cs b/Aetheris.Kernel.Firmament/Materializer/ProfileBoundaryChamfer.cs
index c81eaf49..b7cbf8a1 100644
--- a/Aetheris.Kernel.Firmament/Materializer/ProfileBoundaryChamfer.cs
+++ b/Aetheris.Kernel.Firmament/Materializer/ProfileBoundaryChamfer.cs
@@ -618,10 +618,23 @@ public static class ProfileStraightEdgeFilletPlanner
/// finite-span construction; M2 owns the first connected topology instead of
/// trying to join two already-emitted M1 bodies.
/// </summary>
-public enum ProfileFilletRollEndKind { EndpointTermination, ConvexJunction }
+public enum ProfileFilletRollEndKind { EndpointTermination, ConvexJunction, ReflexJunction }
public sealed record ProfileFilletStraightRollPlan(string SegmentId, Direction3D Tangent, Direction3D InwardNormal, Point3D ExternalCenter, Point3D JunctionCenter, ProfileFilletRollEndKind ExternalEnd, ProfileFilletRollEndKind JunctionEnd);
-public sealed record ProfileConvexSphericalJunctionPlan(string VertexId, ProfileJunctionClassification Classification, Point3D Center, double Radius, Point3D CapContact, Point3D SideAContact, Point3D SideBContact);
-public sealed record ProfileFilletShellPlan(ProfileBoundaryChamferTarget Target, double Radius, double EndClearance, IReadOnlyList<ProfileFilletStraightRollPlan> Rolls, ProfileConvexSphericalJunctionPlan Junction, string EndpointPolicy = "ExternalEndpointsOnly");
+public abstract record ProfileFilletJunctionPlan(string VertexId, ProfileJunctionClassification Classification, Point3D Center, double Radius)
+{
+ public abstract Point3D SideAContact { get; init; }
+ public abstract Point3D SideBContact { get; init; }
+}
+public sealed record ProfileConvexSphericalJunctionPlan(string VertexId, ProfileJunctionClassification Classification, Point3D Center, double Radius, Point3D CapContact, Point3D SideAContact, Point3D SideBContact)
+ : ProfileFilletJunctionPlan(VertexId, Classification, Center, Radius);
+/// <summary>The reflex centre locus is a quarter circle; its radius-r ball envelope is an admitted horn-torus quadrant.</summary>
+public sealed record ProfileReflexFilletJunctionPlan(string VertexId, ProfileJunctionClassification Classification, Point3D Center, double Radius, TorusSurface Torus, Point3D CapContactA, Point3D CapContactB, Point3D VerticalNotchContact, double MajorStartRadians, double MajorEndRadians, double MinorStartRadians, double MinorEndRadians)
+ : ProfileFilletJunctionPlan(VertexId, Classification, Center, Radius)
+{
+ public override Point3D SideAContact { get => VerticalNotchContact; init { } }
+ public override Point3D SideBContact { get => VerticalNotchContact; init { } }
+}
+public sealed record ProfileFilletShellPlan(ProfileBoundaryChamferTarget Target, double Radius, double EndClearance, IReadOnlyList<ProfileFilletStraightRollPlan> Rolls, ProfileFilletJunctionPlan Junction, string EndpointPolicy = "ExternalEndpointsOnly");
public sealed record ProfileFilletShellPlanResult(bool Succeeded, BrepBody? Body, SemanticTopologyCorrespondence? Correspondence, ProfileFilletShellPlan? Plan, ProfileStraightEdgeFilletPlan? SingleSegmentPlan, IReadOnlyList<string> Diagnostics);
public static class ProfileFilletShellPlanner
@@ -648,7 +661,16 @@ public static class ProfileFilletShellPlanner
if (a < 0 || b < 0) return Fail("ProfileBoundaryFilletSegmentUnknown");
if ((a + 1) % count != b) return Fail("ProfileBoundaryFilletDisconnectedChain");
var classification = ProfileJunctionClassifier.Classify(profile, loop).Single(x => x.PredecessorSegmentId == target.SegmentIds[0] && x.SuccessorSegmentId == target.SegmentIds[1]);
- if (classification.Classification == ProfileJunctionKind.ReflexProfileJunction) return Fail("ProfileBoundaryFilletReflexJunctionUnsupported");
+ if (classification.Classification == ProfileJunctionKind.ReflexProfileJunction)
+ {
+ if (Math.Abs(classification.MaterialInteriorAngleRadians - 3d * Math.PI / 2d) > Tol) return Fail("ProfileBoundaryFilletReflexAngleUnsupported");
+ var reflexA = (LineArcLineSegment2D)loop.Segments[a].Geometry; var reflexB = (LineArcLineSegment2D)loop.Segments[b].Geometry;
+ var reflexLengthA = Length(reflexA); var reflexLengthB = Length(reflexB);
+ if (reflexLengthA <= clearance + radius + Tol || reflexLengthB <= clearance + radius + Tol) return Fail("ProfileBoundaryFilletReflexRadiusTooLarge");
+ var reflexStart = profile.LocalStartDepth ?? -1d; var reflexEnd = profile.LocalEndDepth ?? 1d;
+ if (radius >= reflexEnd - reflexStart - Tol) return Fail("ProfileBoundaryFilletRadiusExceedsHost");
+ return BuildReflex(profile, loop, target, radius, clearance, a, b, reflexA, reflexB, classification, reflexStart, reflexEnd);
+ }
if (classification.Classification == ProfileJunctionKind.Collinear) return Fail("ProfileBoundaryFilletConvexJunctionCollinear");
if (classification.Classification != ProfileJunctionKind.ConvexProfileJunction) return Fail("ProfileBoundaryFilletConvexJunctionDegenerate");
if (Math.Abs(classification.MaterialInteriorAngleRadians - Math.PI / 2d) > Tol) return Fail("ProfileBoundaryFilletConvexAngleUnsupported");
@@ -657,10 +679,10 @@ public static class ProfileFilletShellPlanner
if (lengthA <= clearance + radius + Tol || lengthB <= clearance + radius + Tol) return Fail("ProfileBoundaryFilletConvexRadiusTooLarge");
var start = profile.LocalStartDepth ?? -1d; var end = profile.LocalEndDepth ?? 1d;
if (radius >= end - start - Tol) return Fail("ProfileBoundaryFilletRadiusExceedsHost");
- return Build(profile, loop, target, radius, clearance, a, b, lineA, lineB, classification, start, end);
+ return BuildConvex(profile, loop, target, radius, clearance, a, b, lineA, lineB, classification, start, end);
}
- private static ProfileFilletShellPlanResult Build(ResolvedProfile2D profile, ResolvedProfileLoop2D loop, ProfileBoundaryChamferTarget target, double radius, double clearance, int a, int b, LineArcLineSegment2D lineA, LineArcLineSegment2D lineB, ProfileJunctionClassification classification, double start, double end)
+ private static ProfileFilletShellPlanResult BuildConvex(ResolvedProfile2D profile, ResolvedProfileLoop2D loop, ProfileBoundaryChamferTarget target, double radius, double clearance, int a, int b, LineArcLineSegment2D lineA, LineArcLineSegment2D lineB, ProfileJunctionClassification classification, double start, double end)
{
ProfileFilletShellPlanResult Fail(string code) => new(false, null, null, null, null, [code]);
var frame = profile.EffectiveConstructionPlane; var isTop = target.Side == ProfileBoundaryChamferSide.Top;
@@ -711,6 +733,66 @@ public static class ProfileFilletShellPlanner
return new(true, body, correspondence, plan, null, ["ProfileFilletShellPlan", "ProfileBoundaryFilletExactQuarterCylinders", "ProfileBoundaryFilletConvexSphericalJunction"]);
}
+ private static ProfileFilletShellPlanResult BuildReflex(ResolvedProfile2D profile, ResolvedProfileLoop2D loop, ProfileBoundaryChamferTarget target, double radius, double clearance, int a, int b, LineArcLineSegment2D lineA, LineArcLineSegment2D lineB, ProfileJunctionClassification classification, double start, double end)
+ {
+ ProfileFilletShellPlanResult Fail(string code) => new(false, null, null, null, null, [code]);
+ var frame = profile.EffectiveConstructionPlane; var isTop = target.Side == ProfileBoundaryChamferSide.Top;
+ var capOut = isTop ? frame.AxisZ : Direction3D.Create(-frame.AxisZ.ToVector()); var axialInto = -capOut.ToVector(); var station = isTop ? end : start;
+ var ta = Direction(lineA, frame); var tb = Direction(lineB, frame); var signedArea = SignedArea(loop);
+ if (Math.Abs(signedArea) <= Tol) return Fail("ProfileBoundaryFilletReflexJunctionDegenerate");
+ var na = Inward(lineA, signedArea, frame); var nb = Inward(lineB, signedArea, frame);
+ if (Math.Abs(ta.ToVector().Dot(tb.ToVector())) > Tol || Math.Abs(na.ToVector().Dot(tb.ToVector()) + 1d) > Tol || Math.Abs(nb.ToVector().Dot(-ta.ToVector()) + 1d) > Tol)
+ return Fail("ProfileBoundaryFilletReflexAngleUnsupported");
+
+ var sourceAStart = frame.ToWorld(lineA.Start, station); var sourceBEnd = frame.ToWorld(lineB.End, station); var vertex = frame.ToWorld(lineA.End, station);
+ var sharpA = sourceAStart + ta.ToVector() * clearance; var sharpB = sourceBEnd - tb.ToVector() * clearance;
+ var capAE = sharpA + na.ToVector() * radius; var sideAE = sharpA + axialInto * radius; var centerA = sharpA + na.ToVector() * radius + axialInto * radius;
+ var capBE = sharpB + nb.ToVector() * radius; var sideBE = sharpB + axialInto * radius; var centerB = sharpB + nb.ToVector() * radius + axialInto * radius;
+ // The centre of every generating sphere lies on this radius-r spine.
+ var torusCenter = vertex + axialInto * radius;
+ var centerAJunction = torusCenter + na.ToVector() * radius; var centerBJunction = torusCenter + nb.ToVector() * radius;
+ var capJA = vertex + na.ToVector() * radius; var capJB = vertex + nb.ToVector() * radius; var depth = torusCenter;
+ var majorYAxis = capOut.ToVector().Cross(na.ToVector());
+ var majorEnd = Math.Atan2(nb.ToVector().Dot(majorYAxis), nb.ToVector().Dot(na.ToVector()));
+ if (Math.Abs(majorEnd) <= Tol) return Fail("ProfileBoundaryFilletReflexTrimDegenerate");
+ var torus = new TorusSurface(torusCenter, capOut, radius, radius, na);
+ var rolls = new[] { new ProfileFilletStraightRollPlan(loop.Segments[a].Name, ta, na, centerA, centerAJunction, ProfileFilletRollEndKind.EndpointTermination, ProfileFilletRollEndKind.ReflexJunction), new ProfileFilletStraightRollPlan(loop.Segments[b].Name, tb, nb, centerB, centerBJunction, ProfileFilletRollEndKind.EndpointTermination, ProfileFilletRollEndKind.ReflexJunction) };
+ var junction = new ProfileReflexFilletJunctionPlan(classification.VertexId, classification, torusCenter, radius, torus, capJA, capJB, depth, 0d, majorEnd, Math.PI / 2d, Math.PI);
+ var plan = new ProfileFilletShellPlan(target, radius, clearance, rolls, junction);
+
+ var builder = new TopologyBuilder(); var geometry = new BrepGeometryStore(); var bindings = new BrepBindingModel(); var points = new Dictionary<VertexId, Point3D>();
+ var vertices = new Dictionary<string, VertexId>(StringComparer.Ordinal); var edges = new Dictionary<(VertexId, VertexId), EdgeId>(); var descendants = new List<SemanticTopologyDescendant>(); var curveId = 1; var surfaceId = 1;
+ VertexId Vertex(string key, Point3D point) { if (vertices.TryGetValue(key, out var id)) return id; id = builder.AddVertex(); vertices[key] = id; points[id] = point; return id; }
+ EdgeId LineEdge(VertexId x, VertexId y) { var key = x.Value < y.Value ? (x, y) : (y, x); if (edges.TryGetValue(key, out var id)) return id; id = builder.AddEdge(x, y); edges[key] = id; var curve = new CurveGeometryId(curveId++); geometry.AddCurve(curve, CurveGeometry.FromLine(new Line3Curve(points[x], Direction3D.Create(points[y] - points[x])))); bindings.AddEdgeBinding(new EdgeGeometryBinding(id, curve, new ParameterInterval(0d, (points[y] - points[x]).Length), true)); return id; }
+ EdgeId ArcEdge(VertexId x, VertexId y, Point3D c) { var key = x.Value < y.Value ? (x, y) : (y, x); if (edges.TryGetValue(key, out var id)) return id; var ux = points[x] - c; var uy = points[y] - c; var normal = ux.Cross(uy); if (normal.Length <= Tol) throw new InvalidOperationException($"ProfileBoundaryFilletReflexTrimDegenerate:{x.Value}->{y.Value}"); id = builder.AddEdge(x, y); edges[key] = id; var curve = new CurveGeometryId(curveId++); geometry.AddCurve(curve, CurveGeometry.FromCircle(new Circle3Curve(c, Direction3D.Create(normal), radius, Direction3D.Create(ux)))); bindings.AddEdgeBinding(new EdgeGeometryBinding(id, curve, new ParameterInterval(0d, Math.PI / 2d), true)); return id; }
+ FaceId Face(string stable, IReadOnlyList<(VertexId Vertex, bool Arc, Point3D? Center)> boundary, SurfaceGeometry surface, SemanticTopologyRole role, string source, string? parent = null) { var loopId = builder.AllocateLoopId(); var coedges = Enumerable.Range(0, boundary.Count).Select(_ => builder.AllocateCoedgeId()).ToArray(); for (var i = 0; i < boundary.Count; i++) { var current = boundary[i]; var next = boundary[(i + 1) % boundary.Count]; var edge = current.Arc ? ArcEdge(current.Vertex, next.Vertex, current.Center!.Value) : LineEdge(current.Vertex, next.Vertex); var modelEdge = builder.Model.Edges.Single(item => item.Id == edge); builder.AddCoedge(new Coedge(coedges[i], edge, loopId, coedges[(i + 1) % boundary.Count], coedges[(i + boundary.Count - 1) % boundary.Count], modelEdge.StartVertexId != current.Vertex)); } builder.AddLoop(new Loop(loopId, coedges)); var face = builder.AddFace([loopId]); var surfaceIdValue = new SurfaceGeometryId(surfaceId++); geometry.AddSurface(surfaceIdValue, surface); bindings.AddFaceBinding(new FaceGeometryBinding(face, surfaceIdValue, true)); descendants.Add(new(stable, "Face", role, source, Face: face, ParentStableId: parent)); return face; }
+ static (VertexId Vertex, bool Arc, Point3D? Center) L(VertexId x) => (x, false, null); static (VertexId Vertex, bool Arc, Point3D? Center) A(VertexId x, Point3D c) => (x, true, c);
+
+ var n = loop.Segments.Count; var lower = new VertexId[n]; var upper = new VertexId[n];
+ for (var i = 0; i < n; i++) { var line = (LineArcLineSegment2D)loop.Segments[i].Geometry; lower[i] = Vertex($"lower:{i}", frame.ToWorld(line.Start, start)); upper[i] = Vertex($"upper:{i}", frame.ToWorld(line.Start, end)); }
+ var cap = isTop ? upper : lower; var opposite = isTop ? lower : upper;
+ var sharpAV = Vertex("sharp-a", sharpA); var sharpBV = Vertex("sharp-b", sharpB); var capAEV = Vertex("cap-a-external", capAE); var capBEV = Vertex("cap-b-external", capBE); var sideAEV = Vertex("side-a-external", sideAE); var sideBEV = Vertex("side-b-external", sideBE); var capJAV = Vertex("junction-cap-a", capJA); var capJBV = Vertex("junction-cap-b", capJB); var depthV = Vertex("junction-vertical-notch", depth);
+ var capBoundary = new List<(VertexId Vertex, bool Arc, Point3D? Center)>();
+ for (var i = 0; i < n; i++) { if (i == a) { capBoundary.AddRange([L(cap[i]), L(sharpAV), L(capAEV), A(capJAV, vertex), L(capJBV), L(capBEV), L(sharpBV)]); continue; } if (i == b) continue; capBoundary.Add(L(cap[i])); }
+ var capFaceBoundary = isTop ? (IReadOnlyList<(VertexId Vertex, bool Arc, Point3D? Center)>)capBoundary : capBoundary.Select((_, index) => { var current = capBoundary[capBoundary.Count - 1 - index]; var originalStart = capBoundary[(capBoundary.Count - 2 - index + capBoundary.Count) % capBoundary.Count]; return (current.Vertex, originalStart.Arc, originalStart.Center); }).ToArray();
+ var capPlane = SurfaceGeometry.FromPlane(new PlaneSurface(frame.ToWorld((0d, 0d), station), capOut, ta)); var oppositePlane = SurfaceGeometry.FromPlane(new PlaneSurface(frame.ToWorld((0d, 0d), isTop ? start : end), Direction3D.Create(-capOut.ToVector()), ta));
+ Face($"{target.StableId}:{(isTop ? "top" : "bottom")}-cap", capFaceBoundary, capPlane, isTop ? SemanticTopologyRole.TopFaceBoundaryLoop : SemanticTopologyRole.BottomFaceBoundaryLoop, $"profile:{profile.Name}.{loop.Name}", target.StableId);
+ Face($"{target.StableId}:{(isTop ? "bottom" : "top")}-cap", (isTop ? lower.Reverse() : upper).Select(L).ToArray(), oppositePlane, isTop ? SemanticTopologyRole.BottomFaceBoundaryLoop : SemanticTopologyRole.TopFaceBoundaryLoop, $"profile:{profile.Name}.{loop.Name}", target.StableId);
+ for (var i = 0; i < n; i++) { var next = (i + 1) % n; var line = (LineArcLineSegment2D)loop.Segments[i].Geometry; var tangent = Direction(line, frame); var inward = Inward(line, signedArea, frame); var sideSurface = SurfaceGeometry.FromPlane(new PlaneSurface(frame.ToWorld(line.Start, start), Direction3D.Create(-inward.ToVector()), tangent)); if (i == a) Face($"profile:{profile.Name}.{loop.Name}.{loop.Segments[i].Name}:trimmed-side", [L(opposite[i]), L(opposite[next]), L(depthV), L(sideAEV), L(sharpAV), L(cap[i])], sideSurface, SemanticTopologyRole.ExtrusionSideFace, $"profile:{profile.Name}.{loop.Name}.{loop.Segments[i].Name}", target.StableId); else if (i == b) Face($"profile:{profile.Name}.{loop.Name}.{loop.Segments[i].Name}:trimmed-side", [L(opposite[i]), L(opposite[next]), L(cap[next]), L(sharpBV), L(sideBEV), L(depthV)], sideSurface, SemanticTopologyRole.ExtrusionSideFace, $"profile:{profile.Name}.{loop.Name}.{loop.Segments[i].Name}", target.StableId); else Face($"profile:{profile.Name}.{loop.Name}.{loop.Segments[i].Name}:side", [L(lower[i]), L(lower[next]), L(upper[next]), L(upper[i])], sideSurface, SemanticTopologyRole.ExtrusionSideFace, $"profile:{profile.Name}.{loop.Name}.{loop.Segments[i].Name}"); }
+ var cylinderA = SurfaceGeometry.FromCylinder(new CylinderSurface(centerA, ta, radius, capOut)); var cylinderB = SurfaceGeometry.FromCylinder(new CylinderSurface(centerBJunction, tb, radius, capOut));
+ Face($"{target.StableId}:FilletSurface({loop.Segments[a].Name})", [L(capAEV), A(capJAV, centerAJunction), L(depthV), A(sideAEV, centerA)], cylinderA, SemanticTopologyRole.FilletSurface, $"profile:{profile.Name}.{loop.Name}.{loop.Segments[a].Name}", target.StableId);
+ Face($"{target.StableId}:FilletSurface({loop.Segments[b].Name})", [L(capJBV), A(capBEV, centerB), L(sideBEV), A(depthV, centerBJunction)], cylinderB, SemanticTopologyRole.FilletSurface, $"profile:{profile.Name}.{loop.Name}.{loop.Segments[b].Name}", target.StableId);
+ Face($"{target.StableId}:ReflexJunctionPatch({loop.Segments[a].Name},{loop.Segments[b].Name})", [A(capJAV, vertex), A(capJBV, centerBJunction), A(depthV, centerAJunction)], SurfaceGeometry.FromTorus(torus), SemanticTopologyRole.ReflexJunctionPatch, classification.VertexId, target.StableId);
+ Face($"{target.StableId}:StartTerminationFace", [L(sharpAV), A(capAEV, centerA), L(sideAEV)], SurfaceGeometry.FromPlane(new PlaneSurface(sharpA, Direction3D.Create(-ta.ToVector()), capOut)), SemanticTopologyRole.StartTerminationFace, target.StableId, target.StableId);
+ Face($"{target.StableId}:EndTerminationFace", [L(sharpBV), A(sideBEV, centerB), L(capBEV)], SurfaceGeometry.FromPlane(new PlaneSurface(sharpB, tb, capOut)), SemanticTopologyRole.EndTerminationFace, target.StableId, target.StableId);
+ var shell = builder.AddShell(builder.Model.Faces.Select(face => face.Id).ToArray()); builder.AddBody([shell]); var body = new BrepBody(builder.Model, geometry, bindings, points); var validation = BrepBindingValidator.Validate(body, true); if (!validation.IsSuccess) return Fail("ProfileBoundaryFilletReflexTopologyPlanInvalid");
+ void AddEdge(string name, EdgeId edge, SemanticTopologyRole role, string source) => descendants.Add(new($"{target.StableId}:{name}", "Edge", role, source, Edge: edge, ParentStableId: target.StableId));
+ AddEdge($"CapContactEdge({loop.Segments[a].Name})", LineEdge(capAEV, capJAV), SemanticTopologyRole.CapContactEdge, loop.Segments[a].Provenance.StableId); AddEdge($"CapContactEdge({loop.Segments[b].Name})", LineEdge(capJBV, capBEV), SemanticTopologyRole.CapContactEdge, loop.Segments[b].Provenance.StableId); AddEdge($"SideContactEdge({loop.Segments[a].Name})", LineEdge(depthV, sideAEV), SemanticTopologyRole.SideContactEdge, loop.Segments[a].Provenance.StableId); AddEdge($"SideContactEdge({loop.Segments[b].Name})", LineEdge(sideBEV, depthV), SemanticTopologyRole.SideContactEdge, loop.Segments[b].Provenance.StableId); AddEdge("JunctionToRollA", ArcEdge(capJAV, depthV, centerAJunction), SemanticTopologyRole.JunctionToRollA, classification.VertexId); AddEdge("JunctionToRollB", ArcEdge(capJBV, depthV, centerBJunction), SemanticTopologyRole.JunctionToRollB, classification.VertexId); AddEdge("JunctionCapContact", ArcEdge(capJAV, capJBV, vertex), SemanticTopologyRole.JunctionCapContact, classification.VertexId);
+ descendants.Add(new($"{target.StableId}:JunctionSideAContact", "Vertex", SemanticTopologyRole.JunctionSideAContact, classification.VertexId, Vertex: depthV, ParentStableId: target.StableId)); descendants.Add(new($"{target.StableId}:JunctionSideBContact", "Vertex", SemanticTopologyRole.JunctionSideBContact, classification.VertexId, Vertex: depthV, ParentStableId: target.StableId));
+ var correspondence = new SemanticTopologyCorrespondence(target.HostBodyId, descendants, ["ResolvedProfile2D", "ProfileFilletShellPlan", "StraightRoll", "ReflexFilletJunctionPlan", "HornToroidalPatch", "AuthoritativeBRepPlan"]);
+ return new(true, body, correspondence, plan, null, ["ProfileFilletShellPlan", "ProfileBoundaryFilletExactQuarterCylinders", "ProfileBoundaryFilletReflexToroidalJunction"]);
+ }
+
private static int IndexOf(ResolvedProfileLoop2D loop, string segmentId) => loop.Segments.Select((segment, index) => (segment, index)).Where(item => item.segment.Name == segmentId).Select(item => item.index).DefaultIfEmpty(-1).Single();
private static double Length(LineArcLineSegment2D line) => Math.Sqrt(Math.Pow(line.End.X - line.Start.X, 2d) + Math.Pow(line.End.Y - line.Start.Y, 2d));
private static Direction3D Direction(LineArcLineSegment2D line, ConstructionPlane frame) { var length = Length(line); return Direction3D.Create(frame.ToWorldDirection(new Vector3D((line.End.X - line.Start.X) / length, (line.End.Y - line.Start.Y) / length, 0d))); }
diff --git a/Aetheris.Kernel.Firmament/Materializer/SemanticTopologySelections.cs b/Aetheris.Kernel.Firmament/Materializer/SemanticTopologySelections.cs
index f90aaa26..d83a4942 100644
--- a/Aetheris.Kernel.Firmament/Materializer/SemanticTopologySelections.cs
+++ b/Aetheris.Kernel.Firmament/Materializer/SemanticTopologySelections.cs
@@ -5,7 +5,7 @@ using System.Text.RegularExpressions;
namespace Aetheris.Kernel.Firmament.Materializer;
/// <summary>Stable roles assigned while an authoritative plan is materialized. These are not geometric queries.</summary>
-public enum SemanticTopologyRole { Unknown, ProfileVertex, VerticalExtrusionEdge, LocalStartBoundary, LocalEndBoundary, LocalStartCapLoop, LocalEndCapLoop, TopBoundary, BottomBoundary, ExtrusionSideFace, TopFaceBoundaryLoop, BottomFaceBoundaryLoop, HoleEntryLoop, HoleExitLoop, HoleWallFace, HoleShaftToDrillPointLoop, HoleShaftToDrillPointEdge, HoleDrillPointFace, HoleTipVertex, HoleCounterboreMouthLoop, HoleCounterboreWallFace, HoleCounterboreShoulderLoop, HoleCounterboreShaftWallFace, SlotEntryLoop, SlotExitLoop, SlotWallFace, SlotStraightWallFace, SlotEndWallFace, ComposeTransition, EdgeFinishReplacementFace, FilletSurface, ConvexJunctionPatch, CapContactEdge, SideContactEdge, JunctionToRollA, JunctionToRollB, JunctionCapContact, JunctionSideAContact, JunctionSideBContact, StartTerminationFace, EndTerminationFace, StartEndpointArc, EndEndpointArc, RetainedStartSharpEdge, RetainedEndSharpEdge }
+public enum SemanticTopologyRole { Unknown, ProfileVertex, VerticalExtrusionEdge, LocalStartBoundary, LocalEndBoundary, LocalStartCapLoop, LocalEndCapLoop, TopBoundary, BottomBoundary, ExtrusionSideFace, TopFaceBoundaryLoop, BottomFaceBoundaryLoop, HoleEntryLoop, HoleExitLoop, HoleWallFace, HoleShaftToDrillPointLoop, HoleShaftToDrillPointEdge, HoleDrillPointFace, HoleTipVertex, HoleCounterboreMouthLoop, HoleCounterboreWallFace, HoleCounterboreShoulderLoop, HoleCounterboreShaftWallFace, SlotEntryLoop, SlotExitLoop, SlotWallFace, SlotStraightWallFace, SlotEndWallFace, ComposeTransition, EdgeFinishReplacementFace, FilletSurface, ConvexJunctionPatch, ReflexJunctionPatch, CapContactEdge, SideContactEdge, JunctionToRollA, JunctionToRollB, JunctionCapContact, JunctionSideAContact, JunctionSideBContact, StartTerminationFace, EndTerminationFace, StartEndpointArc, EndEndpointArc, RetainedStartSharpEdge, RetainedEndSharpEdge }
public enum SemanticSelectionRequirement { ExactlyOne, OneOrMore, ConnectedChain, ClosedLoop, NonEmptyFaceSet }
public enum SemanticSelectionFailure { None, SemanticSourceNotFound, NoMaterializedDescendants, AmbiguousBodyContext, SelectionCardinalityMismatch, DescendantsNotConnected, DescendantsBranch, DescendantsDoNotClose, MixedBoundaryRoles, UnsupportedTopologyChange, SelectionConsumerMismatch }
diff --git a/docs/firmament/profile-fillet-common-cases-x2.md b/docs/firmament/profile-fillet-common-cases-x2.md
index 157c8d27..9451f9a8 100644
--- a/docs/firmament/profile-fillet-common-cases-x2.md
+++ b/docs/firmament/profile-fillet-common-cases-x2.md
@@ -59,3 +59,11 @@ The next bounded implementation must create one authoritative
reflex-junction, and endpoint-termination subplans, then emit the complete
shell from that plan. It cannot be obtained safely by stitching M1 endpoint
faces or by generic B-rep edge editing.
+# Profile fillet common cases
+
+Two adjacent outer straight segments at a supported 90-degree reflex vertex
+have an experimental M3 horn-torus materialization. Select the pair as one
+`ConnectedChain` and use the ordinary Profile `EdgeFinish` syntax; authors do
+not provide torus parameters or trimming information. This path is not yet a
+portable external-kernel interchange guarantee because its torus trim ends at
+the horn pole.
diff --git a/docs/firmament/profile-reflex-fillet-junction-m3.md b/docs/firmament/profile-reflex-fillet-junction-m3.md
new file mode 100644
index 00000000..6ac73317
--- /dev/null
+++ b/docs/firmament/profile-reflex-fillet-junction-m3.md
@@ -0,0 +1,42 @@
+# Profile reflex fillet junction M3
+
+M3 rounds one source-selected 90-degree inside notch: two adjacent outer
+`Line2` Profile segments with a `270deg` material interior angle. The route is
+resolved Profile -> `ProfileFilletShellPlan` -> two `StraightRoll` plans ->
+`ReflexFilletJunctionPlan` -> authoritative B-rep; no materialized edge is
+searched and no Boolean or generic fillet operation is used.
+
+For the shared source vertex `V`, inward material normals `nA`, `nB`, outward
+cap direction `c`, and `into = -c`, each straight roll is unchanged from M1.
+At the reflex vertex its generating-ball centres run from
+`V + r*nA + r*into` to `V + r*nB + r*into` on a quarter circle of radius `r`
+around `O = V + r*into`. Sweeping the same radius `r` ball yields the bounded
+horn-torus patch `Torus(O, c, major=r, minor=r)`. Its domains are the signed
+quarter major interval from `nA` to `nB` and minor interval `[pi/2, pi]`.
+The final minor boundary collapses exactly to the retained vertical-notch point
+`O`; this admitted singular endpoint is not an unbounded horn-torus feature.
+
+The cap contact is a quarter circle centred at `V`. The cylinder/torus seams
+are exact quarter circles centred at the two endpoint rolling-ball centres.
+Each side-plane contact is the shared vertical-notch point. The two roll seams
+and cap contact are exact, but the `major = minor` torus has a pole at that
+shared notch point: the major direction, and therefore the analytic normal, is
+not unique there. This is a geometrically exact horn-torus construction, not
+a regular `C1` B-rep vertex. Only external start/end termination faces are
+emitted.
+
+M3 admits positive radii below host thickness and requires both selected spans
+to exceed `EndClearance + Radius`; non-orthogonal reflex pairs fail with
+`ProfileBoundaryFilletReflexAngleUnsupported`, and exhausted spans with
+`ProfileBoundaryFilletReflexRadiusTooLarge`. It intentionally does not admit
+3+ chains, loops, inner loops, curves, or arbitrary angles.
+
+`profile-fillet-reflex-two-segment-top.firmament` and Bottom demonstrate the
+local-frame mirror. Their assertion literal is `5595.374298764066 mm^3` with
+`0.5 mm^3` tolerance. An independent symbolic/numerical volume derivation is
+still required before this value can be promoted beyond its deterministic
+regression role. STEP exports one `TOROIDAL_SURFACE` and Aetheris/OCCT-style
+import paths can retain the topology, but this horn-pole trim is currently
+**not an external-kernel interchange guarantee**. A regular replacement patch
+or a different bounded construction is required before claiming portable M3
+support; viewers may fan tessellation or heal/split the pole differently.
diff --git a/fixtures/FirmamentV2/Canonical/invalid/profile-fillet-reflex-junction-not-materialized.firmament b/fixtures/FirmamentV2/Canonical/invalid/profile-fillet-reflex-junction-not-materialized.firmament
index 4e940da5..c871e70c 100644
--- a/fixtures/FirmamentV2/Canonical/invalid/profile-fillet-reflex-junction-not-materialized.firmament
+++ b/fixtures/FirmamentV2/Canonical/invalid/profile-fillet-reflex-junction-not-materialized.firmament
@@ -13,5 +13,5 @@ Model ProfileFilletReflexJunctionNotMaterialized {
Profile Bracket From Outline
Struct Body { Extrude Bracket { Profile: Bracket; From: 0mm; To: 8mm } }
Selection ReflexNotch { Source: Bracket.Outer.[Inner, Upright] Require: ConnectedChain }
- Modify Body { EdgeFinish ReflexRound { Target: ReflexNotch On: Top Kind: Fillet Radius: 2mm } }
+ Modify Body { EdgeFinish ReflexRound { Target: ReflexNotch On: Top Kind: Fillet Radius: 50mm } }
}
diff --git a/fixtures/FirmamentV2/Canonical/valid/profile-fillet-reflex-two-segment-bottom.firmament b/fixtures/FirmamentV2/Canonical/valid/profile-fillet-reflex-two-segment-bottom.firmament
new file mode 100644
index 00000000..51a8fee6
--- /dev/null
+++ b/fixtures/FirmamentV2/Canonical/valid/profile-fillet-reflex-two-segment-bottom.firmament
@@ -0,0 +1,22 @@
+Model ProfileFilletReflexTwoSegmentBottom {
+ Units: mm
+ Concept Path Outline {
+ Start: Point2(0mm, 0mm)
+ Heading: 0deg
+ Line South { Length: 40mm }
+ Line East { Turn: 90deg; Length: 10mm }
+ Line Inner { Turn: 90deg; Length: 30mm }
+ Line Upright { Turn: -90deg; Length: 30mm }
+ Line North { Turn: 90deg; Length: 10mm }
+ Close West
+ }
+ Profile Bracket From Outline
+ Struct Body { Extrude Bracket { Profile: Bracket; From: 0mm; To: 8mm } }
+ Selection ReflexNotch { Source: Bracket.Outer.[Inner, Upright] Require: ConnectedChain }
+ Modify Body { EdgeFinish ReflexRound { Target: ReflexNotch On: Bottom Kind: Fillet Radius: 2mm EndClearance: 3mm } }
+ Assert Volume Body {
+ Expected: 5595.374298764066mm^3
+ Tolerance: 0.5mm^3
+ Note: "Horn-torus quadrant regression literal"
+ }
+}
diff --git a/fixtures/FirmamentV2/Canonical/valid/profile-fillet-reflex-two-segment-concept-path.firmament b/fixtures/FirmamentV2/Canonical/valid/profile-fillet-reflex-two-segment-concept-path.firmament
new file mode 100644
index 00000000..b88b8915
--- /dev/null
+++ b/fixtures/FirmamentV2/Canonical/valid/profile-fillet-reflex-two-segment-concept-path.firmament
@@ -0,0 +1,17 @@
+Model ProfileFilletReflexTwoSegmentConceptPath {
+ Units: mm
+ Concept Path Outline {
+ Start: Point2(0mm, 0mm)
+ Heading: 0deg
+ Line South { Length: 40mm }
+ Line East { Turn: 90deg; Length: 10mm }
+ Line Inner { Turn: 90deg; Length: 30mm }
+ Line Upright { Turn: -90deg; Length: 30mm }
+ Line North { Turn: 90deg; Length: 10mm }
+ Close West
+ }
+ Profile Bracket From Outline
+ Struct Body { Extrude Bracket { Profile: Bracket; From: 0mm; To: 8mm } }
+ Selection ReflexNotch { Source: Bracket.Outer.[Inner, Upright] Require: ConnectedChain }
+ Modify Body { EdgeFinish ReflexRound { Target: ReflexNotch On: Top Kind: Fillet Radius: 2mm EndClearance: 3mm } }
+}
diff --git a/fixtures/FirmamentV2/Canonical/valid/profile-fillet-reflex-two-segment-low-level.firmament b/fixtures/FirmamentV2/Canonical/valid/profile-fillet-reflex-two-segment-low-level.firmament
new file mode 100644
index 00000000..567cecdd
--- /dev/null
+++ b/fixtures/FirmamentV2/Canonical/valid/profile-fillet-reflex-two-segment-low-level.firmament
@@ -0,0 +1,24 @@
+Model ProfileFilletReflexTwoSegmentLowLevel {
+ Units: mm
+ Concept Path Outline {
+ Start: Point2(0mm, 0mm)
+ Heading: 0deg
+ Line South { Length: 40mm }
+ Line East { Turn: 90deg; Length: 10mm }
+ Line Inner { Turn: 90deg; Length: 30mm }
+ Line Upright { Turn: -90deg; Length: 30mm }
+ Line North { Turn: 90deg; Length: 10mm }
+ Close West
+ }
+ Profile Bracket { Loop Outer {
+ Segment South { Trace: Outline.South; From: Outline.Start; To: Outline.South.End }
+ Segment East { Trace: Outline.East; From: Outline.South.End; To: Outline.East.End }
+ Segment Inner { Trace: Outline.Inner; From: Outline.East.End; To: Outline.Inner.End }
+ Segment Upright { Trace: Outline.Upright; From: Outline.Inner.End; To: Outline.Upright.End }
+ Segment North { Trace: Outline.North; From: Outline.Upright.End; To: Outline.North.End }
+ Segment West { Trace: Outline.West; From: Outline.North.End; To: Outline.West.End }
+ } }
+ Struct Body { Extrude Bracket { Profile: Bracket; From: 0mm; To: 8mm } }
+ Selection ReflexNotch { Source: Bracket.Outer.[Inner, Upright] Require: ConnectedChain }
+ Modify Body { EdgeFinish ReflexRound { Target: ReflexNotch On: Top Kind: Fillet Radius: 2mm EndClearance: 3mm } }
+}
diff --git a/fixtures/FirmamentV2/Canonical/valid/profile-fillet-reflex-two-segment-top.firmament b/fixtures/FirmamentV2/Canonical/valid/profile-fillet-reflex-two-segment-top.firmament
new file mode 100644
index 00000000..b6c32ddf
--- /dev/null
+++ b/fixtures/FirmamentV2/Canonical/valid/profile-fillet-reflex-two-segment-top.firmament
@@ -0,0 +1,22 @@
+Model ProfileFilletReflexTwoSegmentTop {
+ Units: mm
+ Concept Path Outline {
+ Start: Point2(0mm, 0mm)
+ Heading: 0deg
+ Line South { Length: 40mm }
+ Line East { Turn: 90deg; Length: 10mm }
+ Line Inner { Turn: 90deg; Length: 30mm }
+ Line Upright { Turn: -90deg; Length: 30mm }
+ Line North { Turn: 90deg; Length: 10mm }
+ Close West
+ }
+ Profile Bracket From Outline
+ Struct Body { Extrude Bracket { Profile: Bracket; From: 0mm; To: 8mm } }
+ Selection ReflexNotch { Source: Bracket.Outer.[Inner, Upright] Require: ConnectedChain }
+ Modify Body { EdgeFinish ReflexRound { Target: ReflexNotch On: Top Kind: Fillet Radius: 2mm EndClearance: 3mm } }
+ Assert Volume Body {
+ Expected: 5595.374298764066mm^3
+ Tolerance: 0.5mm^3
+ Note: "Horn-torus quadrant regression literal"
+ }
+}