Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
Firmament: |> Round(r) corner stages, from-only/to-only partial spans; volume guard for rounded stock
Claudec156d5f44dda
diff --git a/Aetheris.CLI.Tests/AuthoringConvenienceCliTests.cs b/Aetheris.CLI.Tests/AuthoringConvenienceCliTests.csindex 6acc1703..ce206ca2 100644--- a/Aetheris.CLI.Tests/AuthoringConvenienceCliTests.cs+++ b/Aetheris.CLI.Tests/AuthoringConvenienceCliTests.cs@@ -34,10 +34,24 @@ public sealed class AuthoringConvenienceCliTestsAssert.Equal(8, body.Topology.Faces.Count());}+ [Fact]+ public void PartialSpansRunFromAPointToTheGuideEndAndFromTheCurrentPointToAPoint()+ {+ var body = BuildAndImport("fixtures/Regression/AuthoringConvenience/partial-spans.firmament");+ // Two bottom pieces, two flanks, three full sides, top and bottom.+ Assert.Equal(9, body.Topology.Faces.Count());+ var points = body.Topology.Vertices.Select(v => body.TryGetVertexPoint(v.Id, out var p) ? (Math.Round(p.X, 9), Math.Round(p.Y, 9)) : (double.NaN, double.NaN)).Distinct().ToHashSet();+ Assert.Contains((-10d, -15d), points);+ Assert.Contains((0d, -5d), points);+ Assert.Contains((10d, -15d), points);+ Assert.Equal(7, points.Count);+ }+[Theory][InlineData("sqrt-negative.firmament", "firmament-v2-expression-unsupported", "outside its domain")][InlineData("unknown-intrinsic.firmament", "firmament-v2-expression-unsupported", "calls 'Atan', which is not a compile-time intrinsic (Pow, Sqrt, Sin, Cos, Tan)")][InlineData("zero-length-step.firmament", "concept-path-zero-length:Outline:Back", "Step 'Back' of Path 'Outline' has zero length")]+ [InlineData("round-oversized.firmament", "firmament-pipeline-round-invalid:Outer:Bottom", "Round(40mm) after 'Bottom': the radius is too large")][InlineData("shape-negative-size.firmament", "firmament-boundary2-invalid-dimensions:Plate__Boundary", "Shape 'Plate' has missing or non-positive dimensions")]public void RejectionsExplainThemselves(string file, string code, string message){@@ -47,10 +61,10 @@ public sealed class AuthoringConvenienceCliTestsAssert.NotEqual(0, exit);using var document = JsonDocument.Parse(stdout.ToString());var report = document.RootElement.TryGetProperty("firmamentV2Validation", out var nested) ? nested : document.RootElement;- var diagnostic = report.GetProperty("diagnostics").EnumerateArray().Single(d => d.GetProperty("code").GetString() == code);+ var diagnostic = report.GetProperty("diagnostics").EnumerateArray().Single(d => d.GetProperty("code").GetString()!.Split(": ")[0] == code);var text = diagnostic.GetProperty("message").GetString()!;Assert.Contains(message, text, StringComparison.Ordinal);- Assert.NotEqual(code, text);+ Assert.False(text.StartsWith(code, StringComparison.Ordinal), text);}private static Aetheris.Kernel.Core.Brep.BrepBody BuildAndImport(string fixture)diff --git a/Aetheris.CLI.Tests/ShapeComparisonCliTests.cs b/Aetheris.CLI.Tests/ShapeComparisonCliTests.csindex 7d2468f8..b9d606cc 100644--- a/Aetheris.CLI.Tests/ShapeComparisonCliTests.cs+++ b/Aetheris.CLI.Tests/ShapeComparisonCliTests.cs@@ -9,6 +9,7 @@ public sealed class ShapeComparisonCliTestsprivate static readonly Lazy<string> PlateBossHole = new(() => Build("fixtures/Regression/ShapeCompare/plate-boss-hole.firmament"));private static readonly Lazy<string> PlateBoss = new(() => Build("fixtures/Regression/ShapeCompare/plate-boss.firmament"));private static readonly Lazy<string> Ctc01 = new(() => Build("fixtures/Regression/Decompile/ctc-01.firmament"));+ private static readonly Lazy<string> RoundStages = new(() => Build("fixtures/Regression/AuthoringConvenience/round-stages.firmament"));private static string Ctc01Original => Path.Combine(RepoRoot, "testdata/step242/nist/CTC/nist_ctc_01_asme1_ap242-e1.stp");[Fact]@@ -65,10 +66,23 @@ public sealed class ShapeComparisonCliTests}}+ [Fact]+ public void RoundStagesBuildTheSameSolidAsRoundedRect2()+ {+ var reference = Build("fixtures/Regression/AuthoringConvenience/rounded-rect-reference.firmament");+ var result = StepShapeComparison.Compare(reference, RoundStages.Value, resolution: 200);++ Assert.Empty(result.Carriers.MissingFromCandidate);+ Assert.Empty(result.Carriers.ExtraInCandidate);+ Assert.Equal(10, result.Carriers.ReferenceCarrierCount);+ Assert.Equal(1d, result.Overlap.IntersectionOverUnion, 9);+ }+[Fact]public void BoxMinusHoleVolumeIsNotClaimedForStockThatIsNotTheBoundingBox(){- foreach (var step in new[] { PlateBossHole.Value, Ctc01.Value })+ // The rounded rectangle's corner cylinders reach the box sides: they are stock, not holes.+ foreach (var step in new[] { PlateBossHole.Value, Ctc01.Value, RoundStages.Value }){try{diff --git a/Aetheris.CLI/StepAnalyzer.cs b/Aetheris.CLI/StepAnalyzer.csindex ec69eeaa..f8a67dea 100644--- a/Aetheris.CLI/StepAnalyzer.cs+++ b/Aetheris.CLI/StepAnalyzer.cs@@ -305,6 +305,10 @@ public sealed record VolumeAnalysisResult({return false;}+ if (!cylinders.All(c => DiskInsideFootprint(c.CenterY, c.CenterZ, c.Radius, bbox.Min.Y, bbox.Max.Y, bbox.Min.Z, bbox.Max.Z, bbox)))+ {+ return false;+ }var baseVolume = (bbox.Max.X - bbox.Min.X) * (bbox.Max.Y - bbox.Min.Y) * (bbox.Max.Z - bbox.Min.Z);// One analytic cylinder may be represented by multiple trimmed faces@@ -365,6 +369,10 @@ public sealed record VolumeAnalysisResult({return false;}+ if (!cylinders.All(c => DiskInsideFootprint(c.CenterX, c.CenterY, c.Radius, bbox.Min.X, bbox.Max.X, bbox.Min.Y, bbox.Max.Y, bbox)))+ {+ return false;+ }var baseVolume = (bbox.Max.X - bbox.Min.X) * (bbox.Max.Y - bbox.Min.Y) * (bbox.Max.Z - bbox.Min.Z);var breakpoints = cylinders.SelectMany(c => new[] { c.ZMin, c.ZMax }).Distinct().OrderBy(z => z).ToArray();@@ -425,6 +433,17 @@ public sealed record VolumeAnalysisResult(return true;}+ /// <summary>+ /// A hole's cross-section must lie strictly inside the box's footprint. A cylinder reaching the box side is+ /// a rounded corner or edge of the stock (material, not a hole), and subtracting it would be wrong.+ /// </summary>+ private static bool DiskInsideFootprint(double u, double v, double radius, double uMin, double uMax, double vMin, double vMax, BoundingBox3D bbox)+ {+ var tolerance = double.Max(1e-7, (bbox.Max - bbox.Min).Length * 1e-9);+ return u - radius > uMin + tolerance && u + radius < uMax - tolerance+ && v - radius > vMin + tolerance && v + radius < vMax - tolerance;+ }+private static bool TryResolveFaceZSpan(BrepBody body, FaceId faceId, out double zMin, out double zMax){zMin = double.PositiveInfinity;diff --git a/Aetheris.Kernel.Firmament.Tests/ProfileCornerRoundTests.cs b/Aetheris.Kernel.Firmament.Tests/ProfileCornerRoundTests.csnew file mode 100644index 00000000..1ffd946c--- /dev/null+++ b/Aetheris.Kernel.Firmament.Tests/ProfileCornerRoundTests.cs@@ -0,0 +1,82 @@+using Aetheris.Kernel.Firmament.FirmamentV2;+using Aetheris.Kernel.Firmament.Materializer;++namespace Aetheris.Kernel.Firmament.Tests;++/// <summary>`|> Round(r)` geometry: the arc is tangent to both trimmed neighbours and joins them continuously.</summary>+public sealed class ProfileCornerRoundTests+{+ public static TheoryData<string, LineArcProfileCurve2D, LineArcProfileCurve2D, double> Corners() => new()+ {+ // Convex and concave line corners, at right and oblique angles.+ { "line-line convex", new LineArcLineSegment2D((-20, 0), (0, 0)), new LineArcLineSegment2D((0, 0), (0, 20)), 3 },+ { "line-line concave", new LineArcLineSegment2D((-20, 0), (0, 0)), new LineArcLineSegment2D((0, 0), (0, -20)), 3 },+ { "line-line oblique", new LineArcLineSegment2D((-20, 0), (0, 0)), new LineArcLineSegment2D((0, 0), (10, 15)), 2 },+ // A line into a clockwise arc whose start tangent turns left of the line.+ { "line-arc", new LineArcLineSegment2D((-20, 0), (0, 0)), new LineArcCircularArc2D((10, 0), 10, Math.PI, -Math.PI / 2), 2 },+ // A counter-clockwise arc into a line leaving it at a corner.+ { "arc-line", new LineArcCircularArc2D((0, 10), 10, -Math.PI / 2, Math.PI / 4), new LineArcLineSegment2D((10 * Math.Sin(Math.PI / 4), 10 - 10 * Math.Cos(Math.PI / 4)), (20, 20)), 1 },+ // Two arcs meeting at a corner.+ { "arc-arc", new LineArcCircularArc2D((0, 10), 10, -Math.PI / 2, Math.PI / 3), new LineArcCircularArc2D((10 * Math.Sin(Math.PI / 3) + 8, 10 - 10 * Math.Cos(Math.PI / 3)), 8, Math.PI, -Math.PI / 3), 1 },+ };++ [Theory]+ [MemberData(nameof(Corners))]+ public void RoundIsTangentAndContinuous(string name, LineArcProfileCurve2D previous, LineArcProfileCurve2D next, double radius)+ {+ var result = ProfileCornerRound.TryRound(previous, next, radius, out var failure);+ Assert.True(result is not null, $"{name}: {failure}");+ Assert.Equal(radius, result.Arc.Radius, 12);+ AssertJoin(result.Previous, result.Arc, name + " entry");+ AssertJoin(result.Arc, result.Next, name + " exit");+ // The centre is exactly one radius from both neighbours' carriers.+ Assert.Equal(radius, CarrierDistance(previous, result.Arc.Center), 9);+ Assert.Equal(radius, CarrierDistance(next, result.Arc.Center), 9);+ // A round replaces a corner, so it turns by less than a half circle.+ Assert.InRange(Math.Abs(result.Arc.SweepAngleRadians), 1e-6, Math.PI);+ }++ [Fact]+ public void TangentJunctionsAndOversizedRadiiAreRefused()+ {+ var line = new LineArcLineSegment2D((-20, 0), (0, 0));+ Assert.Null(ProfileCornerRound.TryRound(line, new LineArcLineSegment2D((0, 0), (20, 0)), 2, out var straight));+ Assert.Contains("tangentially", straight);+ Assert.Null(ProfileCornerRound.TryRound(line, new LineArcLineSegment2D((0, 0), (0, 5)), 8, out var large));+ Assert.Contains("too large", large);+ Assert.Null(ProfileCornerRound.TryRound(line, new LineArcLineSegment2D((1, 0), (1, 5)), 1, out var apart));+ Assert.Contains("do not meet", apart);+ }++ private static void AssertJoin(LineArcProfileCurve2D a, LineArcProfileCurve2D b, string where)+ {+ var (end, tangentA) = EndOf(a); var (start, tangentB) = StartOf(b);+ Assert.True(Math.Abs(end.X - start.X) < 1e-9 && Math.Abs(end.Y - start.Y) < 1e-9, $"{where}: gap {end} -> {start}");+ Assert.True(Math.Abs(tangentA.X * tangentB.Y - tangentA.Y * tangentB.X) < 1e-9 && tangentA.X * tangentB.X + tangentA.Y * tangentB.Y > 0, $"{where}: not tangent");+ }++ private static ((double X, double Y) Point, (double X, double Y) Tangent) StartOf(LineArcProfileCurve2D c) => c switch+ {+ LineArcLineSegment2D l => (l.Start, Unit(l.End.X - l.Start.X, l.End.Y - l.Start.Y)),+ LineArcCircularArc2D a => (Point(a, a.StartAngleRadians), Tangent(a, a.StartAngleRadians)),+ _ => throw new InvalidOperationException()+ };++ private static ((double X, double Y) Point, (double X, double Y) Tangent) EndOf(LineArcProfileCurve2D c) => c switch+ {+ LineArcLineSegment2D l => (l.End, Unit(l.End.X - l.Start.X, l.End.Y - l.Start.Y)),+ LineArcCircularArc2D a => (Point(a, a.StartAngleRadians + a.SweepAngleRadians), Tangent(a, a.StartAngleRadians + a.SweepAngleRadians)),+ _ => throw new InvalidOperationException()+ };++ private static double CarrierDistance(LineArcProfileCurve2D c, (double X, double Y) p) => c switch+ {+ LineArcLineSegment2D l => Math.Abs((l.End.X - l.Start.X) * (p.Y - l.Start.Y) - (l.End.Y - l.Start.Y) * (p.X - l.Start.X)) / Math.Sqrt(Math.Pow(l.End.X - l.Start.X, 2) + Math.Pow(l.End.Y - l.Start.Y, 2)),+ LineArcCircularArc2D a => Math.Abs(Math.Sqrt(Math.Pow(p.X - a.Center.X, 2) + Math.Pow(p.Y - a.Center.Y, 2)) - a.Radius),+ _ => throw new InvalidOperationException()+ };++ private static (double X, double Y) Point(LineArcCircularArc2D a, double t) => (a.Center.X + a.Radius * Math.Cos(t), a.Center.Y + a.Radius * Math.Sin(t));+ private static (double X, double Y) Tangent(LineArcCircularArc2D a, double t) => Unit(-Math.Sin(t) * Math.Sign(a.SweepAngleRadians), Math.Cos(t) * Math.Sign(a.SweepAngleRadians));+ private static (double X, double Y) Unit(double x, double y) { var l = Math.Sqrt(x * x + y * y); return (x / l, y / l); }+}diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/ProfileAuthoringParser.cs b/Aetheris.Kernel.Firmament/FirmamentV2/ProfileAuthoringParser.csindex 33ae2de4..6fc29df6 100644--- a/Aetheris.Kernel.Firmament/FirmamentV2/ProfileAuthoringParser.cs+++ b/Aetheris.Kernel.Firmament/FirmamentV2/ProfileAuthoringParser.cs@@ -1017,9 +1017,33 @@ public static class ProfileAuthoringParser(double X, double Y)? first = null;(double X, double Y)? current = null;string? currentIdentity = null;+ PipelineStage? pendingRound = null;+ var roundCount = 0;+ ResolvedProfileSegment2D? Rounded(PipelineStage round, int previousIndex, ref LineArcProfileCurve2D next, int index)+ {+ var previous = result[previousIndex];+ var rounded = ProfileCornerRound.TryRound(previous.Geometry, next, round.Radius!.Value, out var failure);+ if (rounded is null)+ {+ diagnostics.Add($"firmament-pipeline-round-invalid:{loopName}:{previous.Name}: Round({round.Radius.Value:0.###}mm) after '{previous.Name}': {failure}.");+ return null;+ }+ result[previousIndex] = previous with { Geometry = rounded.Previous };+ next = rounded.Next;+ var arcName = round.Alias ?? $"{previous.Name}Round{++roundCount}";+ if (!names.Add(arcName)) { diagnostics.Add($"firmament-profile-pipeline-identity-collision:{arcName}"); return null; }+ return PipelineSegment(profile, loopName, arcName, rounded.Arc, $"concept:{profile.Frame ?? "XY"}.Round:{arcName}", "Round", false, index, expression.Span.Start + round.Offset);+ }for (var index = 0; index < traceStages.Length; index++){var stage = traceStages[index];+ if (stage.Kind == PipelineStageKind.Round)+ {+ if (result.Count == 0 || pendingRound is not null)+ { diagnostics.Add($"firmament-pipeline-round-invalid:{loopName}: Round must follow a traced stage and precede another stage or Close."); continue; }+ pendingRound = stage;+ continue;+ }if (stage.Kind != PipelineStageKind.Trace){diagnostics.Add($"firmament-pipeline-stage-type:{stage.Reference}");@@ -1031,10 +1055,19 @@ public static class ProfileAuthoringParsercontinue;}bool reversed;- var oriented = stage.To is null+ // `from P` alone runs from P to the guide's end in its own direction (its start under Reverse);+ // `to P` alone continues from the current point.+ var oriented = stage.To is null && stage.From is null? OrientPipelineCurve(source, stage.Reverse, current, stage.Reference!, points, diagnostics, out reversed): SelectPipelineSubspan(source, stage, current, points, diagnostics, out reversed);if (oriented is null) continue;+ ResolvedProfileSegment2D? roundArc = null;+ if (pendingRound is not null)+ {+ roundArc = Rounded(pendingRound, result.Count - 1, ref oriented, index);+ pendingRound = null;+ if (roundArc is not null) result.Add(roundArc);+ }var start = Start(oriented); var end = End(oriented);first ??= start;current = end;@@ -1044,6 +1077,24 @@ public static class ProfileAuthoringParserif (!names.Add(name)) { diagnostics.Add($"firmament-profile-pipeline-identity-collision:{name}"); continue; }result.Add(PipelineSegment(profile, loopName, name, oriented, $"concept:{profile.Frame ?? "XY"}.{stage.Reference}", stage.Reference!, reversed, index, expression.Span.Start + stage.Offset));}+ if (pendingRound is not null)+ {+ // A Round before Close fillets the junction where the loop closes, between the last and first stages.+ if (!close || result.Count < 2)+ diagnostics.Add($"firmament-pipeline-round-invalid:{loopName}: Round must follow a traced stage and precede another stage or Close.");+ else+ {+ var firstCurve = result[0].Geometry;+ if (Rounded(pendingRound, result.Count - 1, ref firstCurve, traceStages.Length) is { } closingArc)+ {+ result[0] = result[0] with { Geometry = firstCurve };+ result.Add(closingArc);+ first = Start(firstCurve);+ current = End(closingArc.Geometry);+ currentIdentity = DescribeEndpoint(current.Value, points);+ }+ }+ }if (close && first is not null && current is not null && Distance(first.Value, current.Value) > Tolerance)diagnostics.Add($"firmament-pipeline-close-open:{loopName}:first={DescribeEndpoint(first.Value, points)}:current={currentIdentity}");return result;@@ -1071,7 +1122,9 @@ public static class ProfileAuthoringParserif (stage.Kind != PipelineStageKind.Trace) { diagnostics.Add($"firmament-pipeline-stage-type:{stage.Reference}"); continue; }if (!guides.TryGetValue(stage.Reference!, out var source)) { diagnostics.Add($"firmament-pipeline-unknown-guide:{stage.Reference}"); continue; }bool reversed;- var oriented = stage.To is null+ // `from P` alone runs from P to the guide's end in its own direction (its start under Reverse);+ // `to P` alone continues from the current point.+ var oriented = stage.To is null && stage.From is null? OrientPipelineCurve(source, stage.Reverse, current, stage.Reference!, points, diagnostics, out reversed): SelectPipelineSubspan(source, stage, current, points, diagnostics, out reversed);if (oriented is null) continue;@@ -1118,7 +1171,10 @@ public static class ProfileAuthoringParserdiagnostics.Add($"firmament-pipeline-unknown-endpoint:{stage.From}");return null;}- if (stage.To is null || !points.TryGetValue(stage.To, out var end))+ // `from P` alone runs to the guide's own end (its start under `reverse`).+ (double X, double Y) end;+ if (stage.To is null) end = stage.Reverse ? Start(source) : End(source);+ else if (!points.TryGetValue(stage.To, out end)){diagnostics.Add($"firmament-pipeline-unknown-endpoint:{stage.To}");return null;@@ -1137,7 +1193,7 @@ public static class ProfileAuthoringParser{if (!OnBoundedLine(start, line) || !OnBoundedLine(end, line) || Distance(start, end) <= Tolerance){- diagnostics.Add($"firmament-pipeline-endpoint-not-on-guide:{stage.Reference}:{stage.From ?? DescribeEndpoint(start, points)}:{stage.To}");+ diagnostics.Add($"firmament-pipeline-endpoint-not-on-guide:{stage.Reference}:{stage.From ?? DescribeEndpoint(start, points)}:{stage.To ?? DescribeEndpoint(end, points)}");return null;}var dx = line.End.X - line.Start.X; var dy = line.End.Y - line.Start.Y;@@ -1148,7 +1204,7 @@ public static class ProfileAuthoringParser{if (!OnCircle(start, circle.Center, circle.Radius) || !OnCircle(end, circle.Center, circle.Radius) || Distance(start, end) <= Tolerance){- diagnostics.Add($"firmament-pipeline-endpoint-not-on-guide:{stage.Reference}:{stage.From ?? DescribeEndpoint(start, points)}:{stage.To}");+ diagnostics.Add($"firmament-pipeline-endpoint-not-on-guide:{stage.Reference}:{stage.From ?? DescribeEndpoint(start, points)}:{stage.To ?? DescribeEndpoint(end, points)}");return null;}var startAngle = Math.Atan2(start.Y - circle.Center.Y, start.X - circle.Center.X);@@ -1170,7 +1226,7 @@ public static class ProfileAuthoringParserreturn selected;}}- diagnostics.Add($"firmament-pipeline-endpoint-not-on-guide:{stage.Reference}:{stage.From ?? DescribeEndpoint(start, points)}:{stage.To}");+ diagnostics.Add($"firmament-pipeline-endpoint-not-on-guide:{stage.Reference}:{stage.From ?? DescribeEndpoint(start, points)}:{stage.To ?? DescribeEndpoint(end, points)}");return null;}@@ -1307,6 +1363,15 @@ public static class ProfileAuthoringParservar offset = value.Span.Start - expression.Span.Start;if (value is ReferenceSyntax { Name.Text: "Close" }) { stages.Add(new(PipelineStageKind.Close, null, null, false, offset)); return; }if (value is ReferenceSyntax { Name.Text: "TraceLoop" }) { stages.Add(new(PipelineStageKind.TraceLoop, null, null, false, offset)); return; }+ // Round(r) between two stages fillets their junction; `Round(r) as Name` names the arc.+ var roundAlias = value is AliasSyntax { Value: CallSyntax } aliased ? aliased.Name.Text : null;+ if ((value is AliasSyntax { Value: CallSyntax } wrapped ? wrapped.Value : value) is CallSyntax { Target: ReferenceSyntax { Name.Text: "Round" } } round)+ {+ var measured = round.Arguments.Count == 1 && round.Arguments[0].Name is null+ && FirmamentSyntaxValues.TryMeasure(round.Arguments[0].Value, "mm", out var radius) && radius > 0 ? radius : (double?)null;+ stages.Add(new(measured is null ? PipelineStageKind.Invalid : PipelineStageKind.Round, "Round", roundAlias, false, offset, Radius: measured));+ return;+ }string? alias = null, from = null, to = null;var reverse = false; var valid = true; var traced = false;var inner = value;@@ -1317,7 +1382,7 @@ public static class ProfileAuthoringParser{valid &= !traced; traced = true;from = FirmamentSyntaxValues.Reference(t.From); to = FirmamentSyntaxValues.Reference(t.To);- valid &= (t.From is null || from is not null) && (t.To is null || to is not null) && (from is null || to is not null);+ valid &= (t.From is null || from is not null) && (t.To is null || to is not null);inner = t.Source;}else if (inner is UnarySyntax { Operator: UnaryOperator.Reverse } u) { valid &= !reverse; reverse = true; inner = u.Operand; }@@ -1544,7 +1609,7 @@ public static class ProfileAuthoringParserprivate sealed record PathStep(string Kind, string Name, string Body, int Index);private sealed record BoundPathStep(string Name, string Kind, string GuideName, string EndpointName, IReadOnlyList<LineArcProfileCurve2D> Curves, (double X, double Y) Start, (double X, double Y) End, double Heading, string? SourceReference = null, bool WasReversed = false, int? PipelineIndex = null, string? SourceRange = null);private sealed record BoundPath(string Name, (double X, double Y) Start, double InitialHeading, List<BoundPathStep> Steps);- private enum PipelineStageKind { Trace, Close, TraceLoop, Invalid }- private sealed record PipelineStage(PipelineStageKind Kind, string? Reference, string? Alias, bool Reverse, int Offset, string? From = null, string? To = null);+ private enum PipelineStageKind { Trace, Close, TraceLoop, Round, Invalid }+ private sealed record PipelineStage(PipelineStageKind Kind, string? Reference, string? Alias, bool Reverse, int Offset, string? From = null, string? To = null, double? Radius = null);}diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/ProfileCornerRound.cs b/Aetheris.Kernel.Firmament/FirmamentV2/ProfileCornerRound.csnew file mode 100644index 00000000..5e404bf1--- /dev/null+++ b/Aetheris.Kernel.Firmament/FirmamentV2/ProfileCornerRound.cs@@ -0,0 +1,211 @@+using Aetheris.Kernel.Firmament.Materializer;++namespace Aetheris.Kernel.Firmament.FirmamentV2;++/// <summary>+/// Rounds the junction where one traced line or circular arc ends and the next begins: a tangent arc of the given+/// radius replaces the corner, and both neighbours are trimmed back to their tangent points. The arc lies on the+/// side the path turns towards, so a convex corner is rounded off and a concave one is filled in.+/// </summary>+internal static class ProfileCornerRound+{+ private const double Tolerance = 1e-9;++ internal sealed record Result(LineArcProfileCurve2D Previous, LineArcCircularArc2D Arc, LineArcProfileCurve2D Next);++ internal static Result? TryRound(LineArcProfileCurve2D previous, LineArcProfileCurve2D next, double radius, out string? failure)+ {+ failure = null;+ if (!(radius > 0) || !double.IsFinite(radius)) { failure = "radius must be a positive length"; return null; }+ if (previous is not (LineArcLineSegment2D or LineArcCircularArc2D) || next is not (LineArcLineSegment2D or LineArcCircularArc2D))+ { failure = "only lines and circular arcs can be rounded"; return null; }++ var junction = End(previous);+ if (Distance(junction, Start(next)) > 1e-7) { failure = "the two stages do not meet"; return null; }+ var tangentIn = EndTangent(previous);+ var tangentOut = StartTangent(next);+ var turn = Cross(tangentIn, tangentOut);+ if (Math.Abs(turn) <= 1e-9 && Dot(tangentIn, tangentOut) > 0) { failure = "the stages already meet tangentially; there is no corner to round"; return null; }+ if (Math.Abs(turn) <= 1e-9) { failure = "the path reverses here; a round needs a corner"; return null; }+ var side = turn > 0 ? 1d : -1d; // +1: the path turns left, so the arc's centre is on the left of both stages.++ var centre = Centre(previous, next, radius, side, junction);+ if (centre is null) { failure = "no circle of this radius touches both stages near the corner"; return null; }+ var a = Foot(previous, centre.Value);+ var b = Foot(next, centre.Value);+ var trimmedPrevious = TrimEnd(previous, a);+ var trimmedNext = TrimStart(next, b);+ if (trimmedPrevious is null || trimmedNext is null)+ { failure = "the radius is too large: a tangent point falls outside a neighbouring stage"; return null; }++ var start = Math.Atan2(a.Y - centre.Value.Y, a.X - centre.Value.X);+ var end = Math.Atan2(b.Y - centre.Value.Y, b.X - centre.Value.X);+ var sweep = end - start;+ if (side > 0) { while (sweep <= 0) sweep += 2 * Math.PI; while (sweep > 2 * Math.PI) sweep -= 2 * Math.PI; }+ else { while (sweep >= 0) sweep -= 2 * Math.PI; while (sweep < -2 * Math.PI) sweep += 2 * Math.PI; }+ return new(trimmedPrevious, new LineArcCircularArc2D(centre.Value, radius, start, sweep), trimmedNext);+ }++ // The centre is r from both stages on the turning side: intersect each stage's offset (a parallel line or a+ // concentric circle) and keep the intersection nearest the corner.+ private static (double X, double Y)? Centre(LineArcProfileCurve2D previous, LineArcProfileCurve2D next, double r, double side, (double X, double Y) junction)+ {+ var candidates = Intersect(Offset(previous, r, side), Offset(next, r, side));+ return candidates.Count == 0 ? null : candidates.OrderBy(c => Distance(c, junction)).First();+ }++ private abstract record Carrier;+ private sealed record LineCarrier((double X, double Y) Point, (double X, double Y) Direction) : Carrier;+ private sealed record CircleCarrier((double X, double Y) Centre, double Radius) : Carrier;++ private static Carrier Offset(LineArcProfileCurve2D curve, double r, double side)+ {+ if (curve is LineArcLineSegment2D line)+ {+ var d = Normalize((line.End.X - line.Start.X, line.End.Y - line.Start.Y));+ var left = (X: -d.Y, Y: d.X);+ return new LineCarrier((line.Start.X + left.X * r * side, line.Start.Y + left.Y * r * side), d);+ }++ var arc = (LineArcCircularArc2D)curve;+ // Travelling counter-clockwise the centre is on the left; the offset towards the turning side shrinks+ // the circle when that side faces the centre and grows it otherwise.+ var towardsCentre = arc.SweepAngleRadians > 0 ? side > 0 : side < 0;+ return new CircleCarrier(arc.Center, towardsCentre ? arc.Radius - r : arc.Radius + r);+ }++ private static List<(double X, double Y)> Intersect(Carrier a, Carrier b)+ {+ switch (a, b)+ {+ case (LineCarrier p, LineCarrier q):+ {+ var denominator = Cross(p.Direction, q.Direction);+ if (Math.Abs(denominator) <= 1e-12) return [];+ var t = Cross((q.Point.X - p.Point.X, q.Point.Y - p.Point.Y), q.Direction) / denominator;+ return [(p.Point.X + p.Direction.X * t, p.Point.Y + p.Direction.Y * t)];+ }+ case (LineCarrier l, CircleCarrier c): return LineCircle(l, c);+ case (CircleCarrier c, LineCarrier l): return LineCircle(l, c);+ case (CircleCarrier p, CircleCarrier q):+ {+ if (p.Radius <= 0 || q.Radius <= 0) return [];+ var dx = q.Centre.X - p.Centre.X; var dy = q.Centre.Y - p.Centre.Y; var d = Math.Sqrt(dx * dx + dy * dy);+ if (d <= 1e-12 || d > p.Radius + q.Radius + 1e-12 || d < Math.Abs(p.Radius - q.Radius) - 1e-12) return [];+ var along = (p.Radius * p.Radius - q.Radius * q.Radius + d * d) / (2 * d);+ var h = Math.Sqrt(Math.Max(0, p.Radius * p.Radius - along * along));+ var mid = (X: p.Centre.X + dx * along / d, Y: p.Centre.Y + dy * along / d);+ return [(mid.X - dy * h / d, mid.Y + dx * h / d), (mid.X + dy * h / d, mid.Y - dx * h / d)];+ }+ }++ return [];+ }++ private static List<(double X, double Y)> LineCircle(LineCarrier line, CircleCarrier circle)+ {+ if (circle.Radius <= 0) return [];+ var f = (X: line.Point.X - circle.Centre.X, Y: line.Point.Y - circle.Centre.Y);+ var b = Dot(f, line.Direction);+ var c = Dot(f, f) - circle.Radius * circle.Radius;+ var discriminant = b * b - c;+ if (discriminant < -1e-12) return [];+ var root = Math.Sqrt(Math.Max(0, discriminant));+ return [(line.Point.X + line.Direction.X * (-b - root), line.Point.Y + line.Direction.Y * (-b - root)),+ (line.Point.X + line.Direction.X * (-b + root), line.Point.Y + line.Direction.Y * (-b + root))];+ }++ private static (double X, double Y) Foot(LineArcProfileCurve2D curve, (double X, double Y) point)+ {+ if (curve is LineArcLineSegment2D line)+ {+ var d = Normalize((line.End.X - line.Start.X, line.End.Y - line.Start.Y));+ var t = Dot((point.X - line.Start.X, point.Y - line.Start.Y), d);+ return (line.Start.X + d.X * t, line.Start.Y + d.Y * t);+ }++ var arc = (LineArcCircularArc2D)curve;+ var v = Normalize((point.X - arc.Center.X, point.Y - arc.Center.Y));+ return (arc.Center.X + v.X * arc.Radius, arc.Center.Y + v.Y * arc.Radius);+ }++ // Keeps the part of the curve from its start to the tangent point; null when the point is not on the curve.+ private static LineArcProfileCurve2D? TrimEnd(LineArcProfileCurve2D curve, (double X, double Y) point)+ {+ if (curve is LineArcLineSegment2D line)+ {+ var length = Distance(line.Start, line.End);+ var t = Dot((point.X - line.Start.X, point.Y - line.Start.Y), Normalize((line.End.X - line.Start.X, line.End.Y - line.Start.Y)));+ return t > Tolerance && t <= length + Tolerance ? new LineArcLineSegment2D(line.Start, point) : null;+ }++ var arc = (LineArcCircularArc2D)curve;+ var swept = SweptTo(arc, point);+ return swept is { } s && Math.Abs(s) > Tolerance ? arc with { SweepAngleRadians = s } : null;+ }++ // Keeps the part of the curve from the tangent point to its end; null when the point is not on the curve.+ private static LineArcProfileCurve2D? TrimStart(LineArcProfileCurve2D curve, (double X, double Y) point)+ {+ if (curve is LineArcLineSegment2D line)+ {+ var length = Distance(line.Start, line.End);+ var t = Dot((point.X - line.Start.X, point.Y - line.Start.Y), Normalize((line.End.X - line.Start.X, line.End.Y - line.Start.Y)));+ return t >= -Tolerance && t < length - Tolerance ? new LineArcLineSegment2D(point, line.End) : null;+ }++ var arc = (LineArcCircularArc2D)curve;+ var swept = SweptTo(arc, point);+ if (swept is not { } s || Math.Abs(arc.SweepAngleRadians - s) <= Tolerance) return null;+ return new LineArcCircularArc2D(arc.Center, arc.Radius, arc.StartAngleRadians + s, arc.SweepAngleRadians - s);+ }++ // Signed sweep from the arc's start to the point, within the arc; null when the point is outside it.+ private static double? SweptTo(LineArcCircularArc2D arc, (double X, double Y) point)+ {+ var angle = Math.Atan2(point.Y - arc.Center.Y, point.X - arc.Center.X) - arc.StartAngleRadians;+ var direction = Math.Sign(arc.SweepAngleRadians);+ while (angle * direction < -Tolerance) angle += 2 * Math.PI * direction;+ while (angle * direction > 2 * Math.PI) angle -= 2 * Math.PI * direction;+ return angle * direction <= Math.Abs(arc.SweepAngleRadians) + Tolerance ? angle : null;+ }++ private static (double X, double Y) StartTangent(LineArcProfileCurve2D curve) => curve switch+ {+ LineArcLineSegment2D line => Normalize((line.End.X - line.Start.X, line.End.Y - line.Start.Y)),+ LineArcCircularArc2D arc => ArcTangent(arc, arc.StartAngleRadians),+ _ => throw new InvalidOperationException()+ };++ private static (double X, double Y) EndTangent(LineArcProfileCurve2D curve) => curve switch+ {+ LineArcLineSegment2D line => Normalize((line.End.X - line.Start.X, line.End.Y - line.Start.Y)),+ LineArcCircularArc2D arc => ArcTangent(arc, arc.StartAngleRadians + arc.SweepAngleRadians),+ _ => throw new InvalidOperationException()+ };++ private static (double X, double Y) ArcTangent(LineArcCircularArc2D arc, double angle)+ {+ var s = Math.Sign(arc.SweepAngleRadians);+ return (-Math.Sin(angle) * s, Math.Cos(angle) * s);+ }++ private static (double X, double Y) Start(LineArcProfileCurve2D curve) => curve switch+ {+ LineArcLineSegment2D line => line.Start,+ LineArcCircularArc2D arc => (arc.Center.X + arc.Radius * Math.Cos(arc.StartAngleRadians), arc.Center.Y + arc.Radius * Math.Sin(arc.StartAngleRadians)),+ _ => throw new InvalidOperationException()+ };++ private static (double X, double Y) End(LineArcProfileCurve2D curve) => curve switch+ {+ LineArcLineSegment2D line => line.End,+ LineArcCircularArc2D arc => (arc.Center.X + arc.Radius * Math.Cos(arc.StartAngleRadians + arc.SweepAngleRadians), arc.Center.Y + arc.Radius * Math.Sin(arc.StartAngleRadians + arc.SweepAngleRadians)),+ _ => throw new InvalidOperationException()+ };++ private static double Cross((double X, double Y) a, (double X, double Y) b) => a.X * b.Y - a.Y * b.X;+ private static double Dot((double X, double Y) a, (double X, double Y) b) => a.X * b.X + a.Y * b.Y;+ private static double Distance((double X, double Y) a, (double X, double Y) b) => Math.Sqrt((a.X - b.X) * (a.X - b.X) + (a.Y - b.Y) * (a.Y - b.Y));+ private static (double X, double Y) Normalize((double X, double Y) v) { var l = Math.Sqrt(v.X * v.X + v.Y * v.Y); return (v.X / l, v.Y / l); }+}diff --git a/docs/development/reports/2026-11/CTC-01-DECOMPILE.md b/docs/development/reports/2026-11/CTC-01-DECOMPILE.mdindex ad6e0aa1..6fdbdea6 100644--- a/docs/development/reports/2026-11/CTC-01-DECOMPILE.md+++ b/docs/development/reports/2026-11/CTC-01-DECOMPILE.md@@ -159,9 +159,9 @@ What this showed about the language:| --- | --- || The V-notch tip **is** expressible: `Diagonal` flanks plus concave `Round` transitions give the exact R10 tip | Corrects item 3 above || `Round` needs `Concave: true` for both the V tip and the slot floor corners; the wrong value builds a plausible wrong outline with no diagnostic | Only `compare --shape` caught it; add a check that a round is tangent to its neighbours, or a clearer default |-| Each waist needs 3 `Point2`s and an `Arc2` (16 lines for four R25 waists) | A corner-round stage in traced loops (`|> Round 25mm`, filleting the junction of the stages either side) would replace them; it would also give Path vertex rounding |-| `RoundedRect2` publishes no tangent points; they exist only as internal `Name_Path.Step.End` names | Publish them (for example `LeftEnd.Right.Start`); four `Point2`s here only restate them |-| A partial span needs both `from` and `to`; `edge to P` alone is a stage-type error | `to`-only continuing from the current point would read naturally |+| Each waist needs 3 `Point2`s and an `Arc2` (16 lines for four R25 waists) | Fixed by `|> Round(r)` (below). A corner-round stage in traced loops (`|> Round 25mm`, filleting the junction of the stages either side) would replace them; it would also give Path vertex rounding |+| `RoundedRect2` publishes no tangent points; they exist only as internal `Name_Path.Step.End` names | Made unnecessary by partial spans (below) |+| A partial span needs both `from` and `to`; `edge to P` alone is a stage-type error | Fixed (below) || Edges from two shapes collide (`Bottom`, `Left`, ...), so every stage needs `as` | Acceptable; the error names the collision || A delta's `CenteredAt` is a distance from the edge's start, not a coordinate | Notch centres become 115/335/75/375 mm, not x = ±110/±150 || Template arguments take scalars but not inline record literals (`P: Spec { Center: 115mm }`) | Use scalar parameters or a named Static |@@ -172,6 +172,27 @@ What this showed about the language:specialize Struct/Model/Concept Struct/Panel/SheetMetal/Profile/ProfileDelta, plus the separate record-arrayfeature-template form used by `Pattern … over`. For CTC-01 the useful reuse was `Template<…> ProfileDelta`.+## Follow-up: `Round(r)` stages and partial spans++- **`|> Round(r)`** between two traced stages fillets their junction tangentially. It trims both neighbours+ (lines or arcs), bends into whichever side the corner turns, and works before `Close`. It refuses+ tangent junctions, stages that do not meet, and radii that do not fit, naming the stage. The four+ waists are now `|> Round(25mm)`; their 12 `Point2`s and 4 `Arc2`s are gone.+- **Partial spans:** `guide from P` runs to the guide's end, and `guide to P` continues from the current+ point. The `RoundedRect2` tangent points no longer need restating, so all five tangent-point `Point2`s+ are gone. Publishing them from `RoundedRect2` is therefore unnecessary.+- **`analyze volume`:** it claimed an exact box-minus-holes volume for a rounded rectangle, 5943 instead of+ 7114 mm³, by subtracting the corner cylinders as holes. A hole's disk must now lie strictly inside the+ box footprint; anything else is refused.++Evidence:+- The CTC-01 result is unchanged: 75/85 carriers, IoU 0.998904 against the NIST file, and IoU 1 with 75/75+ carriers against the previous fixture.+- A stage-rounded rectangle matches `RoundedRect2` on all 10 carriers at IoU 1.+- `ProfileCornerRoundTests` covers line/line convex, concave and oblique corners, plus line/arc, arc/line+ and arc/arc corners: tangency and continuity at both joins.+- The full parallel lane is green.+## VerdictMeaningful progression. CTC-01 builds with every feature Firmament can express, and the comparisondiff --git a/docs/public/reference/language/profiles.md b/docs/public/reference/language/profiles.mdindex c3e88b04..b1284152 100644--- a/docs/public/reference/language/profiles.md+++ b/docs/public/reference/language/profiles.md@@ -111,8 +111,33 @@ guide from startPoint to endPoint as selectedEdge```After the first stage, `guide to endPoint` starts from the previous endpoint.-Endpoints must be named points on that guide. Circular spans work the same way,-and `Reverse` takes the other way round.+`guide from startPoint` runs from `startPoint` to the guide's own end (its start+under `Reverse`), so the point where a `RoundedRect2` side meets its corner never+needs to be placed by hand. Endpoints must be named points on that guide.+Circular spans work the same way, and `Reverse` takes the other way round.++### Rounding a corner with `Round(r)`++`|> Round(r)` between two stages replaces the corner where they meet with an+arc of radius `r` tangent to both. Both neighbours are trimmed back to the+tangent points; the arc bends into whichever side the corner turns, so the same+stage rounds convex and concave corners. Line and arc neighbours are both+supported. Before `Close`, `Round(r)` rounds the corner between the last stage+and the first.++```text+Blank.Bottom as Bottom+|> Round(5mm)+|> Blank.Right as Right+|> Round(5mm) as BottomRightRound+```++The arc is named by `as`, or otherwise `{previousEdge}Round{n}`, where `n` counts+the rounds in the loop.+[`round-stages.firmament`](../../../../fixtures/Regression/AuthoringConvenience/round-stages.firmament)+builds the same solid as a `RoundedRect2`. `Round(r)` is rejected when its+neighbours already meet tangentially, when they do not meet, when `r` is not a+positive length, and when the arc would not fit on either neighbour.`|>` is only for tracing. It is not a general map, filter or functioncomposition operator. Manual `Segment` declarations remain available fordiff --git a/fixtures/Invalid/AuthoringConvenience/round-oversized.firmament b/fixtures/Invalid/AuthoringConvenience/round-oversized.firmamentnew file mode 100644index 00000000..ea365cad--- /dev/null+++ b/fixtures/Invalid/AuthoringConvenience/round-oversized.firmament@@ -0,0 +1,16 @@+// A 40 mm round on a 30 mm tall rectangle: the tangent point falls beyond the right side.+Model RoundOversized {+ units: mm+ Concept Struct Layout on XY { Rect2 Blank { center: [0mm, 0mm]; size: [60mm, 30mm] } }+ Profile Plate using Layout {+ Loop Outer {+ Blank.Bottom as Bottom+ |> Round(40mm)+ |> Blank.Right as Right+ |> Blank.Top as Top+ |> Blank.Left as Left+ |> Close+ }+ }+ Extrude Body { profile: Plate; from: 0mm; to: 4mm }+}diff --git a/fixtures/Regression/AuthoringConvenience/partial-spans.firmament b/fixtures/Regression/AuthoringConvenience/partial-spans.firmamentnew file mode 100644index 00000000..7513b1b6--- /dev/null+++ b/fixtures/Regression/AuthoringConvenience/partial-spans.firmament@@ -0,0 +1,26 @@+// Partial spans: `from P` alone runs to the guide's end, `to P` alone runs from the current point.+// A 60 x 30 plate with a 20 mm wide, 10 mm deep V cut into its bottom edge.+Model PartialSpans {+ units: mm+ Concept Struct Layout on XY {+ Rect2 Blank { center: [0mm, 0mm]; size: [60mm, 30mm] }+ Point2 NotchLeft { position: [-10mm, -15mm] }+ Point2 NotchTip { position: [0mm, -5mm] }+ Point2 NotchRight { position: [10mm, -15mm] }+ Line2 FlankIn { from: NotchLeft; to: NotchTip }+ Line2 FlankOut { from: NotchTip; to: NotchRight }+ }+ Profile Plate using Layout {+ Loop Outer {+ Blank.Bottom from NotchRight as BottomRight+ |> Blank.Right as Right+ |> Blank.Top as Top+ |> Blank.Left as Left+ |> Blank.Bottom to NotchLeft as BottomLeft+ |> FlankIn as In+ |> FlankOut as Out+ |> Close+ }+ }+ Extrude Body { profile: Plate; from: 0mm; to: 4mm }+}diff --git a/fixtures/Regression/AuthoringConvenience/round-stages.firmament b/fixtures/Regression/AuthoringConvenience/round-stages.firmamentnew file mode 100644index 00000000..435f41f3--- /dev/null+++ b/fixtures/Regression/AuthoringConvenience/round-stages.firmament@@ -0,0 +1,19 @@+// A rectangle rounded corner by corner with `|> Round(r)`: the same solid as RoundedRect2 with radius 5mm.+Model RoundedByStages {+ units: mm+ Concept Struct Layout on XY { Rect2 Blank { center: [0mm, 0mm]; size: [60mm, 30mm] } }+ Profile Plate using Layout {+ Loop Outer {+ Blank.Bottom as Bottom+ |> Round(5mm)+ |> Blank.Right as Right+ |> Round(5mm)+ |> Blank.Top as Top+ |> Round(5mm)+ |> Blank.Left as Left+ |> Round(5mm) as ClosingCorner+ |> Close+ }+ }+ Extrude Body { profile: Plate; from: 0mm; to: 4mm }+}diff --git a/fixtures/Regression/AuthoringConvenience/rounded-rect-reference.firmament b/fixtures/Regression/AuthoringConvenience/rounded-rect-reference.firmamentnew file mode 100644index 00000000..c79edc8c--- /dev/null+++ b/fixtures/Regression/AuthoringConvenience/rounded-rect-reference.firmament@@ -0,0 +1,6 @@+// The reference for round-stages.firmament.+Model RoundedReference {+ units: mm+ Profile Plate = RoundedRect2 { center: [0mm, 0mm]; size: [60mm, 30mm]; radius: 5mm }+ Extrude Body { profile: Plate; from: 0mm; to: 4mm }+}diff --git a/fixtures/Regression/Decompile/ctc-01.firmament b/fixtures/Regression/Decompile/ctc-01.firmamentindex 8f20322d..279544e8 100644--- a/fixtures/Regression/Decompile/ctc-01.firmament+++ b/fixtures/Regression/Decompile/ctc-01.firmament@@ -58,37 +58,12 @@ Model Ctc01 {RoundedRect2 RightEnd { center: [325mm, 0mm]; size: [150mm, 450mm]; radius: 50mm }Rect2 Bridge { center: [0mm, 0mm]; size: [500mm, 250mm] }- // Waists: R25 arcs from an end's inner side to the bridge edge.- Point2 FrontLeftWaistCenter { position: [-225mm, -150mm] }- Point2 FrontLeftWaistEnd { position: [-250mm, -150mm] }- Point2 FrontLeftWaistBridge { position: [-225mm, -125mm] }- Arc2 FrontLeftWaist { center: FrontLeftWaistCenter; from: FrontLeftWaistBridge; to: FrontLeftWaistEnd }- Point2 FrontRightWaistCenter { position: [225mm, -150mm] }- Point2 FrontRightWaistEnd { position: [250mm, -150mm] }- Point2 FrontRightWaistBridge { position: [225mm, -125mm] }- Arc2 FrontRightWaist { center: FrontRightWaistCenter; from: FrontRightWaistEnd; to: FrontRightWaistBridge }- Point2 BackRightWaistCenter { position: [225mm, 150mm] }- Point2 BackRightWaistEnd { position: [250mm, 150mm] }- Point2 BackRightWaistBridge { position: [225mm, 125mm] }- Arc2 BackRightWaist { center: BackRightWaistCenter; from: BackRightWaistBridge; to: BackRightWaistEnd }- Point2 BackLeftWaistCenter { position: [-225mm, 150mm] }- Point2 BackLeftWaistEnd { position: [-250mm, 150mm] }- Point2 BackLeftWaistBridge { position: [-225mm, 125mm] }- Arc2 BackLeftWaist { center: BackLeftWaistCenter; from: BackLeftWaistEnd; to: BackLeftWaistBridge }-- // Where each end's inner straight side meets its R50 corners (RoundedRect2 publishes no tangent points).- Point2 LeftEndInnerFront { position: [-250mm, -175mm] }- Point2 LeftEndInnerBack { position: [-250mm, 175mm] }- Point2 RightEndInnerFront { position: [250mm, -175mm] }- Point2 RightEndInnerBack { position: [250mm, 175mm] }-// The back-right corner is cut at 45 degrees between the right end's straight sides.Point2 ChamferStart { position: [400mm, 175mm] }Point2 ChamferEnd { position: [350mm, 225mm] }Line2 Chamfer { from: ChamferStart; to: ChamferEnd }// Lugs hang below each end where it overhangs the bridge, cut off along the bridge's long edges.- Point2 LeftEndOuterBack { position: [-400mm, 175mm] }Point2 LeftLugCutBack { position: [-400mm, 125mm] }Line2 BackLeftLugCut { from: Bridge.TopLeft; to: LeftLugCutBack }Point2 RightLugCutBack { position: [400mm, 125mm] }@@ -101,11 +76,11 @@ Model Ctc01 {|> LeftEnd.BottomLeftCorner as LeftFrontOuterCorner|> LeftEnd.Bottom as LeftFront|> LeftEnd.BottomRightCorner as LeftFrontInnerCorner- |> LeftEnd.Right from LeftEndInnerFront to FrontLeftWaistEnd as LeftInnerFront- |> FrontLeftWaist- |> Bridge.Bottom from FrontLeftWaistBridge to FrontRightWaistBridge as Front- |> FrontRightWaist- |> RightEnd.Left from FrontRightWaistEnd to RightEndInnerFront as RightInnerFront+ |> LeftEnd.Right to Bridge.BottomLeft as LeftInnerFront+ |> Round(25mm) as FrontLeftWaist+ |> Bridge.Bottom as Front+ |> Round(25mm) as FrontRightWaist+ |> RightEnd.Left from Bridge.BottomRight as RightInnerFront|> RightEnd.BottomLeftCorner as RightFrontInnerCorner|> RightEnd.Bottom as RightFront|> RightEnd.BottomRightCorner as RightFrontOuterCorner@@ -113,19 +88,19 @@ Model Ctc01 {|> Chamfer|> RightEnd.Top as RightBack|> RightEnd.TopLeftCorner as RightBackInnerCorner- |> RightEnd.Left from RightEndInnerBack to BackRightWaistEnd as RightInnerBack- |> BackRightWaist- |> Bridge.Top from BackRightWaistBridge to BackLeftWaistBridge as Back- |> BackLeftWaist- |> LeftEnd.Right from BackLeftWaistEnd to LeftEndInnerBack as LeftInnerBack+ |> RightEnd.Left to Bridge.TopRight as RightInnerBack+ |> Round(25mm) as BackRightWaist+ |> Bridge.Top as Back+ |> Round(25mm) as BackLeftWaist+ |> LeftEnd.Right from Bridge.TopLeft as LeftInnerBack|> LeftEnd.TopRightCorner as LeftBackInnerCorner|> LeftEnd.Top as LeftBack|> LeftEnd.TopLeftCorner as LeftBackOuterCorner|> Close}}- // Notches in the bridge's long edges. Front runs from x = -225 to +225 and Back from +225 to -225;- // centers are measured from each edge's start.+ // Notches in the bridge's long edges. After the R25 waists, Front runs from x = -225 to +225 and Back from+ // +225 to -225; centers are measured from each edge's start.ProfileDelta FrontLeftV = VNotch<Center: 115mm, Owner: Plate.Front>ProfileDelta FrontRightV = VNotch<Center: 335mm, Owner: Plate.Front>ProfileDelta BackRightSlot = SlotNotch<Center: 75mm, Owner: Plate.Back>@@ -141,11 +116,11 @@ Model Ctc01 {// Each lug is traced from its end's own outline, so the end's corners and chamfer are stated once.Profile BackLeftLugOutline using Layout {Loop Outer {- LeftEnd.Right from Bridge.TopLeft to LeftEndInnerBack as Inner+ LeftEnd.Right from Bridge.TopLeft as Inner|> LeftEnd.TopRightCorner as InnerCorner|> LeftEnd.Top as Back|> LeftEnd.TopLeftCorner as OuterCorner- |> LeftEnd.Left from LeftEndOuterBack to LeftLugCutBack as Outer+ |> LeftEnd.Left to LeftLugCutBack as Outer|> BackLeftLugCut as Cut|> Close}@@ -159,7 +134,7 @@ Model Ctc01 {|> Chamfer as Chamfer|> RightEnd.Top as Back|> RightEnd.TopLeftCorner as InnerCorner- |> RightEnd.Left from RightEndInnerBack to Bridge.TopRight as Inner+ |> RightEnd.Left to Bridge.TopRight as Inner|> Close}}