Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
Improve prismatic composition inspection and tessellation
Yuechen Lib38d7ea908e7
diff --git a/Aetheris.CLI.Tests/InspectComposeArrangementPolicyTests.cs b/Aetheris.CLI.Tests/InspectComposeArrangementPolicyTests.csnew file mode 100644index 00000000..bffb2194--- /dev/null+++ b/Aetheris.CLI.Tests/InspectComposeArrangementPolicyTests.cs@@ -0,0 +1,63 @@+using System.Text.Json;++namespace Aetheris.CLI.Tests;++public sealed class InspectComposeArrangementPolicyTests+{+ private static readonly string RepoRoot = FindRepoRoot();++ [Fact]+ public void InspectCompose_CtcBlockout_ReportsMultiRegionTransitionAndM8Evidence()+ {+ var source = Path.Combine(RepoRoot, "testdata/firmament/reconstructions/nist_ctc_01/ctc01_prismatic_blockout_x2.firmament");+ var stdout = new StringWriter(); var stderr = new StringWriter();+ var exit = Aetheris.CLI.CliRunner.Run(["inspect-compose", source, "--json"], stdout, stderr);+ Assert.Equal(0, exit); Assert.True(string.IsNullOrWhiteSpace(stderr.ToString()), stderr.ToString());+ using var json = JsonDocument.Parse(stdout.ToString());+ var composition = json.RootElement.GetProperty("composition");+ var placement = composition.GetProperty("placement");+ Assert.True(placement.GetProperty("isExplicit").GetBoolean());+ Assert.Equal(new[] { 0d, 0d, 0d }, placement.GetProperty("anchor").EnumerateArray().Select(x => x.GetDouble()).ToArray());+ Assert.Equal("XY", placement.GetProperty("profilePlane").GetString());+ Assert.Equal("+Z", placement.GetProperty("axis").GetString());+ Assert.Equal("+X", placement.GetProperty("referenceDirection").GetString());+ Assert.Equal("NumericalWithBound", composition.GetProperty("bRepStatus").GetString());+ Assert.True(composition.GetProperty("bRepEnclosed").GetBoolean());+ var shoulder = Assert.Single(composition.GetProperty("transitions").EnumerateArray(), item => item.GetProperty("level").GetDouble() == -60d);+ Assert.Equal(2, shoulder.GetProperty("downwardRegionCount").GetInt32());+ Assert.True(composition.GetProperty("bRepPlan").GetProperty("authoritative").GetBoolean());+ }++ [Fact]+ public void InspectCompose_InvalidArrangement_RejectsBeforeBrepReport()+ {+ var source = Path.Combine(RepoRoot, "fixtures/FirmamentV2/ProfileComposition/invalid/ambiguous-tangent-crossing.firmament");+ var stdout = new StringWriter(); var stderr = new StringWriter();+ var exit = Aetheris.CLI.CliRunner.Run(["inspect-compose", source, "--json"], stdout, stderr);+ Assert.Equal(1, exit);+ Assert.Contains("arrangement-rejected:ambiguous-tangent-crossing", stderr.ToString(), StringComparison.Ordinal);+ Assert.True(string.IsNullOrWhiteSpace(stdout.ToString()));+ }++ [Fact]+ public void InspectProfile_ComposeSource_ReportsEveryCtcProfileWithProvenance()+ {+ var source = Path.Combine(RepoRoot, "testdata/firmament/reconstructions/nist_ctc_01/ctc01_prismatic_blockout_x2.firmament");+ var stdout = new StringWriter(); var stderr = new StringWriter();+ var exit = Aetheris.CLI.CliRunner.Run(["inspect-profile", source, "--json"], stdout, stderr);+ Assert.Equal(0, exit); Assert.True(string.IsNullOrWhiteSpace(stderr.ToString()), stderr.ToString());+ using var json = JsonDocument.Parse(stdout.ToString());+ var profiles = json.RootElement.GetProperty("profiles").EnumerateArray().ToArray();+ Assert.Equal(7, profiles.Length);+ Assert.All(profiles, profile => Assert.True(profile.GetProperty("isValid").GetBoolean()));+ Assert.Equal(8, profiles.Where(profile => profile.GetProperty("name").GetString()!.EndsWith("Ear", StringComparison.Ordinal)).Sum(profile => profile.GetProperty("arcSegments").GetInt32()));+ Assert.All(profiles, profile => Assert.NotEmpty(profile.GetProperty("provenance").EnumerateArray()));+ }++ private static string FindRepoRoot()+ {+ var directory = new DirectoryInfo(AppContext.BaseDirectory);+ while (directory is not null && !File.Exists(Path.Combine(directory.FullName, "Aetheris.slnx"))) directory = directory.Parent;+ return directory?.FullName ?? throw new DirectoryNotFoundException("Repository root was not found.");+ }+}diff --git a/Aetheris.CLI/CliRunner.cs b/Aetheris.CLI/CliRunner.csindex 82c592de..c302e096 100644--- a/Aetheris.CLI/CliRunner.cs+++ b/Aetheris.CLI/CliRunner.cs@@ -410,7 +410,27 @@ public static class CliRunnervar json = args.Skip(1).All(x => x == "--json");if (!json) { stderr.WriteLine(InspectProfileUsage); return 1; }if (!File.Exists(args[0])) { stderr.WriteLine($"Profile source was not found: {args[0]}"); return 1; }- var parsed = ProfileAuthoringParser.Parse(File.ReadAllText(args[0]));+ var source = File.ReadAllText(args[0]);+ if (PrismaticProfileCompositionParser.IsCompositionSource(source))+ {+ var composition = PrismaticProfileCompositionParser.Parse(source);+ if (composition.Profiles.Count == 0) { stderr.WriteLine(string.Join(Environment.NewLine, composition.Diagnostics)); return 1; }+ var profiles = composition.Profiles.Values.OrderBy(x => x.Name, StringComparer.Ordinal).Select(profile =>+ {+ var validation = ResolvedProfile2DValidator.Validate(profile);+ return new+ {+ profile.Name, profile.PlaneFrame, loops = profile.Loops.Count,+ lineSegments = profile.Loops.SelectMany(x => x.Segments).Count(x => x.Geometry is LineArcLineSegment2D),+ arcSegments = profile.Loops.SelectMany(x => x.Segments).Count(x => x.Geometry is LineArcCircularArc2D),+ validation.IsValid, validation.SignedArea, validation.Diagnostics,+ provenance = profile.Loops.SelectMany(x => x.Segments).Select(x => new { x.Name, x.Provenance.StableId, x.Provenance.ConceptStableId, x.Provenance.Derivation })+ };+ }).ToArray();+ stdout.WriteLine(JsonSerializer.Serialize(new { profiles, diagnostics = composition.Diagnostics }, JsonOptions));+ return composition.Diagnostics.Count == 0 && profiles.All(x => x.IsValid) ? 0 : 1;+ }+ var parsed = ProfileAuthoringParser.Parse(source);if (parsed.Profile is null) { stderr.WriteLine(string.Join(Environment.NewLine, parsed.Diagnostics)); return 1; }var validation = ResolvedProfile2DValidator.Validate(parsed.Profile);var report = new@@ -461,6 +481,7 @@ public static class CliRunnercomposition = new{name = stack.Feature.Name, frame = stack.Feature.Frame, axis = stack.Feature.Axis,+ placement = new { stack.Feature.Placement.Name, anchor = new[] { stack.Feature.Placement.AnchorX, stack.Feature.Placement.AnchorY, stack.Feature.Placement.AnchorZ }, profilePlane = stack.Feature.Placement.ProfilePlane, stack.Feature.Placement.Axis, stack.Feature.Placement.ReferenceDirection, stack.Feature.Placement.IsExplicit },operations = stack.Feature.Operations.Select(x => new { x.Name, intent = x.Intent.ToString(), profile = x.ProfileReference, x.From, x.To, x.SemanticRole, x.SourceSpan }),criticalLevels = stack.Feature.CriticalLevels,slabs = stack.Slabs.Select(x => new@@ -491,10 +512,14 @@ public static class CliRunnerdiagnostics = x.Arrangement.Diagnostics}}),- transitions = stack.Transitions.Select(x => new { x.Level, upwardArea = x.UpwardRegion is null ? 0d : PrismaticSectionStackCompiler.Area(x.UpwardRegion), downwardArea = x.DownwardRegion is null ? 0d : PrismaticSectionStackCompiler.Area(x.DownwardRegion) }),+ transitions = stack.Transitions.Select(x => new { x.Level, upwardRegionCount = x.UpwardRegions.Count, downwardRegionCount = x.DownwardRegions.Count, upwardArea = x.UpwardRegions.Sum(PrismaticSectionStackCompiler.Area), downwardArea = x.DownwardRegions.Sum(PrismaticSectionStackCompiler.Area) }),analyticVolume = stack.AnalyticVolume,+ bRepStatus = mass?.Status.ToString(),bRepVolume = mass?.AbsoluteVolume,volumeDelta = mass is null ? (double?)null : mass.AbsoluteVolume - stack.AnalyticVolume,+ bRepErrorBound = mass?.ErrorBound,+ bRepEnclosed = mass?.IsEnclosed,+ bRepDiagnostics = mass?.Diagnostics,bRepPlan = emitted.Plan,diagnostics = emitted.Diagnostics}diff --git a/Aetheris.Kernel.Core/Brep/Tessellation/PlanarPolygonTriangulator.cs b/Aetheris.Kernel.Core/Brep/Tessellation/PlanarPolygonTriangulator.csindex ca1bcde6..8773b4e8 100644--- a/Aetheris.Kernel.Core/Brep/Tessellation/PlanarPolygonTriangulator.cs+++ b/Aetheris.Kernel.Core/Brep/Tessellation/PlanarPolygonTriangulator.cs@@ -198,8 +198,19 @@ internal static class PlanarPolygonTriangulatorif (!TryEarClipLinkedPolygon(outerNode, allProjected, out var result)){- failure = PlanarPolygonTriangulationFailure.TriangulationFailed;- return false;+ // A nearest visible bridge is deterministic but is not always ear-clippable+ // for a deeply concave outer ring. The CTC-01 blockout exposed this with+ // one central hexagonal hole inside a line/arc lobe outline. For the bounded+ // single-hole case, retry the remaining visible outer vertices in stable+ // score order, rebuilding the rings for every attempt because SplitPolygon+ // is intentionally destructive.+ if (holePolygonPoints.Count != 1 || !TryTriangulateSingleHoleByBridgeSearch(+ outerPolygonPoints, holePolygonPoints[0], projection,+ out allPoints, out result))+ {+ failure = PlanarPolygonTriangulationFailure.TriangulationFailed;+ return false;+ }}OrientTrianglesToExpectedNormal(allPoints, projection.Normal, result);@@ -209,6 +220,57 @@ internal static class PlanarPolygonTriangulatorreturn true;}+ private static bool TryTriangulateSingleHoleByBridgeSearch(+ IReadOnlyList<Point3D> outerPoints,+ IReadOnlyList<Point3D> holePoints,+ PlaneProjection projection,+ out List<Point3D> triangulationPoints,+ out List<int> indices)+ {+ triangulationPoints = [];+ indices = [];+ var outerProjected = ProjectPoints(outerPoints, projection);+ var holeProjected = ProjectPoints(holePoints, projection);++ // Determine the stable candidate count without retaining mutable ring nodes.+ var candidateCount = outerPoints.Count;+ for (var candidateRank = 1; candidateRank < candidateCount; candidateRank++)+ {+ var points = new List<Point3D>();+ var projected = new List<Point2>();+ var outer = CreateLinkedRing(outerPoints, outerProjected, clockwise: false, points, projected);+ var hole = CreateLinkedRing(holePoints, holeProjected, clockwise: true, points, projected);+ if (outer is null || hole is null) return false;+ var anchor = SelectBridgeHoleVertex(hole);+ var candidates = EnumerateNodes(outer)+ .Where(candidate => IsBridgeVisible(candidate, anchor, outer, hole, []))+ .OrderBy(candidate => DistanceSquared(anchor.Point, candidate.Point))+ .ThenBy(candidate => candidate.Point.X)+ .ThenBy(candidate => candidate.Point.Y)+ .ThenBy(candidate => candidate.Index)+ .ToArray();+ if (candidateRank >= candidates.Length) break;++ var bridged = FilterPoints(SplitPolygon(candidates[candidateRank], anchor, points, projected));+ if (bridged is null || !TryEarClipLinkedPolygon(bridged, projected, out var candidateIndices)) continue;+ triangulationPoints = points;+ indices = candidateIndices;+ return true;+ }++ return false;+ }++ private static IEnumerable<Node> EnumerateNodes(Node start)+ {+ var node = start;+ do+ {+ yield return node;+ node = node.Next!;+ } while (node != start);+ }+private static bool TryCreateProjection(IReadOnlyList<Point3D> polygonPoints,Vector3D planeNormal,diff --git a/Aetheris.Kernel.Firmament.Tests/PrismaticProfileCompositionRoundTripTests.cs b/Aetheris.Kernel.Firmament.Tests/PrismaticProfileCompositionRoundTripTests.csindex 01b7a95d..3d51e9cf 100644--- a/Aetheris.Kernel.Firmament.Tests/PrismaticProfileCompositionRoundTripTests.cs+++ b/Aetheris.Kernel.Firmament.Tests/PrismaticProfileCompositionRoundTripTests.cs@@ -1,4 +1,5 @@using Aetheris.Kernel.Core.Brep.Verification;+using Aetheris.Kernel.Core.Brep.Tessellation;using Aetheris.Kernel.Core.Step242;using Aetheris.Kernel.Firmament.Materializer;@@ -6,6 +7,99 @@ namespace Aetheris.Kernel.Firmament.Tests;public sealed class PrismaticProfileCompositionRoundTripTests{+ [Theory]+ [InlineData("add-overlapped-by-remove.firmament", 418d, 4090d, 1)]+ [InlineData("overlapping-removes.firmament", 304d, 5520d, 1)]+ [InlineData("shared-boundary-adds.firmament", 600d, 5000d, 0)]+ [InlineData("crossing-removal-notch.firmament", 352d, 3760d, 0)]+ public void RemainingMaterialPolicies_AgreeAcrossArrangementBrepStepAndM8(string fixture, double finalArea, double volume, int holes)+ {+ var source = File.ReadAllText(CompositionFixture(fixture));+ var parsed = PrismaticProfileCompositionParser.Parse(source);+ Assert.Empty(parsed.Diagnostics);+ var stack = Assert.IsType<PrismaticSectionStackConstruction>(PrismaticSectionStackCompiler.Normalize(parsed, out var diagnostics));+ Assert.Empty(diagnostics);+ var finalSlab = stack.Slabs.OrderBy(x => x.To).Last();+ Assert.Equal(finalArea, PrismaticSectionStackCompiler.Area(finalSlab.Region), 8);+ Assert.Equal(holes, finalSlab.Region.Holes.Count);+ Assert.Equal(volume, stack.AnalyticVolume, 8);++ var emitted = PrismaticSectionStackEmitter.Emit(stack);+ var body = Assert.IsType<Aetheris.Kernel.Core.Brep.BrepBody>(emitted.Body);+ var inMemory = BrepMassProperties.Evaluate(body);+ Assert.NotEqual(BrepMassPropertiesStatus.Unavailable, inMemory.Status);+ Assert.InRange(Math.Abs(inMemory.AbsoluteVolume - volume), 0d, 0.01d);+ var step = Step242Exporter.ExportBody(body, new Step242ExportOptions { BrepExportPreflightMode = BrepExportPreflightMode.Enforce });+ Assert.True(step.IsSuccess, string.Join(" | ", step.Diagnostics.Select(x => x.Message)));+ var imported = Step242Importer.ImportBody(step.Value);+ Assert.True(imported.IsSuccess, string.Join(" | ", imported.Diagnostics.Select(x => x.Message)));+ var m8 = BrepMassProperties.Evaluate(imported.Value);+ Assert.NotEqual(BrepMassPropertiesStatus.Unavailable, m8.Status);+ Assert.InRange(Math.Abs(m8.AbsoluteVolume - volume), 0d, 0.01d);+ }++ [Fact]+ public void AddOverlappedByRemove_OperationEnumerationDoesNotChangeNormalizedMaterial()+ {+ var source = File.ReadAllText(CompositionFixture("add-overlapped-by-remove.firmament"));+ var reversed = source.Replace(+ " Add Pad { Profile: AddProfile; From: 5mm; To: 10mm; Role: Pad }\n Remove Relief { Profile: RemoveProfile; From: 5mm; To: 10mm; Role: Relief }",+ " Remove Relief { Profile: RemoveProfile; From: 5mm; To: 10mm; Role: Relief }\n Add Pad { Profile: AddProfile; From: 5mm; To: 10mm; Role: Pad }",+ StringComparison.Ordinal);+ var a = Assert.IsType<PrismaticSectionStackConstruction>(PrismaticSectionStackCompiler.Normalize(PrismaticProfileCompositionParser.Parse(source), out var da));+ var b = Assert.IsType<PrismaticSectionStackConstruction>(PrismaticSectionStackCompiler.Normalize(PrismaticProfileCompositionParser.Parse(reversed), out var db));+ Assert.Empty(da); Assert.Empty(db);+ Assert.Equal(a.AnalyticVolume, b.AnalyticVolume, 10);+ Assert.Equal(a.Slabs.Select(x => PrismaticSectionStackCompiler.Area(x.Region)), b.Slabs.Select(x => PrismaticSectionStackCompiler.Area(x.Region)));+ Assert.Equal(a.Slabs.Select(x => x.Region.Holes.Count), b.Slabs.Select(x => x.Region.Holes.Count));+ }++ [Theory]+ [InlineData("Anchor: [0mm, 0mm, 0mm]", "Anchor: [1mm, 0mm, 0mm]", "compose-placement-unsupported-nonzero-anchor")]+ [InlineData("Axis: +Z", "Axis: -Z", "compose-placement-unsupported-orientation")]+ public void ExplicitComposePlacement_RejectsUnsupportedTransformInsteadOfIgnoringIt(string before, string after, string expected)+ {+ var source = File.ReadAllText(Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "..", "..", "..", "..", "testdata", "firmament", "reconstructions", "nist_ctc_01", "ctc01_prismatic_blockout_x2.firmament")));+ var parsed = PrismaticProfileCompositionParser.Parse(source.Replace(before, after, StringComparison.Ordinal));+ Assert.Null(parsed.Feature);+ Assert.Contains(parsed.Diagnostics, diagnostic => diagnostic.Contains(expected, StringComparison.Ordinal));+ }++ [Theory]+ [InlineData("point-only-tangent-connection.firmament", "point-only-tangent-or-zero-width-ligament")]+ [InlineData("zero-width-ligament.firmament", "point-only-tangent-or-zero-width-ligament")]+ [InlineData("contradictory-coincident-add-remove.firmament", "contradictory-coincident-add-remove-boundary")]+ [InlineData("ambiguous-tangent-crossing.firmament", "ambiguous-tangent-crossing")]+ [InlineData("dangling-arrangement-fragment.firmament", "endpoint mismatch")]+ [InlineData("disconnected-final-material.firmament", "disconnected-or-invalid-material")]+ [InlineData("unresolved-angular-ordering.firmament", "unresolved-angular-order")]+ public void InvalidMaterialPolicies_RejectBeforeBrepEmission(string fixture, string expectedDiagnostic)+ {+ var parsed = PrismaticProfileCompositionParser.Parse(File.ReadAllText(CompositionFixture(Path.Combine("invalid", fixture))));+ var stack = PrismaticSectionStackCompiler.Normalize(parsed, out var diagnostics);+ Assert.Null(stack);+ Assert.Contains(diagnostics, diagnostic => diagnostic.Contains(expectedDiagnostic, StringComparison.Ordinal));+ }++ [Fact]+ public void Ctc01Blockout_AllAuthoritativeFacesTessellateForM8()+ {+ var source = File.ReadAllText(Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "..", "..", "..", "..", "testdata", "firmament", "reconstructions", "nist_ctc_01", "ctc01_prismatic_blockout_x2.firmament")));+ var parsed = PrismaticProfileCompositionParser.Parse(source);+ var stack = Assert.IsType<PrismaticSectionStackConstruction>(PrismaticSectionStackCompiler.Normalize(parsed, out var diagnostics));+ Assert.Empty(diagnostics);+ var emitted = PrismaticSectionStackEmitter.Emit(stack);+ var body = Assert.IsType<Aetheris.Kernel.Core.Brep.BrepBody>(emitted.Body);+ Assert.Equal(2, Assert.Single(stack.Transitions, transition => transition.Level == -60d).DownwardRegions.Count);+ var mesh = BrepDisplayTessellator.Tessellate(body, DisplayTessellationOptions.Default);+ Assert.True(mesh.IsSuccess, string.Join(" | ", mesh.Diagnostics.Select(x => x.Message)));+ var empty = body.Topology.Faces.Where(face => !mesh.Value.FacePatches.Any(patch => patch.FaceId == face.Id && patch.TriangleIndices.Count >= 3)).Select(face => face.Id.Value).ToArray();+ Assert.True(empty.Length == 0, $"empty faces={string.Join(',', empty)}; diagnostics={string.Join(" | ", mesh.Diagnostics.Select(x => x.Message))}");+ var m8 = BrepMassProperties.Evaluate(body);+ Assert.NotEqual(BrepMassPropertiesStatus.Unavailable, m8.Status);+ Assert.InRange(Math.Abs(m8.AbsoluteVolume - stack.AnalyticVolume), 0d, 5d);+ }+[Fact]public void MixedLineArcAdditiveOverlap_PreservesAnalyticCurvesAcrossStepRoundTrip(){@@ -141,4 +235,7 @@ public sealed class PrismaticProfileCompositionRoundTripTestsSegment West { Trace: {{guide}}.Left; From: {{guide}}.TopLeft; To: {{guide}}.BottomLeft }} }""";++ private static string CompositionFixture(string name) => Path.GetFullPath(Path.Combine(+ AppContext.BaseDirectory, "..", "..", "..", "..", "fixtures", "FirmamentV2", "ProfileComposition", name));}diff --git a/Aetheris.Kernel.Firmament/Materializer/PrismaticProfileComposition.cs b/Aetheris.Kernel.Firmament/Materializer/PrismaticProfileComposition.csindex 13b6af0c..91ee07b4 100644--- a/Aetheris.Kernel.Firmament/Materializer/PrismaticProfileComposition.cs+++ b/Aetheris.Kernel.Firmament/Materializer/PrismaticProfileComposition.cs@@ -11,15 +11,19 @@ public enum PrismaticProfileIntent { Base, Add, Remove }public sealed record PrismaticProfileOperation(string Name, PrismaticProfileIntent Intent, string ProfileReference, double From, double To,string SemanticRole, string SourceSpan);+public sealed record PrismaticProfilePlacement(+ string Name, double AnchorX, double AnchorY, double AnchorZ,+ string ProfilePlane, string Axis, string ReferenceDirection, bool IsExplicit);public sealed record PrismaticProfileCompositionFeature(- string Name, string Frame, string Axis, IReadOnlyList<PrismaticProfileOperation> Operations,+ string Name, string Frame, string Axis, PrismaticProfilePlacement Placement, IReadOnlyList<PrismaticProfileOperation> Operations,IReadOnlyList<double> CriticalLevels, string Provenance);public sealed record PrismaticSectionRegion(ResolvedProfile2D Outer, IReadOnlyList<ResolvedProfile2D> Holes, IReadOnlyList<string> Provenance);public sealed record PrismaticSectionSlab(double From, double To, PrismaticSectionRegion Region, IReadOnlyList<string> ActiveOperations,ProfileArrangement2D? Arrangement = null);-public sealed record PrismaticSectionTransition(double Level, PrismaticSectionRegion? UpwardRegion, PrismaticSectionRegion? DownwardRegion);+public sealed record PrismaticSectionTransition(+ double Level, IReadOnlyList<PrismaticSectionRegion> UpwardRegions, IReadOnlyList<PrismaticSectionRegion> DownwardRegions);public sealed record PrismaticSectionStackConstruction(PrismaticProfileCompositionFeature Feature, IReadOnlyList<PrismaticSectionSlab> Slabs,IReadOnlyList<PrismaticSectionTransition> Transitions, double AnalyticVolume, IReadOnlyList<string> Diagnostics);@@ -39,6 +43,7 @@ public static class PrismaticProfileCompositionParserprivate static readonly Regex ProfileHead = new(@"\bProfile\s+(?<n>\w+)\s+Using\s+(?<layout>\w+)\s*\{", RegexOptions.CultureInvariant);private static readonly Regex Segment = new(@"\bSegment\s+(?<n>\w+)\s*\{\s*Trace\s*:\s*(?<trace>[\w.]+)\s*;?\s*From\s*:\s*(?<from>[\w.]+)\s*;?\s*To\s*:\s*(?<to>[\w.]+)(?:\s*;?\s*Sweep\s*:\s*(?<sweep>Clockwise|CounterClockwise))?", RegexOptions.Singleline | RegexOptions.CultureInvariant);private static readonly Regex ComposeHead = new(@"\bCompose\s+(?<n>\w+)\s*\{", RegexOptions.CultureInvariant);+ private static readonly Regex Placement = new(@"\bPlacement\s+(?<n>\w+)\s*\{\s*Anchor\s*:\s*\[(?<x>[-+.\d]+)mm\s*,\s*(?<y>[-+.\d]+)mm\s*,\s*(?<z>[-+.\d]+)mm\]\s*;?\s*ProfilePlane\s*:\s*(?<plane>\w+)\s*;?\s*Axis\s*:\s*(?<axis>[+-][XYZ])\s*;?\s*ReferenceDirection\s*:\s*(?<reference>[+-][XYZ])", RegexOptions.Singleline | RegexOptions.CultureInvariant);private static readonly Regex Operation = new(@"\b(?<intent>Base|Add|Remove)\s+(?<n>\w+)\s*\{\s*Profile\s*:\s*(?<profile>\w+)\s*;?\s*From\s*:\s*(?<from>[-+.\d]+)mm\s*;?\s*To\s*:\s*(?<to>[-+.\d]+)mm(?:\s*;?\s*Role\s*:\s*(?<role>\w+))?", RegexOptions.Singleline | RegexOptions.CultureInvariant);public static bool IsCompositionSource(string source) => ComposeHead.IsMatch(source);@@ -107,6 +112,16 @@ public static class PrismaticProfileCompositionParserif (!compose.Success) return new(null, profiles, diagnostics.Append("compose-source-missing-compose").ToArray());var composeBody = Block(source, compose.Index + compose.Length - 1);if (composeBody is null) return new(null, profiles, diagnostics.Append("compose-source-unclosed-compose").ToArray());+ var placementMatch = Placement.Match(composeBody);+ var placement = new PrismaticProfilePlacement("LegacyImplicitWorldXY", 0d, 0d, 0d, "XY", "+Z", "+X", false);+ if (placementMatch.Success)+ {+ placement = new(placementMatch.Groups["n"].Value, N(placementMatch, "x"), N(placementMatch, "y"), N(placementMatch, "z"), placementMatch.Groups["plane"].Value, placementMatch.Groups["axis"].Value, placementMatch.Groups["reference"].Value, true);+ if (placement.ProfilePlane != "XY" || placement.Axis != "+Z" || placement.ReferenceDirection != "+X")+ diagnostics.Add($"compose-placement-unsupported-orientation:{placement.Name}:plane={placement.ProfilePlane}:axis={placement.Axis}:reference={placement.ReferenceDirection}");+ if (Math.Abs(placement.AnchorX) > 1e-12d || Math.Abs(placement.AnchorY) > 1e-12d || Math.Abs(placement.AnchorZ) > 1e-12d)+ diagnostics.Add($"compose-placement-unsupported-nonzero-anchor:{placement.Name}:[{placement.AnchorX:R},{placement.AnchorY:R},{placement.AnchorZ:R}]");+ }var operations = new List<PrismaticProfileOperation>();var names = new HashSet<string>(StringComparer.Ordinal);foreach (Match match in Operation.Matches(composeBody))@@ -121,7 +136,7 @@ public static class PrismaticProfileCompositionParser}if (operations.Count(o => o.Intent == PrismaticProfileIntent.Base) != 1) diagnostics.Add("compose-requires-exactly-one-base-operation");var levels = operations.SelectMany(o => new[] { o.From, o.To }).Distinct().Order().ToArray();- var feature = diagnostics.Count == 0 ? new PrismaticProfileCompositionFeature(compose.Groups["n"].Value, "XY", "+Z", operations, levels, "parser-backed-scaffold-profile-composition") : null;+ var feature = diagnostics.Count == 0 ? new PrismaticProfileCompositionFeature(compose.Groups["n"].Value, "XY", "+Z", placement, operations, levels, "parser-backed-scaffold-profile-composition") : null;return new(feature, profiles, diagnostics.Distinct().ToArray());}diff --git a/Aetheris.Kernel.Firmament/Materializer/PrismaticSectionStackCompiler.cs b/Aetheris.Kernel.Firmament/Materializer/PrismaticSectionStackCompiler.csindex fcd96c23..1985f5e0 100644--- a/Aetheris.Kernel.Firmament/Materializer/PrismaticSectionStackCompiler.cs+++ b/Aetheris.Kernel.Firmament/Materializer/PrismaticSectionStackCompiler.cs@@ -39,9 +39,9 @@ public static class PrismaticSectionStackCompilervar downwardResult = ProfileArrangementBuilder.Difference(parsed.Feature.Frame, above, below, $"transition={level:R}:above-minus-below");d.AddRange(upwardResult.Arrangement.Diagnostics);d.AddRange(downwardResult.Arrangement.Diagnostics);- var upward = upwardResult.Region;- var downward = downwardResult.Region;- if (upward is not null || downward is not null) transitions.Add(new(level, upward, downward));+ var upward = upwardResult.MaterialRegions;+ var downward = downwardResult.MaterialRegions;+ if (upward.Count > 0 || downward.Count > 0) transitions.Add(new(level, upward, downward));}var volume = slabs.Sum(s => Area(s.Region) * (s.To - s.From));diagnostics = d.Distinct().ToArray();@@ -82,7 +82,7 @@ public static class PrismaticSectionStackEmittervar vertices = new Dictionary<(long X, long Y, long Z), VertexId>(); var edges = new Dictionary<string, EdgeId>();var sideFaces = new List<(LoopId Loop, SurfaceGeometry Surface)>(); var capFaces = new List<(FaceId Face, double Z, bool Up)>();var splitPoints = stack.Slabs.SelectMany(s => Loops(s.Region)).Concat(stack.Transitions.SelectMany(t =>- new[] { t.UpwardRegion, t.DownwardRegion }.Where(r => r is not null).SelectMany(r => Loops(r!))))+ t.UpwardRegions.Concat(t.DownwardRegions).SelectMany(Loops))).SelectMany(x => x.Profile.Loops[0].Segments).SelectMany(x => Ends(x.Geometry)).DistinctBy(p => $"{Math.Round(p.X / Tol):F0},{Math.Round(p.Y / Tol):F0}").ToArray();(long X, long Y, long Z) Key((double X, double Y) p, double z) => ((long)Math.Round(p.X / Tol), (long)Math.Round(p.Y / Tol), (long)Math.Round(z / Tol));VertexId Vertex((double X, double Y) p, double z) { var key = Key(p, z); if (vertices.TryGetValue(key, out var id)) return id; id = builder.AddVertex(); vertices[key] = id; points[id] = new(p.X, p.Y, z); return id; }@@ -110,8 +110,8 @@ public static class PrismaticSectionStackEmitter}foreach (var transition in stack.Transitions){- if (transition.UpwardRegion is not null) capFaces.Add((AddCap(builder, transition.UpwardRegion, transition.Level, Edge, splitPoints), transition.Level, true));- if (transition.DownwardRegion is not null) capFaces.Add((AddCap(builder, transition.DownwardRegion, transition.Level, Edge, splitPoints), transition.Level, false));+ foreach (var region in transition.UpwardRegions) capFaces.Add((AddCap(builder, region, transition.Level, Edge, splitPoints), transition.Level, true));+ foreach (var region in transition.DownwardRegions) capFaces.Add((AddCap(builder, region, transition.Level, Edge, splitPoints), transition.Level, false));}var faces = new List<FaceId>();foreach (var cap in capFaces) faces.Add(cap.Face);diff --git a/Aetheris.Kernel.Firmament/Materializer/ProfileArrangement2D.cs b/Aetheris.Kernel.Firmament/Materializer/ProfileArrangement2D.csindex 81a3a1ea..8cc5b995 100644--- a/Aetheris.Kernel.Firmament/Materializer/ProfileArrangement2D.cs+++ b/Aetheris.Kernel.Firmament/Materializer/ProfileArrangement2D.cs@@ -8,7 +8,7 @@ namespace Aetheris.Kernel.Firmament.Materializer;/// result loops contain only boundary fragments that separate material from void./// </summary>public sealed record ArrangementSourceCurve2D(- string StableId, string Operation, string Profile, string Loop, string Segment,+ string StableId, string Operation, PrismaticProfileIntent Intent, string Profile, string Loop, string Segment,LineArcProfileCurve2D Geometry, ProfileSegmentProvenance Provenance);public sealed record ArrangementVertex2D(string StableId, (double X, double Y) Position);public sealed record ArrangementFragment2D(@@ -25,7 +25,13 @@ public sealed record ProfileArrangement2D(public int RetainedBoundaryFragmentCount => AtomicFragments.Count(x => x.Retained);}-public sealed record ProfileArrangementResult(ProfileArrangement2D Arrangement, PrismaticSectionRegion? Region);+public sealed record ProfileArrangementResult(+ ProfileArrangement2D Arrangement, PrismaticSectionRegion? Region,+ IReadOnlyList<PrismaticSectionRegion>? RegionSet = null)+{+ public IReadOnlyList<PrismaticSectionRegion> MaterialRegions =>+ RegionSet ?? (Region is null ? [] : [Region]);+}public static class ProfileArrangementBuilder{@@ -41,13 +47,13 @@ public static class ProfileArrangementBuildervar sources = active.SelectMany(operation => profiles[operation.ProfileReference].Loops.SelectMany(loop => loop.Segments.Select(segment =>new ArrangementSourceCurve2D($"compose:{operation.Name}.{operation.ProfileReference}.{loop.Name}.{segment.Name}", operation.Name,- operation.ProfileReference, loop.Name, segment.Name, segment.Geometry, segment.Provenance)))).ToArray();+ operation.Intent, operation.ProfileReference, loop.Name, segment.Name, segment.Geometry, segment.Provenance)))).ToArray();var positive = active.Where(x => x.Intent is PrismaticProfileIntent.Base or PrismaticProfileIntent.Add).Select(x => profiles[x.ProfileReference]).ToArray();var negative = active.Where(x => x.Intent == PrismaticProfileIntent.Remove).Select(x => profiles[x.ProfileReference]).ToArray();return Build(frame, sources, p => positive.Any(profile => PointInProfile(profile, p) == ArrangementPointLocation.Inside)- && !negative.Any(profile => PointInProfile(profile, p) == ArrangementPointLocation.Inside), context);+ && !negative.Any(profile => PointInProfile(profile, p) == ArrangementPointLocation.Inside), context, rejectAmbiguousTangencies: true, allowMultipleRegions: false);}/// <summary>Exact region subtraction used only to derive horizontal section transitions.</summary>@@ -57,7 +63,7 @@ public static class ProfileArrangementBuildervar sourceRegions = new[] { (Name: "left", Region: left), (Name: "right", Region: right) }.Where(x => x.Region is not null).ToArray();var sources = sourceRegions.SelectMany(item => RegionSources(item.Name, item.Region!)).ToArray();- return Build(frame, sources, p => InRegion(left, p) && !InRegion(right, p), context);+ return Build(frame, sources, p => InRegion(left, p) && !InRegion(right, p), context, rejectAmbiguousTangencies: false, allowMultipleRegions: true);}public static ArrangementPointLocation PointInProfile(ResolvedProfile2D profile, (double X, double Y) point)@@ -74,7 +80,7 @@ public static class ProfileArrangementBuilder{foreach (var item in new[] { (region.Outer, "Outer") }.Concat(region.Holes.Select(x => (x, "Inner"))))foreach (var segment in item.Item1.Loops[0].Segments)- yield return new ArrangementSourceCurve2D($"transition:{name}.{item.Item2}.{segment.Name}", name, item.Item1.Name, item.Item2,+ yield return new ArrangementSourceCurve2D($"transition:{name}.{item.Item2}.{segment.Name}", name, PrismaticProfileIntent.Base, item.Item1.Name, item.Item2,segment.Name, segment.Geometry, segment.Provenance);}@@ -84,7 +90,7 @@ public static class ProfileArrangementBuilderreturn !region.Holes.Any(hole => PointInProfile(hole, point) == ArrangementPointLocation.Inside);}- private static ProfileArrangementResult Build(string frame, IReadOnlyList<ArrangementSourceCurve2D> sources, Func<(double X, double Y), bool> material, string context)+ private static ProfileArrangementResult Build(string frame, IReadOnlyList<ArrangementSourceCurve2D> sources, Func<(double X, double Y), bool> material, string context, bool rejectAmbiguousTangencies, bool allowMultipleRegions){var diagnostics = new List<string>();var intersectionClock = Stopwatch.StartNew();@@ -93,9 +99,12 @@ public static class ProfileArrangementBuilderfor (var i = 0; i < sources.Count; i++)for (var j = i + 1; j < sources.Count; j++){- var intersections = Intersections(sources[i].Geometry, sources[j].Geometry, out var coincident);+ var intersections = Intersections(sources[i].Geometry, sources[j].Geometry, out var coincident, out var tangent);if (coincident){+ if ((sources[i].Intent == PrismaticProfileIntent.Remove ^ sources[j].Intent == PrismaticProfileIntent.Remove)+ && HasPositiveCoincidentOverlap(sources[i].Geometry, sources[j].Geometry))+ diagnostics.Add($"arrangement-rejected:contradictory-coincident-add-remove-boundary:{sources[i].StableId}:{sources[j].StableId}:context={context}");// Collinear/co-circular support needs endpoint transfer before side// classification; otherwise an internal shared interval can leave a// mismatched fragment at a transition boundary.@@ -105,6 +114,8 @@ public static class ProfileArrangementBuilderif (OnCurve(sources[i].Geometry, point, out var parameter)) { parameters[sources[i].StableId].Add(parameter); vertices.Add(point); }continue;}+ if (rejectAmbiguousTangencies && tangent && sources[i].Operation != sources[j].Operation)+ diagnostics.Add($"arrangement-rejected:ambiguous-tangent-crossing:{sources[i].StableId}:{sources[j].StableId}:context={context}");foreach (var hit in intersections){if (!OnCurve(sources[i].Geometry, hit, out var a) || !OnCurve(sources[j].Geometry, hit, out var b)) continue;@@ -146,6 +157,7 @@ public static class ProfileArrangementBuilder// Multiple source curves can normalize to the same material-oriented support interval. Keep the lowest semantic id.var retained = oriented.GroupBy(x => GeometryKey(x.Geometry), StringComparer.Ordinal).Select(x => x.OrderBy(y => y.StableId, StringComparer.Ordinal).First()).ToArray();var coincidentCount = oriented.Count - retained.Length;+ ValidateBoundaryVertexIncidence(retained, diagnostics, context);classificationClock.Stop();var reconstructionClock = Stopwatch.StartNew();@@ -155,10 +167,34 @@ public static class ProfileArrangementBuildervar arrangement = new ProfileArrangement2D(frame, sources, vertices.DistinctBy(VertexKey).OrderBy(VertexKey).Select((p, i) => new ArrangementVertex2D($"vertex:{i}", p)).ToArray(),allFragments, loops, coincidentCount, diagnostics.Distinct().ToArray(), intersectionClock.Elapsed, splitClock.Elapsed, classificationClock.Elapsed, reconstructionClock.Elapsed);if (diagnostics.Any(x => x.StartsWith("arrangement-rejected", StringComparison.Ordinal))) return new(arrangement, null);+ if (allowMultipleRegions)+ {+ var regions = ToRegions(loops, diagnostics, context);+ return new(arrangement with { Diagnostics = diagnostics.Distinct().ToArray() }, regions.Count == 1 ? regions[0] : null, regions);+ }var region = ToRegion(loops, diagnostics, context);return new(arrangement with { Diagnostics = diagnostics.Distinct().ToArray() }, region);}+ private static void ValidateBoundaryVertexIncidence(IReadOnlyList<ArrangementFragment2D> fragments, List<string> diagnostics, string context)+ {+ var incoming = fragments.GroupBy(x => VertexKey(Ends(x.Geometry).End), StringComparer.Ordinal).ToDictionary(x => x.Key, x => x.Count(), StringComparer.Ordinal);+ var outgoing = fragments.GroupBy(x => VertexKey(Ends(x.Geometry).Start), StringComparer.Ordinal).ToDictionary(x => x.Key, x => x.Count(), StringComparer.Ordinal);+ foreach (var vertex in incoming.Keys.Concat(outgoing.Keys).Distinct(StringComparer.Ordinal).Order(StringComparer.Ordinal))+ {+ var inCount = incoming.GetValueOrDefault(vertex);+ var outCount = outgoing.GetValueOrDefault(vertex);+ if (inCount == 1 && outCount == 1) continue;+ if (inCount == 0 || outCount == 0)+ diagnostics.Add($"arrangement-rejected:dangling-arrangement-fragment:vertex={vertex}:incoming={inCount}:outgoing={outCount}:context={context}");+ else+ {+ diagnostics.Add($"arrangement-rejected:point-only-tangent-or-zero-width-ligament:vertex={vertex}:incoming={inCount}:outgoing={outCount}:context={context}");+ diagnostics.Add($"arrangement-rejected:unresolved-angular-order:vertex={vertex}:incoming={inCount}:outgoing={outCount}:context={context}");+ }+ }+ }+private static IReadOnlyList<ArrangementLoop2D> Reconstruct(IReadOnlyList<ArrangementFragment2D> fragments, List<string> diagnostics, string context){if (fragments.Count == 0) return [];@@ -200,6 +236,24 @@ public static class ProfileArrangementBuilderreturn new PrismaticSectionRegion(outer, holes, loops.SelectMany(x => x.Fragments).Select(x => x.Source.StableId).Distinct().OrderBy(x => x, StringComparer.Ordinal).ToArray());}+ private static IReadOnlyList<PrismaticSectionRegion> ToRegions(IReadOnlyList<ArrangementLoop2D> loops, List<string> diagnostics, string context)+ {+ if (loops.Count == 0) return [];+ var result = new List<PrismaticSectionRegion>();+ var inner = loops.Where(x => !x.IsOuter).ToArray();+ foreach (var outerLoop in loops.Where(x => x.IsOuter).OrderByDescending(x => x.SignedArea))+ {+ var outer = ToProfile(outerLoop, "Outer");+ var nested = inner.Where(loop => PointInProfile(outer, Ends(loop.Fragments[0].Geometry).Start) == ArrangementPointLocation.Inside).ToArray();+ var holes = nested.Select((loop, index) => ToProfile(loop, $"Inner{index}")).ToArray();+ result.Add(new PrismaticSectionRegion(outer, holes, outerLoop.Fragments.Concat(nested.SelectMany(x => x.Fragments))+ .Select(x => x.Source.StableId).Distinct().OrderBy(x => x, StringComparer.Ordinal).ToArray()));+ }+ if (inner.Any(loop => !result.Any(region => PointInProfile(region.Outer, Ends(loop.Fragments[0].Geometry).Start) == ArrangementPointLocation.Inside)))+ diagnostics.Add($"arrangement-rejected:inner-loop-not-nested:context={context}");+ return result;+ }+private static ResolvedProfile2D ToProfile(ArrangementLoop2D loop, string role){// The section-stack emitter's explicit inner-loop contract stores source loops CCW@@ -220,19 +274,58 @@ public static class ProfileArrangementBuilderreturn delta;}- private static IReadOnlyList<(double X, double Y)> Intersections(LineArcProfileCurve2D a, LineArcProfileCurve2D b, out bool coincident)+ private static IReadOnlyList<(double X, double Y)> Intersections(LineArcProfileCurve2D a, LineArcProfileCurve2D b, out bool coincident, out bool tangent){coincident = false;+ tangent = false;return (a, b) switch{(LineArcLineSegment2D x, LineArcLineSegment2D y) => LineLine(x, y, ref coincident),- (LineArcLineSegment2D x, LineArcCircularArc2D y) => LineCircle(x, y),- (LineArcCircularArc2D x, LineArcLineSegment2D y) => LineCircle(y, x),- (LineArcCircularArc2D x, LineArcCircularArc2D y) => CircleCircle(x, y, ref coincident),+ (LineArcLineSegment2D x, LineArcCircularArc2D y) => LineCircle(x, y, ref tangent),+ (LineArcCircularArc2D x, LineArcLineSegment2D y) => LineCircle(y, x, ref tangent),+ (LineArcCircularArc2D x, LineArcCircularArc2D y) => CircleCircle(x, y, ref coincident, ref tangent),_ => []};}+ private static bool HasPositiveCoincidentOverlap(LineArcProfileCurve2D a, LineArcProfileCurve2D b)+ {+ // Coincidence above describes the infinite line or full circle support.+ // A contradictory material boundary exists only when the bounded source+ // domains overlap by positive length; a shared endpoint is not enough.+ if (a is LineArcLineSegment2D aLine && b is LineArcLineSegment2D bLine)+ {+ var dx = aLine.End.X - aLine.Start.X;+ var dy = aLine.End.Y - aLine.Start.Y;+ var lengthSquared = dx * dx + dy * dy;+ var t0 = ((bLine.Start.X - aLine.Start.X) * dx + (bLine.Start.Y - aLine.Start.Y) * dy) / lengthSquared;+ var t1 = ((bLine.End.X - aLine.Start.X) * dx + (bLine.End.Y - aLine.Start.Y) * dy) / lengthSquared;+ var overlap = Math.Min(1d, Math.Max(t0, t1)) - Math.Max(0d, Math.Min(t0, t1));+ return overlap * Math.Sqrt(lengthSquared) > Tol;+ }++ if (a is LineArcCircularArc2D aArc && b is LineArcCircularArc2D bArc)+ {+ var aIntervals = AngularIntervals(aArc);+ var bIntervals = AngularIntervals(bArc);+ return aIntervals.Any(ai => bIntervals.Any(bi =>+ (Math.Min(ai.End, bi.End) - Math.Max(ai.Start, bi.Start)) * aArc.Radius > Tol));+ }++ return false;+ }++ private static IReadOnlyList<(double Start, double End)> AngularIntervals(LineArcCircularArc2D arc)+ {+ const double turn = 2d * Math.PI;+ var start = arc.SweepAngleRadians >= 0d ? arc.StartAngleRadians : arc.StartAngleRadians + arc.SweepAngleRadians;+ var length = Math.Min(turn, Math.Abs(arc.SweepAngleRadians));+ start = ((start % turn) + turn) % turn;+ if (length >= turn - Tol) return [(0d, turn)];+ var end = start + length;+ return end <= turn ? [(start, end)] : [(start, turn), (0d, end - turn)];+ }+private static IReadOnlyList<(double X, double Y)> LineLine(LineArcLineSegment2D a, LineArcLineSegment2D b, ref bool coincident){var r = (X: a.End.X - a.Start.X, Y: a.End.Y - a.Start.Y); var s = (X: b.End.X - b.Start.X, Y: b.End.Y - b.Start.Y);@@ -242,24 +335,28 @@ public static class ProfileArrangementBuilderreturn t >= -Tol && t <= 1d + Tol && u >= -Tol && u <= 1d + Tol ? [(a.Start.X + t * r.X, a.Start.Y + t * r.Y)] : [];}- private static IReadOnlyList<(double X, double Y)> LineCircle(LineArcLineSegment2D line, LineArcCircularArc2D arc)+ private static IReadOnlyList<(double X, double Y)> LineCircle(LineArcLineSegment2D line, LineArcCircularArc2D arc, ref bool tangent){var dx = line.End.X - line.Start.X; var dy = line.End.Y - line.Start.Y; var fx = line.Start.X - arc.Center.X; var fy = line.Start.Y - arc.Center.Y;var aa = dx * dx + dy * dy; var bb = 2d * (fx * dx + fy * dy); var cc = fx * fx + fy * fy - arc.Radius * arc.Radius; var discriminant = bb * bb - 4d * aa * cc;- if (discriminant < -Tol) return []; if (Math.Abs(discriminant) <= Tol) discriminant = 0d;+ if (discriminant < -Tol) return []; var isTangent = Math.Abs(discriminant) <= Tol; if (isTangent) discriminant = 0d;var root = Math.Sqrt(discriminant); double[] values = root <= Tol ? [(-bb) / (2d * aa)] : [(-bb - root) / (2d * aa), (-bb + root) / (2d * aa)];- return values.Where(t => t >= -Tol && t <= 1d + Tol).Select(t => (line.Start.X + dx * t, line.Start.Y + dy * t)).Where(p => OnCurve(arc, p, out _)).ToArray();+ var result = values.Where(t => t >= -Tol && t <= 1d + Tol).Select(t => (line.Start.X + dx * t, line.Start.Y + dy * t)).Where(p => OnCurve(arc, p, out _)).ToArray();+ tangent = isTangent && result.Length > 0;+ return result;}- private static IReadOnlyList<(double X, double Y)> CircleCircle(LineArcCircularArc2D a, LineArcCircularArc2D b, ref bool coincident)+ private static IReadOnlyList<(double X, double Y)> CircleCircle(LineArcCircularArc2D a, LineArcCircularArc2D b, ref bool coincident, ref bool tangent){var dx = b.Center.X - a.Center.X; var dy = b.Center.Y - a.Center.Y; var d = Math.Sqrt(dx * dx + dy * dy);if (d <= Tol) { coincident = Math.Abs(a.Radius - b.Radius) <= Tol; return []; }if (d > a.Radius + b.Radius + Tol || d < Math.Abs(a.Radius - b.Radius) - Tol) return [];var x = (a.Radius * a.Radius - b.Radius * b.Radius + d * d) / (2d * d); var h2 = a.Radius * a.Radius - x * x;- if (h2 < -Tol) return []; var h = Math.Sqrt(Math.Max(0d, h2)); var px = a.Center.X + x * dx / d; var py = a.Center.Y + x * dy / d;+ if (h2 < -Tol) return []; var isTangent = Math.Abs(h2) <= Tol; var h = Math.Sqrt(Math.Max(0d, h2)); var px = a.Center.X + x * dx / d; var py = a.Center.Y + x * dy / d;(double X, double Y)[] candidates = h <= Tol ? [(px, py)] : [(px + -dy * h / d, py + dx * h / d), (px - -dy * h / d, py - dx * h / d)];- return candidates.Where(p => OnCurve(a, p, out _) && OnCurve(b, p, out _)).ToArray();+ var result = candidates.Where(p => OnCurve(a, p, out _) && OnCurve(b, p, out _)).ToArray();+ tangent = isTangent && result.Length > 0;+ return result;}private static bool OnCurve(LineArcProfileCurve2D curve, (double X, double Y) p, out double parameter)diff --git a/docs/firmament/profile-arrangement-x1.md b/docs/firmament/profile-arrangement-x1.mdindex 88f83f5c..0cba8ea5 100644--- a/docs/firmament/profile-arrangement-x1.md+++ b/docs/firmament/profile-arrangement-x1.md@@ -14,8 +14,12 @@ IsMaterial(p) = (InsideBase(p) or InsideAnyAdd(p)) and not InsideAnyRemove(p)Only a fragment whose sides differ is retained; it is oriented material-left. Coincident same-side support collapses to the lowest stable source ID, removing Add/Add and Remove/Remove internal walls without losing provenance. Directed boundary fragments are then walked using the deterministic angular successor around every vertex. A valid production result has exactly one CCW outer loop, zero or more nested inner loops, no dangling fragment, and no zero-area loop. Point-only connections reject as disconnected/non-manifold instead of being healed.+CTC-BLOCKOUT-X2 completes the material-policy ladder. Exact pre-emission guards now reject contradictory coincident Add/Remove support, bounded line/arc tangency between distinct operations, non-manifold boundary incidence, zero-width contacts, dangling incidence, unresolved angular ordering, and more than one final outer material loop. These are rejection policies, not tolerance-healing hooks. Horizontal transition differences may contain several disconnected cap patches even though each open slab and the final body remain one connected material region; the transition carries those exact patches as a bounded region set.+The arrangement result is the existing `PrismaticSectionRegion`. Adjacent regions use the same machinery for exact horizontal differences. The emitter additionally splits section edges at global arrangement vertices so a changed section boundary shares directed edges with the neighboring slab and transition face. It remains one `PrismaticSectionStackBrepPlan` and one analytic BRep/STEP body, with planes, cylinders, lines, circles, and trimmed curves only.`inspect-compose --json` reports per-slab arrangement curve, intersection, fragment, coincident-normalization, loop, perimeter, timing, diagnostic, and provenance evidence. The included overlapping-additive rectangle fixture reports a 480 mm² upper section and 6400 mm³ total volume after STEP round-trip. The overlapping-removal unit fixture reports a 304 mm² upper material section and 5520 mm³ total volume. `mixed-line-arc-additive-overlap.firmament` forces two transverse line/circle crossings: its upper section is `458.72298071147134 mm²`, with five retained lines and four retained circular arcs. Its analytic volume is `6293.614903557356 mm³`; in-memory and STEP-reimport values are within `0.01 mm³` under the existing bounded mass-property tessellation tolerance. The exported STEP contains planes and four cylindrical surfaces, with no B-spline fallback.+The completion fixtures add four exact material cases: Add overlapped by Remove (`418 mm²` final section, `4090 mm³`), overlapping Removes (`304 mm²`, one explicit `Inner`, `5520 mm³`), shared-boundary Adds (`600 mm²`, no internal face, `5000 mm³`), and a crossing removal notch (`352 mm²`, no `Inner`, `3760 mm³`). Their analytic, in-memory, STEP-reimported, and M8 volumes agree within `0.01 mm³`. Reversing Add/Remove enumeration in the first fixture preserves section areas, loop roles, and volume.+X1 remains deliberately bounded: it does not support splines, offsets, non-planar profiles, disconnected multibody output, or fuzzy tolerance healing. Coincident support with contradictory local material state and unresolved equal-angle continuations rejects before BRep emission.diff --git a/docs/firmament/profile-composition-x1.md b/docs/firmament/profile-composition-x1.mdindex 7ee1d7df..87064332 100644--- a/docs/firmament/profile-composition-x1.md+++ b/docs/firmament/profile-composition-x1.md@@ -7,6 +7,12 @@```firmamentStruct Part {Compose Body {+ Placement World {+ Anchor: [0mm, 0mm, 0mm]+ ProfilePlane: XY+ Axis: +Z+ ReferenceDirection: +X+ }Base Stock { Profile: Plate; From: 0mm; To: 10mm; Role: Stock }Add Boss { Profile: Pad; From: 10mm; To: 15mm; Role: Boss }Remove Relief { Profile: Pocket; From: 7mm; To: 10mm; Role: Relief }@@ -16,18 +22,26 @@ Struct Part {`Base` is mandatory and unique. `Add` and `Remove` retain operation name, referenced scaffold-backed `Profile`, interval, role, and source span. The parser resolves every named profile independently using the existing `Point2`/`Line2`/`Circle2` profile route.+`Placement` makes the positional contract explicit. X1 accepts the current production world placement only: anchor `[0,0,0]`, profile plane `XY`, extrusion axis `+Z`, and in-plane reference direction `+X`. Other anchors/orientations reject rather than being silently ignored. Older fixtures retain a labeled legacy implicit placement; reconstruction artifacts should declare it.+The Feature AIR is `PrismaticProfileCompositionFeature`; lowering creates `PrismaticSectionStackConstruction` with sorted critical levels, open slabs, explicit material regions, transition regions, provenance, and analytic volume. The emitter owns one `PrismaticSectionStackBrepPlan` and preserves deterministic slab partitions rather than aggressively merging faces.X1 normalizes each active slab through `ProfileArrangement2D`: it analytically intersects bounded line-line, line-circle, and circle-circle source curves, splits every source parameter interval deterministically, samples the two sides of each atomic fragment with the set predicate `(Base ∪ Add) − Remove`, and retains only material/void boundaries. Source curves are split by geometry, but never stripped of provenance. The resulting material-left loops are reconstructed deterministically; the production route rejects disconnected material, dangling boundaries, zero-area loops, and ambiguous angular continuation.Coincident source support is normalized by side classification: duplicate Add/Add and Remove/Remove fragments vanish as internal boundaries, while the stable lowest source ID retains the provenance of a surviving boundary. Point-only tangencies naturally produce multiple outer loops and are rejected instead of being perturbed into a crossing. The arrangement output is converted to the same explicit outer/inner section-region contract consumed by the one authoritative section-stack BRep plan; no operation solids or 3D Booleans are materialized.-At a critical level the compiler compares the two adjacent sections. `below - above` produces upward material (including a pocket floor); `above - below` produces downward material. Lines become planar vertical faces and arcs cylindrical vertical faces. Directed edge topology is shared across slabs and caps; coedge reversal is used exactly once per traversal.+At a critical level the compiler compares the two adjacent sections. `below - above` produces upward material (including a pocket floor); `above - below` produces downward material. A difference may yield several disconnected horizontal cap patches while the slabs remain single connected regions; CTC-01's Z=-60 shoulder is the pressure case and yields two exact patches. Lines become planar vertical faces and arcs cylindrical vertical faces. Directed edge topology is shared across slabs and caps; coedge reversal is used exactly once per traversal.++Use `aetheris inspect-compose file.firmament --json` before `build`. The report includes operations, levels, active slabs, areas, transition region counts and areas, analytic volume, independently evaluated in-memory BRep status/volume/error bound/diagnostics, plan signature, and per-slab arrangement source/intersection/fragment/loop/perimeter/timing/provenance evidence.-Use `aetheris inspect-compose file.firmament --json` before `build`. The report includes operations, levels, active slabs, areas, transitions, analytic volume, independently evaluated in-memory BRep volume, plan signature, and per-slab arrangement source/intersection/fragment/loop/perimeter/timing/provenance evidence.+`aetheris inspect-profile composition.firmament --json` also accepts a Compose source and reports every referenced Profile independently, including validation, signed area, line/arc counts, and segment provenance. This keeps profile evidence available without extracting temporary standalone sources.The raised-pad, shallow-pocket, and through-cut fixtures remain enclosed manifold STEPs with analytic/in-memory/reimported BRep agreement. Overlapping additive rectangles and overlapping removal rectangles now normalize to one exact line-only region and round-trip as an enclosed analytic STEP. The line parameter is normalized endpoint distance `[0,1]`; an arc parameter is normalized along its explicit signed angular sweep. This distinction is required because STEP export may resolve a vertex from its incident edge trim.The mixed line/arc additive fixture additionally proves that a split arc is emitted as a `CIRCLE` with its actual bounded angular trim, including reverse traversal, rather than as a full circle or a spline. Profiles are the bounded planar escape hatch for custom prismatic blockout, not the default representation for every semantic CNC feature.+The CTC-01 blockout remains one `PrismaticSectionStackBrepPlan` with three normalized slabs and four transitions. The real model required two narrow production changes: transition region sets for multiple exact cap patches, and a deterministic alternate visible-bridge search for tessellating one inner loop inside a concave analytic outer loop. Neither change adds a source authoring feature, a 3D Boolean, fuzzy healing, or a second topology owner.+`Rect2` may replace manually declared rectangular corners and sides in this source route. It uses `Center: [xmm, ymm]` and `Size: [wmm, hmm]`; derived finite sides are traced as `Base.Bottom`, `Base.Right`, `Base.Top`, and `Base.Left` with corresponding named corners.++Profiles are a bounded planar blockout and escape-hatch mechanism. Higher-level semantic CNC features remain preferred where they express the actual intent.diff --git a/docs/reconstruction/ctc01-compose-x1.md b/docs/reconstruction/ctc01-compose-x1.mdindex 3ca4341e..88c6c7fd 100644--- a/docs/reconstruction/ctc01-compose-x1.md+++ b/docs/reconstruction/ctc01-compose-x1.md@@ -1,9 +1,138 @@-# CTC-01 compose X1 status+# CTC-01 Profile + Compose blockout X2-CTC-01 is no longer blocked by the core proper-overlap arrangement primitive. `Compose` now resolves active Profiles into one analytic line/arc arrangement before producing one section-stack topology plan; it does not create temporary operation solids. A bounded CTC reconstruction remains deferred because the source-analysis evidence has not yet isolated an Observed/StrongInference prismatic subset worth promoting.+## Verdict-The executable raised-pad proof has critical levels `0, 10, 15`, slab areas `400, 64`, analytic volume `4320 mm³`, and independent in-memory BRep volume `4319.999999999998 mm³`. Its exported STEP (`artifacts/raised-pad-compose.step`) reimports as one enclosed manifold body.+CTC-BLOCKOUT-X2 succeeds as a bounded prismatic pressure test. The current scaffold-backed Profile + Compose route naturally expresses the dominant plate/web, four observed R50 end transitions, the Z=-60 central plate level, and the central hexagonal raised region. It lowers through three normalized material slabs, four horizontal transitions, one authoritative `PrismaticSectionStackBrepPlan`, and no 3D operation-solid Boolean.-The shallow-pocket proof now has analytic, in-memory, and STEP-reimported mass `3808 mm³` (reimport result `3807.9999999999995`). The contained through-cut has the corresponding four-way material evidence at `3640 mm³` (reimport result `3639.9999999999995`). The repaired artifacts are topology-enclosed and orientation-consistent under independent BRep mass evaluation. Consequently no CTC profiles, observed Z-levels, or reference-equivalence claims are promoted by this increment: the remaining CTC gate is exact proper-overlap line/arc arrangement.+This is not a whole-part reconstruction. Holes, side holes, conical entries, the left capsule slot, the right rounded opening, uncertain Z=-50 relief grouping, Z=5 finish transition, fillets, chamfers, and finish chains are deliberately absent. The result is an honest prismatic blockout classified `Approximate` against the reference.-The mixed line/arc fixture now proves transverse line/circle splitting through analytic STEP round-trip. The remaining CTC pressure-test blocker is not the arrangement kernel but a high-confidence observed/strong-inference CTC subset whose source profile can be stated without inventing named silhouette geometry; no complete CTC claim is made.+> Compose material regions first. Emit topology once.++Profiles are a bounded planar blockout and escape-hatch mechanism. Higher-level semantic CNC features remain preferred where they express the actual intent.++## Artifact identity and verification++| Item | Evidence |+|---|---|+| Reference | `testdata/step242/nist/CTC/nist_ctc_01_asme1_ap242-e1.stp` |+| Reference SHA-256 | `85a5752da05f53c456ca3a9e038c90358e1d5a3141d1f0d6e5f0970f2356e821` |+| Source | `testdata/firmament/reconstructions/nist_ctc_01/ctc01_prismatic_blockout_x2.firmament` |+| STEP | `artifacts/reconstruction/ctc01/ctc01-prismatic-blockout-x2.step` |+| STEP SHA-256 | `0add5993e0db1fc76482959f33eeecca5034bd580586ece5188655b1e28040f0` |+| Placement | explicit `ReferenceWorld`: anchor `[0,0,0]`, plane `XY`, axis `+Z`, reference direction `+X` |+| Plan | `compose:Ctc01PrismaticBlockoutX2:slabs=3:transitions=4`, authoritative |+| Topology | 1 body, 1 shell, 63 faces, 152 edges, 92 vertices; enclosed-manifold |+| Surfaces | 47 planes, 16 cylinders, 0 cones, 0 B-splines |+| CompilerVerified | yes; parser, Profile validation, normalization, emitter, and STEP export succeeded |+| BRepVerified | yes; in-memory M8 is enclosed and orientation-consistent |+| SerializationVerified | yes; STEP reimport is one enclosed body with matching bounds/topology |+| ExternalInspectionPending | yes; no external display was requested; this does not reduce in-process M8 evidence |++The declared blockout M8 volume tolerance is `5 mm³`. Analytic volume is `27,503,809.028687116 mm³`; in-memory M8 is `27,503,806.564529333 mm³`; STEP-reimported M8 is `27,503,806.564529568 mm³`. Both deltas are `2.465 mm³` or less and are also within M8's reported conservative `340.22728550337837 mm³` numerical bound. The ordinary analyzer reports surface area `850,568.2137584459 mm²`.++`inspect-profile --json` reports all seven referenced Profiles valid, with 38 total source segments: 30 lines and 8 exact circular arcs. `inspect-compose --json` reports the explicit placement, operation provenance, slab arrangement counts below, transition region sets, M8 status, and authoritative plan.++## Arrangement material-policy completion++The material predicate is order-independent:++```text+Material = (Base union Adds) - Removes+```++| Fixture | Final section | Analytic volume | M8 after STEP | Topology result | STEP SHA-256 |+|---|---:|---:|---:|---|---|+| Add overlapped by Remove | 418 | 4090 | 4089.9999999999995 | 1 Outer, 1 Inner | `b8d35030046b355473ad7cbb08c485416f06bc07af0e6a62a5495f31e69a3c79` |+| Overlapping Removes | 304 | 5520 | 5519.999999999996 | one 96 mm² void, 1 explicit Inner | `62a1d2602e64c1dc547dc449b160f563729cdf8b11fc9e05b3fedb1f90c74afb` |+| Shared-boundary Adds | 600 | 5000 | 5000 | shared edge removed, no duplicate face | `ce5a4224897717ee4dee20e5d97268b9bffac311412e5dda314ff4c35890ad5c` |+| Crossing removal notch | 352 | 3760 | 3760.000000000001 | one connected notched Outer, no Inner | `3f1cf1fb5e9ba125e27ee103f7aeb186b814b24a8bb3715216381b4c4651abe0` |++All four ordinary analyses report one enclosed-manifold body. In-memory BRep and STEP-reimported M8 values agree with analytic values within `0.01 mm³`. Reversing Add and Remove enumeration in the first fixture preserves the two slab areas, loop roles, and `4090 mm³` volume.++The invalid corpus rejects before BRep/STEP emission:++| Fixture | Required behavior observed |+|---|---|+| point-only tangent connection | `point-only-tangent-or-zero-width-ligament` and unresolved incidence |+| zero-width ligament | tangent/zero-width vertex rejected without perturbation |+| contradictory coincident Add/Remove | `contradictory-coincident-add-remove-boundary` |+| ambiguous tangent crossing | bounded tangent crossing rejected |+| dangling arrangement fragment | Profile endpoint mismatch rejects before arrangement |+| disconnected final material | two outer material loops rejected |+| unresolved angular ordering | non-manifold vertex reports `unresolved-angular-order` |++Each invalid real `build` returned exit code 1 and emitted no STEP. No coordinate perturbation, tolerance healing, or fallback solid was used.++## Final Concept scaffold and source excerpts++One `Ctc01BlockoutScaffold` owns all 2D evidence:++- `PrimaryWebGuide`: observed `800 x 250 mm` broad web.+- `MidLevelGuide`: strong-inference `500 x 300 mm` central plate at Z=-60..0.+- Four named six-segment ear Profiles. Each uses four named line guides and two exact R50 `Circle2` guides at observed support centers `(±300 or ±350, ±175)`.+- `CentralHex`: six named points/lines, section bounds `[-50,-57.7350538379252]..[50,57.735]` from the Z=6 reference section.++The Compose root explicitly anchors those scaffold coordinates in the reference world frame: `[0,0,0]`, `XY`, `+Z`, with `+X` as the in-plane reference direction. The parser validates and `inspect-compose` reports this declaration, so the signed Z intervals and XY landmarks are not positional conventions hidden in prose.++The Compose operations are:++```text+Base PrimaryPlate PrimaryWeb -100..0 Observed+Add Left/Right Top/Bottom four ear paths -100..0 StrongInference+Add MidLevelPlate MidLevelWeb -60..0 StrongInference+Add CentralRaisedRegion CentralHex 0..50 StrongInference+```++No giant raw-coordinate Profile was used: the broad levels are `Rect2`-derived; each observed lobe owns a small named path; symmetric coordinates are explicit scaffold landmarks rather than duplicated inside Profiles. No source translation was needed because Compose accepts signed levels.++## Construction journal++| Stage | Scaffold/Profile/operation change | Arrangement and slab evidence | Analytic contribution | Topology/evidence change | Source pressure |+|---|---|---|---:|---|---|+| Primary web | `PrimaryWebGuide` -> `PrimaryWeb` -> Base -100..0 | 200,000 mm² before lobe union | included below | one connected slab | existing Rect2/Profile route natural |+| Four lobe ears | 24 named line/arc segments, four Adds | lower slab: 28 sources, 24 intersections, 32 atoms, 24 retained; area `255,707.96326794894` | `10,228,318.530717958` for -100..-60 | 8 exact arc boundary segments / cylindrical faces | current points/lines/circles sufficient |+| Mid level | `MidLevelGuide` -> Add -60..0 | upper plate slab: 32 sources, 28 intersections, 44 atoms, 24 retained; area `280,707.96326794894` | `16,842,477.796076935` | Z=-60 needs two disconnected cap patches | demanded bounded transition region-set support |+| Central raise | six-line `CentralHex` -> Add 0..50 | area `8,660.254037844385` | `433,012.70189221925` | Z=0 cap is one concave analytic Outer with one Inner | demanded bounded alternate bridge for M8 tessellation |+| Export/reimport | one authoritative root plan | 3 slabs, 4 transitions | total `27,503,809.028687116` | 63/152/92, 47 planes, 16 cylinders | no source workaround |++## Pressure-led implementation++Two implementation changes were demanded by the real CTC source:++1. **Transition region sets.** The Z=-60 central shoulder adds material in two disconnected horizontal patches even though both adjacent slabs and the final body are connected. `PrismaticSectionTransition` now owns bounded exact region lists; cap faces are emitted once from those lists. Slab policy and the one-body requirement are unchanged.+2. **Single-hole concave planar bridge search.** The Z=0 top face has the concave lobe outline plus the central hex inner loop. The existing nearest visible triangulation bridge was valid but not ear-clippable. The tessellator now retries remaining visible outer vertices in deterministic score order, rebuilding the rings for each attempt. This is bounded to one inner loop and changes verification/display tessellation only, not authoritative geometry.++The arrangement guards, explicit bounded placement declaration, and `inspect-compose` M8 status/error fields were completed for evidence. Nonzero anchors and alternate orientations reject because CTC did not require a general transform. No translated frames, literal point sets, mirroring, tracing convenience, sketch solving, offsets, splines, or generic Boolean fallback were added.++## Pretzels avoided and deliberate omissions++- Avoided primitive Boolean soup, direct BRep construction, STEP editing, duplicated operation solids, and arbitrary closure approximations.+- Avoided inventing the reference's Z=-50 relief topology and Z=5 finish transition. Both remain `ReferenceIntentUncertain` at blockout fidelity.+- Did not materialize Ø35/Ø25 hole groups, side holes/cones, capsule/right openings, semantic slots, fillets, chamfers, or finish chains per milestone scope.+- Did not introduce mirror syntax merely to shorten four bounded ear Profiles; current named points/lines were adequate.++The remaining source awkwardness is moderate coordinate repetition across the four symmetric ear scaffolds. It did not block or distort the result, so no mirror/translated-frame feature was justified.++## Reference comparison++| Evidence | Reference | Blockout | Classification |+|---|---:|---:|---|+| Bounds | `[-400,-225,-100]..[400,225,50]` | exact same | EquivalentWithinTolerance |+| Connected bodies/shells | 1 / 1 | 1 / 1 | EquivalentWithinTolerance |+| Principal Z levels | -100,-60,-50,0,5,50 | -100,-60,0,50 | Approximate; -50 and 5 deliberately omitted |+| Section bounds | full XY bounds and central hex observed | full bounds; hex bounds match Z=6 evidence | SemanticallyEquivalentDifferentTopology for modeled landmarks |+| Slab areas | exact reference grouping unavailable | 255,707.9633; 280,707.9633; 8,660.2540 mm² | Unsupported for exact equivalence |+| Volume | 14,644,822.6361138 | 27,503,809.028687116 mm³ analytic | Approximate; 1.87805682x due omitted voids/details |+| Surface area | 807,080.802199914 | 850,568.213758446 mm² M8 | Approximate; 1.05388235x |+| Plane/cylinder/cone | 56 / 57 / 4 | 47 / 16 / 0 | Approximate; holes/cones/finishes omitted |+| R50 lobe supports | observed at end regions | 8 exact quarter-arc uses on observed centers | SemanticallyEquivalentDifferentTopology |+| Central raised region | hexagonal, Z=0..50 with Z=5/R5 finish evidence | sharp six-line prism, Z=0..50 | Approximate |+| Holes, slots, reliefs, finishes | present | absent | NotReconstructed |++No whole-part equivalence is claimed.++## Remaining blocker and next milestone++The current scaffold-backed workflow answered the milestone question positively for the main prismatic construction. The next blocker is no longer basic authoring ergonomics or exact line/arc arrangement. It is **reference section analysis and semantic grouping**: the analyzer still cannot authoritatively group the Z=-50 relief regions, holes/openings, and Z=5 transition into material sections with correspondence evidence.++Recommended next milestone: **CTC-SECTIONS-X1 — exact reference section grouping and correspondence**. Extract connected, bounded line/arc section loops at the principal Z intervals; group split cylinder supports into physical features; compare candidate/reference loop bounds, areas, and landmarks. Use that evidence to decide whether the next material increment is a Profile relief, a semantic hole/slot, or a finish transition. Do not add mirror/constraint/selection features until that evidence produces a concrete blocked source operation.diff --git a/fixtures/FirmamentV2/ProfileComposition/add-overlapped-by-remove.firmament b/fixtures/FirmamentV2/ProfileComposition/add-overlapped-by-remove.firmamentnew file mode 100644index 00000000..745eb023--- /dev/null+++ b/fixtures/FirmamentV2/ProfileComposition/add-overlapped-by-remove.firmament@@ -0,0 +1,28 @@+Concept Struct Layout On XY {+ Rect2 BaseGuide { Center: [0mm, 0mm]; Size: [20mm, 20mm]; Role: ProfileGuide }+ Rect2 AddGuide { Center: [0mm, 10mm]; Size: [10mm, 10mm]; Role: ProfileGuide }+ Rect2 RemoveGuide { Center: [2mm, 10mm]; Size: [4mm, 8mm]; Role: ProfileGuide }+}+Profile BaseProfile Using Layout { Loop Outer {+ Segment South { Trace: BaseGuide.Bottom; From: BaseGuide.BottomLeft; To: BaseGuide.BottomRight }+ Segment East { Trace: BaseGuide.Right; From: BaseGuide.BottomRight; To: BaseGuide.TopRight }+ Segment North { Trace: BaseGuide.Top; From: BaseGuide.TopRight; To: BaseGuide.TopLeft }+ Segment West { Trace: BaseGuide.Left; From: BaseGuide.TopLeft; To: BaseGuide.BottomLeft }+} }+Profile AddProfile Using Layout { Loop Outer {+ Segment South { Trace: AddGuide.Bottom; From: AddGuide.BottomLeft; To: AddGuide.BottomRight }+ Segment East { Trace: AddGuide.Right; From: AddGuide.BottomRight; To: AddGuide.TopRight }+ Segment North { Trace: AddGuide.Top; From: AddGuide.TopRight; To: AddGuide.TopLeft }+ Segment West { Trace: AddGuide.Left; From: AddGuide.TopLeft; To: AddGuide.BottomLeft }+} }+Profile RemoveProfile Using Layout { Loop Outer {+ Segment South { Trace: RemoveGuide.Bottom; From: RemoveGuide.BottomLeft; To: RemoveGuide.BottomRight }+ Segment East { Trace: RemoveGuide.Right; From: RemoveGuide.BottomRight; To: RemoveGuide.TopRight }+ Segment North { Trace: RemoveGuide.Top; From: RemoveGuide.TopRight; To: RemoveGuide.TopLeft }+ Segment West { Trace: RemoveGuide.Left; From: RemoveGuide.TopLeft; To: RemoveGuide.BottomLeft }+} }+Struct Composition { Compose AddOverlappedByRemove {+ Base Stock { Profile: BaseProfile; From: 0mm; To: 10mm; Role: Stock }+ Add Pad { Profile: AddProfile; From: 5mm; To: 10mm; Role: Pad }+ Remove Relief { Profile: RemoveProfile; From: 5mm; To: 10mm; Role: Relief }+} }diff --git a/fixtures/FirmamentV2/ProfileComposition/crossing-removal-notch.firmament b/fixtures/FirmamentV2/ProfileComposition/crossing-removal-notch.firmamentnew file mode 100644index 00000000..6ced15b2--- /dev/null+++ b/fixtures/FirmamentV2/ProfileComposition/crossing-removal-notch.firmament@@ -0,0 +1,20 @@+Concept Struct Layout On XY {+ Rect2 BaseGuide { Center: [0mm, 0mm]; Size: [20mm, 20mm]; Role: ProfileGuide }+ Rect2 NotchGuide { Center: [8mm, 0mm]; Size: [8mm, 8mm]; Role: ProfileGuide }+}+Profile BaseProfile Using Layout { Loop Outer {+ Segment S { Trace: BaseGuide.Bottom; From: BaseGuide.BottomLeft; To: BaseGuide.BottomRight }+ Segment E { Trace: BaseGuide.Right; From: BaseGuide.BottomRight; To: BaseGuide.TopRight }+ Segment N { Trace: BaseGuide.Top; From: BaseGuide.TopRight; To: BaseGuide.TopLeft }+ Segment W { Trace: BaseGuide.Left; From: BaseGuide.TopLeft; To: BaseGuide.BottomLeft }+} }+Profile NotchProfile Using Layout { Loop Outer {+ Segment S { Trace: NotchGuide.Bottom; From: NotchGuide.BottomLeft; To: NotchGuide.BottomRight }+ Segment E { Trace: NotchGuide.Right; From: NotchGuide.BottomRight; To: NotchGuide.TopRight }+ Segment N { Trace: NotchGuide.Top; From: NotchGuide.TopRight; To: NotchGuide.TopLeft }+ Segment W { Trace: NotchGuide.Left; From: NotchGuide.TopLeft; To: NotchGuide.BottomLeft }+} }+Struct Composition { Compose CrossingRemovalNotch {+ Base Stock { Profile: BaseProfile; From: 0mm; To: 10mm; Role: Stock }+ Remove Notch { Profile: NotchProfile; From: 5mm; To: 10mm; Role: Relief }+} }diff --git a/fixtures/FirmamentV2/ProfileComposition/invalid/ambiguous-tangent-crossing.firmament b/fixtures/FirmamentV2/ProfileComposition/invalid/ambiguous-tangent-crossing.firmamentnew file mode 100644index 00000000..0b1b7043--- /dev/null+++ b/fixtures/FirmamentV2/ProfileComposition/invalid/ambiguous-tangent-crossing.firmament@@ -0,0 +1,25 @@+Concept Struct Layout On XY {+ Rect2 BaseGuide { Center: [0mm, 0mm]; Size: [20mm, 20mm]; Role: ProfileGuide }+ Point2 CutCenter { Position: [6mm, 0mm] }+ Point2 CutEast { Position: [10mm, 0mm] }+ Point2 CutNorth { Position: [6mm, 4mm] }+ Point2 CutWest { Position: [2mm, 0mm] }+ Point2 CutSouth { Position: [6mm, -4mm] }+ Circle2 CutCircle { Center: CutCenter; Radius: 4mm }+}+Profile BaseProfile Using Layout { Loop Outer {+ Segment S { Trace: BaseGuide.Bottom; From: BaseGuide.BottomLeft; To: BaseGuide.BottomRight }+ Segment E { Trace: BaseGuide.Right; From: BaseGuide.BottomRight; To: BaseGuide.TopRight }+ Segment N { Trace: BaseGuide.Top; From: BaseGuide.TopRight; To: BaseGuide.TopLeft }+ Segment W { Trace: BaseGuide.Left; From: BaseGuide.TopLeft; To: BaseGuide.BottomLeft }+} }+Profile TangentVoid Using Layout { Loop Outer {+ Segment NorthEast { Trace: CutCircle; From: CutEast; To: CutNorth; Sweep: CounterClockwise }+ Segment NorthWest { Trace: CutCircle; From: CutNorth; To: CutWest; Sweep: CounterClockwise }+ Segment SouthWest { Trace: CutCircle; From: CutWest; To: CutSouth; Sweep: CounterClockwise }+ Segment SouthEast { Trace: CutCircle; From: CutSouth; To: CutEast; Sweep: CounterClockwise }+} }+Struct Composition { Compose AmbiguousTangentCrossing {+ Base Stock { Profile: BaseProfile; From: 0mm; To: 10mm; Role: Stock }+ Remove TangentCut { Profile: TangentVoid; From: 5mm; To: 10mm; Role: Relief }+} }diff --git a/fixtures/FirmamentV2/ProfileComposition/invalid/contradictory-coincident-add-remove.firmament b/fixtures/FirmamentV2/ProfileComposition/invalid/contradictory-coincident-add-remove.firmamentnew file mode 100644index 00000000..4a690b21--- /dev/null+++ b/fixtures/FirmamentV2/ProfileComposition/invalid/contradictory-coincident-add-remove.firmament@@ -0,0 +1,21 @@+Concept Struct Layout On XY {+ Rect2 BaseGuide { Center: [0mm, 0mm]; Size: [20mm, 20mm]; Role: ProfileGuide }+ Rect2 CoincidentGuide { Center: [0mm, 12mm]; Size: [8mm, 4mm]; Role: ProfileGuide }+}+Profile BaseProfile Using Layout { Loop Outer {+ Segment S { Trace: BaseGuide.Bottom; From: BaseGuide.BottomLeft; To: BaseGuide.BottomRight }+ Segment E { Trace: BaseGuide.Right; From: BaseGuide.BottomRight; To: BaseGuide.TopRight }+ Segment N { Trace: BaseGuide.Top; From: BaseGuide.TopRight; To: BaseGuide.TopLeft }+ Segment W { Trace: BaseGuide.Left; From: BaseGuide.TopLeft; To: BaseGuide.BottomLeft }+} }+Profile CoincidentProfile Using Layout { Loop Outer {+ Segment S { Trace: CoincidentGuide.Bottom; From: CoincidentGuide.BottomLeft; To: CoincidentGuide.BottomRight }+ Segment E { Trace: CoincidentGuide.Right; From: CoincidentGuide.BottomRight; To: CoincidentGuide.TopRight }+ Segment N { Trace: CoincidentGuide.Top; From: CoincidentGuide.TopRight; To: CoincidentGuide.TopLeft }+ Segment W { Trace: CoincidentGuide.Left; From: CoincidentGuide.TopLeft; To: CoincidentGuide.BottomLeft }+} }+Struct Composition { Compose ContradictoryCoincident {+ Base Stock { Profile: BaseProfile; From: 0mm; To: 10mm; Role: Stock }+ Add Pad { Profile: CoincidentProfile; From: 5mm; To: 10mm; Role: Pad }+ Remove Relief { Profile: CoincidentProfile; From: 5mm; To: 10mm; Role: Relief }+} }diff --git a/fixtures/FirmamentV2/ProfileComposition/invalid/dangling-arrangement-fragment.firmament b/fixtures/FirmamentV2/ProfileComposition/invalid/dangling-arrangement-fragment.firmamentnew file mode 100644index 00000000..9119350f--- /dev/null+++ b/fixtures/FirmamentV2/ProfileComposition/invalid/dangling-arrangement-fragment.firmament@@ -0,0 +1,11 @@+Concept Struct Layout On XY {+ Rect2 BaseGuide { Center: [0mm, 0mm]; Size: [20mm, 20mm]; Role: ProfileGuide }+}+Profile DanglingProfile Using Layout { Loop Outer {+ Segment S { Trace: BaseGuide.Bottom; From: BaseGuide.BottomLeft; To: BaseGuide.BottomRight }+ Segment E { Trace: BaseGuide.Right; From: BaseGuide.BottomRight; To: BaseGuide.TopRight }+ Segment N { Trace: BaseGuide.Top; From: BaseGuide.TopRight; To: BaseGuide.TopLeft }+} }+Struct Composition { Compose DanglingArrangementFragment {+ Base Stock { Profile: DanglingProfile; From: 0mm; To: 10mm; Role: Stock }+} }diff --git a/fixtures/FirmamentV2/ProfileComposition/invalid/disconnected-final-material.firmament b/fixtures/FirmamentV2/ProfileComposition/invalid/disconnected-final-material.firmamentnew file mode 100644index 00000000..44cd2351--- /dev/null+++ b/fixtures/FirmamentV2/ProfileComposition/invalid/disconnected-final-material.firmament@@ -0,0 +1,20 @@+Concept Struct Layout On XY {+ Rect2 BaseGuide { Center: [0mm, 0mm]; Size: [20mm, 20mm]; Role: ProfileGuide }+ Rect2 SplitGuide { Center: [0mm, 0mm]; Size: [2mm, 24mm]; Role: ProfileGuide }+}+Profile BaseProfile Using Layout { Loop Outer {+ Segment S { Trace: BaseGuide.Bottom; From: BaseGuide.BottomLeft; To: BaseGuide.BottomRight }+ Segment E { Trace: BaseGuide.Right; From: BaseGuide.BottomRight; To: BaseGuide.TopRight }+ Segment N { Trace: BaseGuide.Top; From: BaseGuide.TopRight; To: BaseGuide.TopLeft }+ Segment W { Trace: BaseGuide.Left; From: BaseGuide.TopLeft; To: BaseGuide.BottomLeft }+} }+Profile SplitProfile Using Layout { Loop Outer {+ Segment S { Trace: SplitGuide.Bottom; From: SplitGuide.BottomLeft; To: SplitGuide.BottomRight }+ Segment E { Trace: SplitGuide.Right; From: SplitGuide.BottomRight; To: SplitGuide.TopRight }+ Segment N { Trace: SplitGuide.Top; From: SplitGuide.TopRight; To: SplitGuide.TopLeft }+ Segment W { Trace: SplitGuide.Left; From: SplitGuide.TopLeft; To: SplitGuide.BottomLeft }+} }+Struct Composition { Compose DisconnectedFinalMaterial {+ Base Stock { Profile: BaseProfile; From: 0mm; To: 10mm; Role: Stock }+ Remove Split { Profile: SplitProfile; From: 5mm; To: 10mm; Role: Relief }+} }diff --git a/fixtures/FirmamentV2/ProfileComposition/invalid/point-only-tangent-connection.firmament b/fixtures/FirmamentV2/ProfileComposition/invalid/point-only-tangent-connection.firmamentnew file mode 100644index 00000000..07eb7af4--- /dev/null+++ b/fixtures/FirmamentV2/ProfileComposition/invalid/point-only-tangent-connection.firmament@@ -0,0 +1,20 @@+Concept Struct Layout On XY {+ Rect2 BaseGuide { Center: [0mm, 0mm]; Size: [20mm, 20mm]; Role: ProfileGuide }+ Rect2 TangentGuide { Center: [12mm, 12mm]; Size: [4mm, 4mm]; Role: ProfileGuide }+}+Profile BaseProfile Using Layout { Loop Outer {+ Segment S { Trace: BaseGuide.Bottom; From: BaseGuide.BottomLeft; To: BaseGuide.BottomRight }+ Segment E { Trace: BaseGuide.Right; From: BaseGuide.BottomRight; To: BaseGuide.TopRight }+ Segment N { Trace: BaseGuide.Top; From: BaseGuide.TopRight; To: BaseGuide.TopLeft }+ Segment W { Trace: BaseGuide.Left; From: BaseGuide.TopLeft; To: BaseGuide.BottomLeft }+} }+Profile TangentProfile Using Layout { Loop Outer {+ Segment S { Trace: TangentGuide.Bottom; From: TangentGuide.BottomLeft; To: TangentGuide.BottomRight }+ Segment E { Trace: TangentGuide.Right; From: TangentGuide.BottomRight; To: TangentGuide.TopRight }+ Segment N { Trace: TangentGuide.Top; From: TangentGuide.TopRight; To: TangentGuide.TopLeft }+ Segment W { Trace: TangentGuide.Left; From: TangentGuide.TopLeft; To: TangentGuide.BottomLeft }+} }+Struct Composition { Compose PointOnlyTangent {+ Base Stock { Profile: BaseProfile; From: 0mm; To: 10mm; Role: Stock }+ Add TangentPad { Profile: TangentProfile; From: 5mm; To: 10mm; Role: Pad }+} }diff --git a/fixtures/FirmamentV2/ProfileComposition/invalid/unresolved-angular-ordering.firmament b/fixtures/FirmamentV2/ProfileComposition/invalid/unresolved-angular-ordering.firmamentnew file mode 100644index 00000000..8d6e7803--- /dev/null+++ b/fixtures/FirmamentV2/ProfileComposition/invalid/unresolved-angular-ordering.firmament@@ -0,0 +1,20 @@+Concept Struct Layout On XY {+ Rect2 BaseGuide { Center: [0mm, 0mm]; Size: [20mm, 20mm]; Role: ProfileGuide }+ Rect2 NorthEast { Center: [12mm, 12mm]; Size: [4mm, 4mm]; Role: ProfileGuide }+}+Profile BaseProfile Using Layout { Loop Outer {+ Segment S { Trace: BaseGuide.Bottom; From: BaseGuide.BottomLeft; To: BaseGuide.BottomRight }+ Segment E { Trace: BaseGuide.Right; From: BaseGuide.BottomRight; To: BaseGuide.TopRight }+ Segment N { Trace: BaseGuide.Top; From: BaseGuide.TopRight; To: BaseGuide.TopLeft }+ Segment W { Trace: BaseGuide.Left; From: BaseGuide.TopLeft; To: BaseGuide.BottomLeft }+} }+Profile NorthEastProfile Using Layout { Loop Outer {+ Segment S { Trace: NorthEast.Bottom; From: NorthEast.BottomLeft; To: NorthEast.BottomRight }+ Segment E { Trace: NorthEast.Right; From: NorthEast.BottomRight; To: NorthEast.TopRight }+ Segment N { Trace: NorthEast.Top; From: NorthEast.TopRight; To: NorthEast.TopLeft }+ Segment W { Trace: NorthEast.Left; From: NorthEast.TopLeft; To: NorthEast.BottomLeft }+} }+Struct Composition { Compose UnresolvedAngularOrdering {+ Base Stock { Profile: BaseProfile; From: 0mm; To: 10mm; Role: Stock }+ Add NorthEastPad { Profile: NorthEastProfile; From: 5mm; To: 10mm; Role: Pad }+} }diff --git a/fixtures/FirmamentV2/ProfileComposition/invalid/zero-width-ligament.firmament b/fixtures/FirmamentV2/ProfileComposition/invalid/zero-width-ligament.firmamentnew file mode 100644index 00000000..188e901e--- /dev/null+++ b/fixtures/FirmamentV2/ProfileComposition/invalid/zero-width-ligament.firmament@@ -0,0 +1,38 @@+Concept Struct Layout On XY {+ Rect2 BaseGuide { Center: [0mm, 0mm]; Size: [30mm, 20mm]; Role: ProfileGuide }+ Point2 LeftCenter { Position: [-4mm, 0mm] }+ Point2 LeftEast { Position: [0mm, 0mm] }+ Point2 LeftNorth { Position: [-4mm, 4mm] }+ Point2 LeftWest { Position: [-8mm, 0mm] }+ Point2 LeftSouth { Position: [-4mm, -4mm] }+ Point2 RightCenter { Position: [4mm, 0mm] }+ Point2 RightEast { Position: [8mm, 0mm] }+ Point2 RightNorth { Position: [4mm, 4mm] }+ Point2 RightWest { Position: [0mm, 0mm] }+ Point2 RightSouth { Position: [4mm, -4mm] }+ Circle2 LeftCircle { Center: LeftCenter; Radius: 4mm }+ Circle2 RightCircle { Center: RightCenter; Radius: 4mm }+}+Profile BaseProfile Using Layout { Loop Outer {+ Segment S { Trace: BaseGuide.Bottom; From: BaseGuide.BottomLeft; To: BaseGuide.BottomRight }+ Segment E { Trace: BaseGuide.Right; From: BaseGuide.BottomRight; To: BaseGuide.TopRight }+ Segment N { Trace: BaseGuide.Top; From: BaseGuide.TopRight; To: BaseGuide.TopLeft }+ Segment W { Trace: BaseGuide.Left; From: BaseGuide.TopLeft; To: BaseGuide.BottomLeft }+} }+Profile LeftVoid Using Layout { Loop Outer {+ Segment NE { Trace: LeftCircle; From: LeftEast; To: LeftNorth; Sweep: CounterClockwise }+ Segment NW { Trace: LeftCircle; From: LeftNorth; To: LeftWest; Sweep: CounterClockwise }+ Segment SW { Trace: LeftCircle; From: LeftWest; To: LeftSouth; Sweep: CounterClockwise }+ Segment SE { Trace: LeftCircle; From: LeftSouth; To: LeftEast; Sweep: CounterClockwise }+} }+Profile RightVoid Using Layout { Loop Outer {+ Segment NE { Trace: RightCircle; From: RightEast; To: RightNorth; Sweep: CounterClockwise }+ Segment NW { Trace: RightCircle; From: RightNorth; To: RightWest; Sweep: CounterClockwise }+ Segment SW { Trace: RightCircle; From: RightWest; To: RightSouth; Sweep: CounterClockwise }+ Segment SE { Trace: RightCircle; From: RightSouth; To: RightEast; Sweep: CounterClockwise }+} }+Struct Composition { Compose ZeroWidthLigament {+ Base Stock { Profile: BaseProfile; From: 0mm; To: 10mm; Role: Stock }+ Remove Left { Profile: LeftVoid; From: 5mm; To: 10mm; Role: Relief }+ Remove Right { Profile: RightVoid; From: 5mm; To: 10mm; Role: Relief }+} }diff --git a/fixtures/FirmamentV2/ProfileComposition/overlapping-removes.firmament b/fixtures/FirmamentV2/ProfileComposition/overlapping-removes.firmamentnew file mode 100644index 00000000..e5461d87--- /dev/null+++ b/fixtures/FirmamentV2/ProfileComposition/overlapping-removes.firmament@@ -0,0 +1,28 @@+Concept Struct Layout On XY {+ Rect2 BaseGuide { Center: [0mm, 0mm]; Size: [20mm, 20mm]; Role: ProfileGuide }+ Rect2 LeftGuide { Center: [-2mm, 0mm]; Size: [8mm, 8mm]; Role: ProfileGuide }+ Rect2 RightGuide { Center: [2mm, 0mm]; Size: [8mm, 8mm]; Role: ProfileGuide }+}+Profile BaseProfile Using Layout { Loop Outer {+ Segment S { Trace: BaseGuide.Bottom; From: BaseGuide.BottomLeft; To: BaseGuide.BottomRight }+ Segment E { Trace: BaseGuide.Right; From: BaseGuide.BottomRight; To: BaseGuide.TopRight }+ Segment N { Trace: BaseGuide.Top; From: BaseGuide.TopRight; To: BaseGuide.TopLeft }+ Segment W { Trace: BaseGuide.Left; From: BaseGuide.TopLeft; To: BaseGuide.BottomLeft }+} }+Profile LeftVoid Using Layout { Loop Outer {+ Segment S { Trace: LeftGuide.Bottom; From: LeftGuide.BottomLeft; To: LeftGuide.BottomRight }+ Segment E { Trace: LeftGuide.Right; From: LeftGuide.BottomRight; To: LeftGuide.TopRight }+ Segment N { Trace: LeftGuide.Top; From: LeftGuide.TopRight; To: LeftGuide.TopLeft }+ Segment W { Trace: LeftGuide.Left; From: LeftGuide.TopLeft; To: LeftGuide.BottomLeft }+} }+Profile RightVoid Using Layout { Loop Outer {+ Segment S { Trace: RightGuide.Bottom; From: RightGuide.BottomLeft; To: RightGuide.BottomRight }+ Segment E { Trace: RightGuide.Right; From: RightGuide.BottomRight; To: RightGuide.TopRight }+ Segment N { Trace: RightGuide.Top; From: RightGuide.TopRight; To: RightGuide.TopLeft }+ Segment W { Trace: RightGuide.Left; From: RightGuide.TopLeft; To: RightGuide.BottomLeft }+} }+Struct Composition { Compose OverlappingRemoves {+ Base Stock { Profile: BaseProfile; From: 0mm; To: 15mm; Role: Stock }+ Remove Left { Profile: LeftVoid; From: 10mm; To: 15mm; Role: Relief }+ Remove Right { Profile: RightVoid; From: 10mm; To: 15mm; Role: Relief }+} }diff --git a/fixtures/FirmamentV2/ProfileComposition/shared-boundary-adds.firmament b/fixtures/FirmamentV2/ProfileComposition/shared-boundary-adds.firmamentnew file mode 100644index 00000000..3c2276bc--- /dev/null+++ b/fixtures/FirmamentV2/ProfileComposition/shared-boundary-adds.firmament@@ -0,0 +1,28 @@+Concept Struct Layout On XY {+ Rect2 BaseGuide { Center: [0mm, 0mm]; Size: [20mm, 20mm]; Role: ProfileGuide }+ Rect2 LeftGuide { Center: [-5mm, 15mm]; Size: [10mm, 10mm]; Role: ProfileGuide }+ Rect2 RightGuide { Center: [5mm, 15mm]; Size: [10mm, 10mm]; Role: ProfileGuide }+}+Profile BaseProfile Using Layout { Loop Outer {+ Segment S { Trace: BaseGuide.Bottom; From: BaseGuide.BottomLeft; To: BaseGuide.BottomRight }+ Segment E { Trace: BaseGuide.Right; From: BaseGuide.BottomRight; To: BaseGuide.TopRight }+ Segment N { Trace: BaseGuide.Top; From: BaseGuide.TopRight; To: BaseGuide.TopLeft }+ Segment W { Trace: BaseGuide.Left; From: BaseGuide.TopLeft; To: BaseGuide.BottomLeft }+} }+Profile LeftAdd Using Layout { Loop Outer {+ Segment S { Trace: LeftGuide.Bottom; From: LeftGuide.BottomLeft; To: LeftGuide.BottomRight }+ Segment E { Trace: LeftGuide.Right; From: LeftGuide.BottomRight; To: LeftGuide.TopRight }+ Segment N { Trace: LeftGuide.Top; From: LeftGuide.TopRight; To: LeftGuide.TopLeft }+ Segment W { Trace: LeftGuide.Left; From: LeftGuide.TopLeft; To: LeftGuide.BottomLeft }+} }+Profile RightAdd Using Layout { Loop Outer {+ Segment S { Trace: RightGuide.Bottom; From: RightGuide.BottomLeft; To: RightGuide.BottomRight }+ Segment E { Trace: RightGuide.Right; From: RightGuide.BottomRight; To: RightGuide.TopRight }+ Segment N { Trace: RightGuide.Top; From: RightGuide.TopRight; To: RightGuide.TopLeft }+ Segment W { Trace: RightGuide.Left; From: RightGuide.TopLeft; To: RightGuide.BottomLeft }+} }+Struct Composition { Compose SharedBoundaryAdds {+ Base Stock { Profile: BaseProfile; From: 0mm; To: 10mm; Role: Stock }+ Add Left { Profile: LeftAdd; From: 5mm; To: 10mm; Role: Pad }+ Add Right { Profile: RightAdd; From: 5mm; To: 10mm; Role: Pad }+} }diff --git a/testdata/firmament/reconstructions/nist_ctc_01/ctc01_prismatic_blockout_x2.firmament b/testdata/firmament/reconstructions/nist_ctc_01/ctc01_prismatic_blockout_x2.firmamentnew file mode 100644index 00000000..24d5f501--- /dev/null+++ b/testdata/firmament/reconstructions/nist_ctc_01/ctc01_prismatic_blockout_x2.firmament@@ -0,0 +1,148 @@+// CTC-BLOCKOUT-X2. Coordinates are in the reference frame (no Z translation).+// Materialized regions are limited to Observed and StrongInference evidence.+Concept Struct Ctc01BlockoutScaffold On XY {+ Rect2 PrimaryWebGuide { Center: [0mm, 0mm]; Size: [800mm, 250mm]; Role: ProfileGuide }+ Rect2 MidLevelGuide { Center: [0mm, 0mm]; Size: [500mm, 300mm]; Role: ProfileGuide }++ Point2 LTopOuterBottom { Position: [-400mm, 125mm] }+ Point2 LTopInnerBottom { Position: [-250mm, 125mm] }+ Point2 LTopInnerArc { Position: [-250mm, 175mm] }+ Point2 LTopInnerTop { Position: [-300mm, 225mm] }+ Point2 LTopOuterTop { Position: [-350mm, 225mm] }+ Point2 LTopOuterArc { Position: [-400mm, 175mm] }+ Point2 LTopInnerCenter { Position: [-300mm, 175mm] }+ Point2 LTopOuterCenter { Position: [-350mm, 175mm] }+ Circle2 LTopInnerR50 { Center: LTopInnerCenter; Radius: 50mm }+ Circle2 LTopOuterR50 { Center: LTopOuterCenter; Radius: 50mm }+ Line2 LTopBottom { From: LTopOuterBottom; To: LTopInnerBottom }+ Line2 LTopInnerSide { From: LTopInnerBottom; To: LTopInnerArc }+ Line2 LTopCrown { From: LTopInnerTop; To: LTopOuterTop }+ Line2 LTopOuterSide { From: LTopOuterArc; To: LTopOuterBottom }++ Point2 RTopInnerBottom { Position: [250mm, 125mm] }+ Point2 RTopOuterBottom { Position: [400mm, 125mm] }+ Point2 RTopOuterArc { Position: [400mm, 175mm] }+ Point2 RTopOuterTop { Position: [350mm, 225mm] }+ Point2 RTopInnerTop { Position: [300mm, 225mm] }+ Point2 RTopInnerArc { Position: [250mm, 175mm] }+ Point2 RTopOuterCenter { Position: [350mm, 175mm] }+ Point2 RTopInnerCenter { Position: [300mm, 175mm] }+ Circle2 RTopOuterR50 { Center: RTopOuterCenter; Radius: 50mm }+ Circle2 RTopInnerR50 { Center: RTopInnerCenter; Radius: 50mm }+ Line2 RTopBottom { From: RTopInnerBottom; To: RTopOuterBottom }+ Line2 RTopOuterSide { From: RTopOuterBottom; To: RTopOuterArc }+ Line2 RTopCrown { From: RTopOuterTop; To: RTopInnerTop }+ Line2 RTopInnerSide { From: RTopInnerArc; To: RTopInnerBottom }++ Point2 LBottomOuterBottom { Position: [-350mm, -225mm] }+ Point2 LBottomInnerBottom { Position: [-300mm, -225mm] }+ Point2 LBottomInnerArc { Position: [-250mm, -175mm] }+ Point2 LBottomInnerTop { Position: [-250mm, -125mm] }+ Point2 LBottomOuterTop { Position: [-400mm, -125mm] }+ Point2 LBottomOuterArc { Position: [-400mm, -175mm] }+ Point2 LBottomInnerCenter { Position: [-300mm, -175mm] }+ Point2 LBottomOuterCenter { Position: [-350mm, -175mm] }+ Circle2 LBottomInnerR50 { Center: LBottomInnerCenter; Radius: 50mm }+ Circle2 LBottomOuterR50 { Center: LBottomOuterCenter; Radius: 50mm }+ Line2 LBottomCrown { From: LBottomOuterBottom; To: LBottomInnerBottom }+ Line2 LBottomInnerSide { From: LBottomInnerArc; To: LBottomInnerTop }+ Line2 LBottomTop { From: LBottomInnerTop; To: LBottomOuterTop }+ Line2 LBottomOuterSide { From: LBottomOuterTop; To: LBottomOuterArc }++ Point2 RBottomInnerBottom { Position: [300mm, -225mm] }+ Point2 RBottomOuterBottom { Position: [350mm, -225mm] }+ Point2 RBottomOuterArc { Position: [400mm, -175mm] }+ Point2 RBottomOuterTop { Position: [400mm, -125mm] }+ Point2 RBottomInnerTop { Position: [250mm, -125mm] }+ Point2 RBottomInnerArc { Position: [250mm, -175mm] }+ Point2 RBottomInnerCenter { Position: [300mm, -175mm] }+ Point2 RBottomOuterCenter { Position: [350mm, -175mm] }+ Circle2 RBottomInnerR50 { Center: RBottomInnerCenter; Radius: 50mm }+ Circle2 RBottomOuterR50 { Center: RBottomOuterCenter; Radius: 50mm }+ Line2 RBottomCrown { From: RBottomInnerBottom; To: RBottomOuterBottom }+ Line2 RBottomOuterSide { From: RBottomOuterArc; To: RBottomOuterTop }+ Line2 RBottomTop { From: RBottomOuterTop; To: RBottomInnerTop }+ Line2 RBottomInnerSide { From: RBottomInnerTop; To: RBottomInnerArc }++ Point2 HexSouth { Position: [0mm, -57.7350538379252mm] }+ Point2 HexSouthEast { Position: [50mm, -28.8675403784439mm] }+ Point2 HexNorthEast { Position: [50mm, 28.8674865405187mm] }+ Point2 HexNorth { Position: [0mm, 57.735mm] }+ Point2 HexNorthWest { Position: [-50mm, 28.8674865405186mm] }+ Point2 HexSouthWest { Position: [-50mm, -28.8675403784438mm] }+ Line2 HexSE { From: HexSouth; To: HexSouthEast }+ Line2 HexE { From: HexSouthEast; To: HexNorthEast }+ Line2 HexNE { From: HexNorthEast; To: HexNorth }+ Line2 HexNW { From: HexNorth; To: HexNorthWest }+ Line2 HexW { From: HexNorthWest; To: HexSouthWest }+ Line2 HexSW { From: HexSouthWest; To: HexSouth }+}++Profile PrimaryWeb Using Ctc01BlockoutScaffold { Loop Outer {+ Segment South { Trace: PrimaryWebGuide.Bottom; From: PrimaryWebGuide.BottomLeft; To: PrimaryWebGuide.BottomRight }+ Segment East { Trace: PrimaryWebGuide.Right; From: PrimaryWebGuide.BottomRight; To: PrimaryWebGuide.TopRight }+ Segment North { Trace: PrimaryWebGuide.Top; From: PrimaryWebGuide.TopRight; To: PrimaryWebGuide.TopLeft }+ Segment West { Trace: PrimaryWebGuide.Left; From: PrimaryWebGuide.TopLeft; To: PrimaryWebGuide.BottomLeft }+} }+Profile MidLevelWeb Using Ctc01BlockoutScaffold { Loop Outer {+ Segment South { Trace: MidLevelGuide.Bottom; From: MidLevelGuide.BottomLeft; To: MidLevelGuide.BottomRight }+ Segment East { Trace: MidLevelGuide.Right; From: MidLevelGuide.BottomRight; To: MidLevelGuide.TopRight }+ Segment North { Trace: MidLevelGuide.Top; From: MidLevelGuide.TopRight; To: MidLevelGuide.TopLeft }+ Segment West { Trace: MidLevelGuide.Left; From: MidLevelGuide.TopLeft; To: MidLevelGuide.BottomLeft }+} }+Profile LeftTopEar Using Ctc01BlockoutScaffold { Loop Outer {+ Segment Bottom { Trace: LTopBottom; From: LTopOuterBottom; To: LTopInnerBottom }+ Segment InnerSide { Trace: LTopInnerSide; From: LTopInnerBottom; To: LTopInnerArc }+ Segment InnerRound { Trace: LTopInnerR50; From: LTopInnerArc; To: LTopInnerTop; Sweep: CounterClockwise }+ Segment Crown { Trace: LTopCrown; From: LTopInnerTop; To: LTopOuterTop }+ Segment OuterRound { Trace: LTopOuterR50; From: LTopOuterTop; To: LTopOuterArc; Sweep: CounterClockwise }+ Segment OuterSide { Trace: LTopOuterSide; From: LTopOuterArc; To: LTopOuterBottom }+} }+Profile RightTopEar Using Ctc01BlockoutScaffold { Loop Outer {+ Segment Bottom { Trace: RTopBottom; From: RTopInnerBottom; To: RTopOuterBottom }+ Segment OuterSide { Trace: RTopOuterSide; From: RTopOuterBottom; To: RTopOuterArc }+ Segment OuterRound { Trace: RTopOuterR50; From: RTopOuterArc; To: RTopOuterTop; Sweep: CounterClockwise }+ Segment Crown { Trace: RTopCrown; From: RTopOuterTop; To: RTopInnerTop }+ Segment InnerRound { Trace: RTopInnerR50; From: RTopInnerTop; To: RTopInnerArc; Sweep: CounterClockwise }+ Segment InnerSide { Trace: RTopInnerSide; From: RTopInnerArc; To: RTopInnerBottom }+} }+Profile LeftBottomEar Using Ctc01BlockoutScaffold { Loop Outer {+ Segment Crown { Trace: LBottomCrown; From: LBottomOuterBottom; To: LBottomInnerBottom }+ Segment InnerRound { Trace: LBottomInnerR50; From: LBottomInnerBottom; To: LBottomInnerArc; Sweep: CounterClockwise }+ Segment InnerSide { Trace: LBottomInnerSide; From: LBottomInnerArc; To: LBottomInnerTop }+ Segment Top { Trace: LBottomTop; From: LBottomInnerTop; To: LBottomOuterTop }+ Segment OuterSide { Trace: LBottomOuterSide; From: LBottomOuterTop; To: LBottomOuterArc }+ Segment OuterRound { Trace: LBottomOuterR50; From: LBottomOuterArc; To: LBottomOuterBottom; Sweep: CounterClockwise }+} }+Profile RightBottomEar Using Ctc01BlockoutScaffold { Loop Outer {+ Segment Crown { Trace: RBottomCrown; From: RBottomInnerBottom; To: RBottomOuterBottom }+ Segment OuterRound { Trace: RBottomOuterR50; From: RBottomOuterBottom; To: RBottomOuterArc; Sweep: CounterClockwise }+ Segment OuterSide { Trace: RBottomOuterSide; From: RBottomOuterArc; To: RBottomOuterTop }+ Segment Top { Trace: RBottomTop; From: RBottomOuterTop; To: RBottomInnerTop }+ Segment InnerSide { Trace: RBottomInnerSide; From: RBottomInnerTop; To: RBottomInnerArc }+ Segment InnerRound { Trace: RBottomInnerR50; From: RBottomInnerArc; To: RBottomInnerBottom; Sweep: CounterClockwise }+} }+Profile CentralHex Using Ctc01BlockoutScaffold { Loop Outer {+ Segment SouthEast { Trace: HexSE; From: HexSouth; To: HexSouthEast }+ Segment East { Trace: HexE; From: HexSouthEast; To: HexNorthEast }+ Segment NorthEast { Trace: HexNE; From: HexNorthEast; To: HexNorth }+ Segment NorthWest { Trace: HexNW; From: HexNorth; To: HexNorthWest }+ Segment West { Trace: HexW; From: HexNorthWest; To: HexSouthWest }+ Segment SouthWest { Trace: HexSW; From: HexSouthWest; To: HexSouth }+} }++Struct Composition { Compose Ctc01PrismaticBlockoutX2 {+ Placement ReferenceWorld {+ Anchor: [0mm, 0mm, 0mm]+ ProfilePlane: XY+ Axis: +Z+ ReferenceDirection: +X+ }+ Base PrimaryPlate { Profile: PrimaryWeb; From: -100mm; To: 0mm; Role: ObservedPrimaryWeb }+ Add LeftTopLobe { Profile: LeftTopEar; From: -100mm; To: 0mm; Role: StrongInferenceR50Lobe }+ Add RightTopLobe { Profile: RightTopEar; From: -100mm; To: 0mm; Role: StrongInferenceR50Lobe }+ Add LeftBottomLobe { Profile: LeftBottomEar; From: -100mm; To: 0mm; Role: StrongInferenceR50Lobe }+ Add RightBottomLobe { Profile: RightBottomEar; From: -100mm; To: 0mm; Role: StrongInferenceR50Lobe }+ Add MidLevelPlate { Profile: MidLevelWeb; From: -60mm; To: 0mm; Role: StrongInferenceMidLevel }+ Add CentralRaisedRegion { Profile: CentralHex; From: 0mm; To: 50mm; Role: StrongInferenceCentralRaisedRegion }+} }