Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Accept bounded dimensional arithmetic in profile fields

Yuechen Li6d33f40b26df
diff --git a/Aetheris.Kernel.Firmament.Tests/ClosedBoundary2X1Tests.cs b/Aetheris.Kernel.Firmament.Tests/ClosedBoundary2X1Tests.cs
index 23a47ae3..d163d7aa 100644
--- a/Aetheris.Kernel.Firmament.Tests/ClosedBoundary2X1Tests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/ClosedBoundary2X1Tests.cs
@@ -7,6 +7,41 @@ namespace Aetheris.Kernel.Firmament.Tests;
public sealed class ClosedBoundary2X1Tests
{
+ [Fact]
+ public void DimensionalArithmetic_ReachesBoundaryAndExtrusionWithoutTruncation()
+ {
+ const string source = """
+ Model ArithmeticPlate {
+ Units: mm
+ Template < W: Length > Struct Plate {
+ RoundedRect2 Outline { Center: [W / 2, -30mm / 2] Size: [W - 2mm, 30mm] Radius: 2mm + 1mm }
+ Profile Section { Loop Outer { Outline |> TraceLoop } }
+ Extrude Body { Profile: Section From: 1mm + 2mm To: 8mm + 2mm }
+ }
+ Struct Item = Plate<W: 40mm>
+ }
+ """;
+ var build = FirmamentBuildAndExport.CompileSource(source);
+ Assert.True(build.IsSuccess, string.Join("\n", build.Diagnostics.Select(x => x.Message)));
+ var literal = source.Replace("W / 2", "20mm").Replace("-30mm / 2", "-15mm")
+ .Replace("W - 2mm", "38mm").Replace("2mm + 1mm", "3mm")
+ .Replace("1mm + 2mm", "3mm").Replace("8mm + 2mm", "10mm");
+ var expected = FirmamentBuildAndExport.CompileSource(literal);
+ Assert.True(expected.IsSuccess, string.Join("\n", expected.Diagnostics.Select(x => x.Message)));
+ Assert.Equal(expected.Value.StepText, build.Value.StepText);
+ }
+
+ [Theory]
+ [InlineData("2mm + 1deg")]
+ [InlineData("2mm / 0")]
+ [InlineData("2mm + Missing")]
+ public void BoundaryLength_DoesNotAcceptValidPrefixOfInvalidExpression(string radius)
+ {
+ var result = FirmamentBuildAndExport.CompileSource(Source(
+ $"RoundedRect2 Shape {{ Center: [0mm,0mm] Size: [40mm,30mm] Radius: {radius} }}"));
+ Assert.False(result.IsSuccess);
+ }
+
[Fact]
public void TemplateLocalBoundariesAreLoweredOnlyAfterSpecialization()
{
diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/ClosedBoundary2Authoring.cs b/Aetheris.Kernel.Firmament/FirmamentV2/ClosedBoundary2Authoring.cs
index 6c92ee83..9ca89e02 100644
--- a/Aetheris.Kernel.Firmament/FirmamentV2/ClosedBoundary2Authoring.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentV2/ClosedBoundary2Authoring.cs
@@ -236,9 +236,22 @@ internal static class ClosedBoundary2Authoring
private static double Cross((double X, double Y) a, (double X, double Y) b, (double X, double Y) c) => (b.X - a.X) * (c.Y - a.Y) - (b.Y - a.Y) * (c.X - a.X);
private static double Distance((double X, double Y) a, (double X, double Y) b) => Math.Sqrt((a.X - b.X) * (a.X - b.X) + (a.Y - b.Y) * (a.Y - b.Y));
private static double EllipsePerimeter(double a, double b) => Math.PI * (3 * (a + b) - Math.Sqrt((3 * a + b) * (a + 3 * b)));
- private static bool Point(string body, string field, out (double X, double Y) value) { var m = Regex.Match(body, $@"\b{field}\s*:\s*(?:\[|Point2\s*\()\s*(?<x>[-+.\deE]+)mm\s*,\s*(?<y>[-+.\deE]+)mm\s*(?:\]|\))", RegexOptions.CultureInvariant); value = default; return m.Success && Number(m.Groups["x"].Value, out value.X) && Number(m.Groups["y"].Value, out value.Y); }
+ private static bool Point(string body, string field, out (double X, double Y) value)
+ {
+ value = default;
+ var expression = ProfileAuthoringParser.Property(body, field)?.Trim();
+ if (expression is null) return false;
+ string components;
+ if (expression.StartsWith("[") && expression.EndsWith("]")) components = expression[1..^1];
+ else if (expression.StartsWith("Point2(") && expression.EndsWith(")")) components = expression[7..^1];
+ else return false;
+ var items = components.Split(',');
+ return items.Length == 2 && ProfileAuthoringParser.TryMeasure(items[0], "mm", out value.X)
+ && ProfileAuthoringParser.TryMeasure(items[1], "mm", out value.Y);
+ }
private static bool Vector(string body, string field, out (double X, double Y) value) => Point(body, field, out value);
- private static bool Length(string body, string field, out double value) { var m = Regex.Match(body, $@"\b{field}\s*:\s*(?<v>[-+.\deE]+)mm\b", RegexOptions.CultureInvariant); return Number(m.Groups["v"].Value, out value); }
+ private static bool Length(string body, string field, out double value) =>
+ ProfileAuthoringParser.TryMeasure(ProfileAuthoringParser.Property(body, field) ?? "", "mm", out value);
private static double Angle(string body, string field, double fallback, out bool valid) { var m = Regex.Match(body, $@"\b{field}\s*:\s*(?<v>[-+.\deE]+)deg\b", RegexOptions.CultureInvariant); if (!m.Success) { valid = true; return fallback; } valid = Number(m.Groups["v"].Value, out var value); return value; }
private static string? Identifier(string body, string field) { var m = Regex.Match(body, $@"\b{field}\s*:\s*(?<v>[A-Za-z_]\w*)\b", RegexOptions.CultureInvariant); return m.Success ? m.Groups["v"].Value : null; }
private static bool ResolvePoint(string source, string name, out (double X, double Y) p) { var m = Regex.Match(source, $@"\bPoint2\s+{Regex.Escape(name)}\s*\{{\s*Position\s*:\s*(?:\[|Point2\s*\()\s*(?<x>[-+.\deE]+)mm\s*,\s*(?<y>[-+.\deE]+)mm", RegexOptions.CultureInvariant); p = default; return m.Success && Number(m.Groups["x"].Value, out p.X) && Number(m.Groups["y"].Value, out p.Y); }
diff --git a/Aetheris.Kernel.Firmament/FirmamentV2/ProfileAuthoringParser.cs b/Aetheris.Kernel.Firmament/FirmamentV2/ProfileAuthoringParser.cs
index 0c31a410..2c6a0491 100644
--- a/Aetheris.Kernel.Firmament/FirmamentV2/ProfileAuthoringParser.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentV2/ProfileAuthoringParser.cs
@@ -22,7 +22,6 @@ public static class ProfileAuthoringParser
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 SpanHeader = new(@"\bSpan\s*<\s*(?<type>[A-Za-z_]\w*)\s*>\s+(?<name>[A-Za-z_]\w*)\s*\{", RegexOptions.CultureInvariant);
private static readonly Regex Pipeline = new(@"(?<expression>(?:Reverse\s+)?[A-Za-z_]\w*(?:\.[A-Za-z_]\w*)*(?:\s+As\s+[A-Za-z_]\w*)?\s*(?:\|>\s*(?:(?:Reverse\s+)?[A-Za-z_]\w*(?:\.[A-Za-z_]\w*)*(?:\s+As\s+[A-Za-z_]\w*)?|Close|TraceLoop)\s*)+)", RegexOptions.CultureInvariant);
- private static readonly Regex Extrude = new(@"\bExtrude\s+\w+\s*\{\s*Profile\s*:\s*(?<p>\w+)\s*;?\s*From\s*:\s*(?<a>[-+.\deE]+)mm\s*;?\s*To\s*:\s*(?<b>[-+.\deE]+)mm", RegexOptions.Singleline | RegexOptions.CultureInvariant);
public static bool IsProfileSource(string source) => Regex.IsMatch(source, @"\bProfile\s+[A-Za-z_]\w*", RegexOptions.CultureInvariant);
@@ -158,7 +157,8 @@ public static class ProfileAuthoringParser
var diagnostics = new List<string>();
source = ExpandBuiltInPolygons(source, diagnostics);
var authoredProfiles = FindProfiles(source).ToArray();
- var extrudeProfile = Extrude.Match(source).Groups["p"].Value;
+ var extrusion = FindBlocks(source, @"\bExtrude\s+\w+\s*\{").FirstOrDefault();
+ var extrudeProfile = extrusion is null ? null : Property(extrusion.Body, "Profile");
var profile = authoredProfiles.FirstOrDefault(candidate => candidate.Name == extrudeProfile) ?? authoredProfiles.FirstOrDefault();
if (profile is null)
return (null, 0, ["profile-source-missing-profile"]);
@@ -916,8 +916,11 @@ public static class ProfileAuthoringParser
private static (double Start, double End, double Height) ResolveExtrude(string source, string profileName, List<string> diagnostics)
{
- var match = Extrude.Matches(source).Cast<Match>().FirstOrDefault(x => x.Groups["p"].Value == profileName);
- if (match is null || !TryNumber(match.Groups["a"].Value, out var start) || !TryNumber(match.Groups["b"].Value, out var end)) { diagnostics.Add("profile-extrude-missing-or-mismatched"); return default; }
+ var block = FindBlocks(source, @"\bExtrude\s+\w+\s*\{")
+ .FirstOrDefault(x => Property(x.Body, "Profile") == profileName);
+ if (block is null || !TryMeasure(Property(block.Body, "From") ?? "", "mm", out var start)
+ || !TryMeasure(Property(block.Body, "To") ?? "", "mm", out var end))
+ { diagnostics.Add("profile-extrude-missing-or-mismatched"); return default; }
return (start, end, Math.Abs(end - start));
}
@@ -956,14 +959,14 @@ public static class ProfileAuthoringParser
return entries.OrderBy(x => x.Index);
}
- private static string? Property(string body, string name)
+ internal static string? Property(string body, string name)
{
// A property expression may contain whitespace (for example P.Length - P.Gap),
// while legacy compact authoring may put the next Name: property on the same line.
var match = Regex.Match(body, $@"\b{name}\s*:\s*(?<v>.*?)(?=\s+[A-Za-z_]\w*\s*:|[;\r\n}}]|$)", RegexOptions.CultureInvariant);
return match.Success ? match.Groups["v"].Value.Trim() : null;
}
- private static bool TryMeasure(string text, string unit, out double value)
+ internal static bool TryMeasure(string text, string unit, out double value)
{
var parser = new BoundedMeasureExpression(text, unit);
return parser.TryEvaluate(out value);
diff --git a/docs/public/firmament/boundaries.md b/docs/public/firmament/boundaries.md
index 31409762..e5cb6ba5 100644
--- a/docs/public/firmament/boundaries.md
+++ b/docs/public/firmament/boundaries.md
@@ -52,6 +52,8 @@ RegularPolygon2<6> Hex { Center: [0mm,0mm] AcrossFlats: 32mm Rotation: 30deg }
`Rotation: Angle` rotates a shape in its local XY plane. Placement remains owned by the existing `Concept Struct ... On XY` / `Profile ... Using ...` frame architecture; the shape declarations do not introduce a second frame system.
+After Template specialization, boundary coordinate and length fields accept bounded dimensional arithmetic through the existing Profile evaluator, for example `Center: [Spec.Width / 2, -Spec.Length / 2]` and `Radius: 2mm + 1mm`. Extrusion `From`/`To` intervals use the same evaluator. Expressions must consume the entire field and yield a length; incompatible units, unknown names, and division by zero fail rather than accepting a numeric prefix. This does not add arbitrary functions or a new expression language.
+
`Slot2.Length` is the overall end-to-end length and must be at least `Width`; equality lowers deterministically to one circular boundary. `Ellipse2.AxisLengths` are full lengths, not semi-axes. `RoundedRect2` accepts radius zero as rectangle-equivalent geometry. All sizes must be finite and positive, and rounded radius cannot exceed half the smaller size.
`RegularPolygon2<N>` is a bounded built-in structural parameter (`3 <= N <= 1024`), not general const generics. `Polygon2<T>` admits only the documented constrained variants. Add another named polygon variant only when it supplies meaningful geometric constraints or substantially better engineering dimensions than `Polygon2<Explicit>`.
diff --git a/docs/public/iphone-reconstruction.md b/docs/public/iphone-reconstruction.md
new file mode 100644
index 00000000..adafb7f4
--- /dev/null
+++ b/docs/public/iphone-reconstruction.md
@@ -0,0 +1,24 @@
+# iPhone exterior reconstruction experiment
+
+The [editable blockout](../../fixtures/Experiments/IPhone17ProMax/blockout.firmament) is Pass A of IPHONE-17-PRO-MAX-RECON-X0. It is not a finished reconstruction or a manufacturing model. See the [release evidence](../release/IPHONE-17-PRO-MAX-RECON-X0.md).
+
+`PhoneSpec` and `Standard` own the principal dimensions. Ordinary typed Templates specialize the parts, and an Assembly preserves their names in AP242. Coordinates use the rear-view top-left envelope corner: X points right, Y points up (the phone lies at negative Y), and Z points toward the rear. Body thickness excludes the raised cameras.
+
+```powershell
+dotnet build Aetheris.CLI -c Release
+$cli = Resolve-Path Aetheris.CLI/bin/Release/net10.0/aetheris.exe
+& $cli asm export-ap242 fixtures/Experiments/IPhone17ProMax/blockout.firmament --out artifacts/local/iphone-recon-x0/blockout.step --json
+& $cli analyze compound artifacts/local/iphone-recon-x0/blockout.step --json
+& $cli mesh fixtures/Experiments/IPhone17ProMax/blockout.firmament --format assembly-json --output artifacts/local/iphone-recon-x0/blockout.mesh.json --json
+python scripts/qualify-iphone-recon-x0.py
+```
+
+The preview script needs numpy, Pillow, and matplotlib. Its only geometry input is the CLI's derived mesh. It does not construct or modify product geometry. Front slabs overlap in this blockout; the front preview resolves coplanar faces in the documented display order. STEP remains the geometric artifact.
+
+Hard references are the body envelope, glass/display extents, Detail D camera/sensor centers and diameters, and the 2.55/1.88 mm rear stack. The plateau's 72.76 x 43 mm footprint and 11.5 mm radius are explicit proxies. Body R13.9 is a circular baseline. The notebook does not establish a plateau blend width. Front slabs and rear feature inserts are visual component proxies, not resolved material partitions. Bottom openings are named dark solid markers, not machined cavities or accessory keepouts. No RF, magnetic, or sensor keepout is product material.
+
+Side-control and bottom-detail placements are explicit assembly transforms. For a length variation, update the bottom-detail Y translations along with `ProductLength`; for a width variation update the right-control X translations with `ProductWidth`. This is a known residual coupling, so changing the Record alone does not yet regenerate every exterior detail. Major plate profiles derive directly from the Record.
+
+The [smooth plateau witness](../../fixtures/Experiments/IPhone17ProMax/smooth-plateau-witness.firmament) deliberately fails with `section-chain-g1-degree-limit`. Current public profile authoring supplies lines/arcs; the G1 section-chain materializer requires polynomial normalization for arcs. G2, a refined body, and a refined-versus-blockout comparison are not delivered by this checkpoint.
+
+The supplied PDF remains local. The validated Drawing Notes project is under `artifacts/local/drawing-notes-x1/fresh-agent/notebook/`. Use its canonical `drawing-notes.json` and refreshed Markdown, not stale filtered handoffs. PDF page 2 Detail A supplies corner evidence; Detail D owns the rear layout. Do not infer optical functions from camera numbering.
diff --git a/docs/release/IPHONE-17-PRO-MAX-RECON-X0.md b/docs/release/IPHONE-17-PRO-MAX-RECON-X0.md
new file mode 100644
index 00000000..d467f6cc
--- /dev/null
+++ b/docs/release/IPHONE-17-PRO-MAX-RECON-X0.md
@@ -0,0 +1,118 @@
+# IPHONE-17-PRO-MAX-RECON-X0
+
+## Executive verdict
+
+**Meaningful progression.** Aetheris now builds an editable, dimensionally disciplined primitive exterior assembly from the supplied drawing and notebook. It does **not yet** demonstrate a convincing continuity-refined iPhone exterior. Pass B is blocked at a concrete public-authoring/materializer boundary; no G2 capability or refined STEP is claimed.
+
+The real blocker removed was dimensional arithmetic in closed boundaries and extrusion intervals after Template specialization. The new model uses ordinary `PhoneSpec`, Templates, profiles, and the Assembly/AP242 path. No imported phone CAD, traced mesh, second geometric executor, or rational surface was introduced.
+
+## Sources and construction
+
+Source PDF: user-supplied `iphone-17-pro-max.pdf`, SHA-256 `47bcbc8d562cda09aa96cc96db04df9246634175a19974077d16729db38996f4`. Its instructions for accessory designers are reference content, not instructions to this task. The PDF is not checked in.
+
+The canonical DRAWING-NOTES-X1 JSON validated with a matching source hash and no structural issues. Source-linked dimensions supplied the envelope, front regions, rear centers, apertures, and Z stack. Page 2 was visually reviewed; Detail A was freshly cropped through Aetheris Drawing. Coordinates are rear-view X right, Y up, origin at the upper-left product envelope, Z toward rear. Local-to-product datum alignment is an explicit reconstruction interpretation.
+
+| Reference | Use | Realized value (mm) |
+|---|---|---|
+| MainFrontView / RightSideView | Hard body envelope | 77.98 x 163.43 x 8.75 |
+| MainFrontView | Hard glass extent | 75.58 x 161.03 |
+| MainFrontView | Hard active display extent | 72.86 x 158.31 |
+| Detail D camera 1 | Hard center / diameter | (14.37, -14.37), 16.20 |
+| Detail D camera 2 | Hard center / diameter | (14.37, -33.61), 16.20 |
+| Detail D camera 3 | Hard center / diameter | (32.36, -23.99), 16.20 |
+| Detail D flash | Hard center / diameter | (64.16, -13.82), 6.80 |
+| Detail D rear sensor | Hard center / diameter | (64.16, -34.16), 6.65 |
+| Detail D rear mic | Hard center / diameter | (64.16, -23.99), 1.15 |
+| Detail A | Hard rear stack | plateau +2.55; camera glass +1.88 |
+| Detail A ordinate stack | Soft paired samples | Seven points below |
+| Plateau footprint | Explicit proxy | 72.76 x 43, R11.5; center (38.99,-23.99) |
+
+The camera maximum Z is 13.18 mm. The 8.75 mm body thickness excludes this rear stack. The body uses an R13.9 circular planform baseline. Plates, circles/cylinders, and slots remain primitive. Front layers overlap as display proxies; the assembly is not a resolved disjoint material partition. The plateau touches the rear body but is a separate occurrence. Side controls use simple extruded slots. Bottom openings are named dark solid markers, not cavities. Small depths, some control/connector details, and the plateau footprint are approximations; sub-0.25 mm accuracy is not claimed for them. Keepouts remain in the notebook and are not physical solids.
+
+Source: [blockout.firmament](../../fixtures/Experiments/IPhone17ProMax/blockout.firmament). Usage and variation rules: [reconstruction guide](../public/iphone-reconstruction.md).
+
+## Blockout and visual review
+
+The production CLI derived 9,356 triangles for preview from 17 exact definitions and 29 occurrences. Neutral previews were generated from these triangles, without changing geometry. Front coplanar layers use explicit display-order depth tie-breaking; this rendering convention does not resolve the overlapping product solids.
+
+Local evidence is under `artifacts/local/iphone-recon-x0/`:
+
+| View | Artifact |
+|---|---|
+| Front | `blockout-front.png` |
+| Rear | `blockout-rear.png` |
+| Side | `blockout-side.png` |
+| Three-quarter | `blockout-three-quarter.png` |
+| Camera detail | `blockout-camera-closeup.png` |
+| Corner detail | `blockout-corner-closeup.png` |
+| Drawing crop | `detail-a.png` with source/hash metadata |
+| Equation comparison | `corner-fit.png` and `corner-fit.json` |
+
+![Primitive three-quarter checkpoint](../../artifacts/local/iphone-recon-x0/blockout-three-quarter.png)
+
+**Does it look like the reference phone?** The proportion and rear three-camera layout are recognizable, but it does not yet meet the requested industrial-design visual standard. The body edge is square in section; the plateau has an abrupt wall; lens elements are plain disks; the circular corners differ from the published smooth profile; the lower back panel, lens ring detail, and resolved openings are absent. Flat neutral shading makes these shortcomings visible.
+
+There is no refined geometry or same-view refined comparison. In particular, no image is labeled as a G2 result. The baseline plateau is an abrupt primitive extrusion, not a claimed constant-radius fillet witness.
+
+## Corner fit evidence
+
+The newly recorded symmetric sample pairing uses positive distances inward from the top-left envelope. Its confidence is Medium because the crowded extension-line association remains interpretive. No sample polyline is used as product geometry.
+
+The one-parameter candidate is `(1-x/L)^n + (1-y/L)^n = 1`, with fixed `L=19.43 mm`, fitted `n=3.465300556386242`. The objective is vertical ordinate RMS at the published X values; it is not orthogonal distance and is sensitive near the vertical tangent.
+
+| X | Published Y | Fitted Y | Signed deviation |
+|---:|---:|---:|---:|
+| 0 | 19.43 | 19.43 | 0 |
+| 0.04 | 13.90 | 14.766862 | +0.866862 |
+| 0.92 | 8.46 | 8.090367 | -0.369633 |
+| 3.80 | 3.80 | 3.256372 | -0.543628 |
+| 8.46 | 0.92 | 0.814665 | -0.105335 |
+| 13.90 | 0.04 | 0.072368 | +0.032368 |
+| 19.43 | 0 | 0 | 0 |
+
+Maximum absolute deviation: **0.866862 mm**. RMS: **0.413306 mm**. The analytic law has tangent and zero-curvature matches to straight sides for `n>2`; this is a property of the equation, not verified continuity of a realized CAD body. The candidate is not promoted as the refined solution. The circular blockout is G1 around its line/arc planform joins, with curvature jumps; extrusion caps and plateau steps meet at G0.
+
+![Unqualified equation fit against drawing samples](../../artifacts/local/iphone-recon-x0/corner-fit.png)
+
+## Isolated surfacing blocker
+
+The [minimal smooth plateau witness](../../fixtures/Experiments/IPhone17ProMax/smooth-plateau-witness.firmament) uses a rounded profile and two framed sections. The real CLI rejects its four corner spans with:
+
+```text
+section-chain-g1-degree-limit:Base->Top/BottomRightCorner:
+G1 currently admits line and polynomial B-spline profile spans;
+circular arcs require a future bounded polynomial normalization.
+```
+
+`SectionChainAuthoringParser.Convert` currently accepts line and circular-arc profile curves. `SmoothSectionChains` admits lines and compatible non-rational polynomial spans for G1 and rejects circular arcs. Thus the available authored curved profiles cannot enter this smooth transition path. G2 boundary derivative constraints and a plateau-to-body join are additional unimplemented work; solving arc normalization alone would not complete the requested G2 blend.
+
+Continuing by bypassing Firmament with phone-specific BRep patches would undermine the editable semantic deliverable. The next bounded capability should connect equation-driven polynomial profile semantics to the existing section/surface authority, with positional/tangent/curvature evidence and independent planar-step, convex, concave, and plateau witnesses. That capability is not fabricated in this checkpoint.
+
+## Export, reimport, and parameter evidence
+
+- AP242 exports 29 occurrences and 17 shared definitions; reimport preserves those counts and named hierarchy.
+- Every reimported definition reports `enclosed-manifold` using the CLI's directed coedge/incidence assessment. This does not establish a fused, non-overlapping phone body.
+- Body STEP bounds are exactly `[0,-163.43,0]` to `[77.98,0,8.75]`. Rear-camera bounding boxes recover the listed centers and 16.20 mm diameters within floating-point noise. Surfaces are planes/cylinders; no B-spline or rational surfaces were introduced.
+- A freshly packed `Aetheris.CLI.2.0.0-preview.3.nupkg` was installed into a temporary tool directory and executed from a separate temporary directory outside the repository. Two builds and the repository build share STEP SHA-256 `414FCFF7A0537BA97417C404AEF3F2DDA2BEB5513C6411E1CF12EA1BAC11E6C7`.
+- A fresh agent changed length to 165.43 mm and shifted the 13 bottom markers by -2 mm. Reimport recovered the increased body length, unchanged camera bounds, unchanged profile families, 29 occurrences/17 definitions, and all 17 enclosed-manifold definitions. The variation proves the blockout only. The manual placement coupling remains documented.
+- Body XY and plateau transverse sections were exported. The camera transverse section returned `Section has no bounded geometry to render`; a camera XY section at Z=12 mm succeeded. Full requested centerline/continuity section comparison is therefore incomplete.
+
+Raw evidence: `part-checks.json`, `body-analysis.json`, `packaged-compound.json`, `packaged-reimport.json`, `body-section.*`, `plateau-section.*`, `camera-section.*`, and `variation/result.json` in the local output directory. The importer currently reports millimetres as assumed rather than preserved; source/export are authored in mm, so no general unit-import claim is made.
+
+## Drawing Notes feedback
+
+The canonical notebook supplied at least 20 needed dimensions without individual PDF rediscovery. This is a count of reused values, not a measured time saving. One whole-sheet review and one fresh Detail A crop were needed for silhouette, profile sample association, and unresolved plateau interpretation.
+
+The filtered `detail-d-handoff.md` was stale and had reversed X signs, while canonical JSON/Markdown were already corrected. It was regenerated from the canonical notebook. Two source-linked notes were added: `ReconX0.CornerSamples` and `ReconX0.PlateauProxy`, preserving Medium/Low confidence and the unresolved blend width. These discoveries are also recorded here so they survive deletion of local artifacts.
+
+The dimension graph is sufficient for a blockout, not for smooth profile or blend construction. Useful future improvements are export freshness/source-revision metadata, explicit datum transforms, ordered sample-pair groups, and machine-readable confidence on geometric interpretations. No optical role was assigned to numbered cameras.
+
+## Validation
+
+Release solution build passed with zero warnings/errors. The solution test run passed the 1,518 Firmament, 443 CLI (including documentation contracts), 13 Drawing, and surfacing/module tests. One existing Core timing assertion failed under the concurrent solution run: facade 13.241 ms versus direct recipe 207.987 ms. Its isolated three-case rerun passed. This is recorded as a test-run failure and successful isolated rerun, not an entirely green first run. The FrictionLab assembly has no discoverable tests.
+
+The new focused tests prove arithmetic/literal STEP equivalence and rejection of incompatible units, unresolved names, and division by zero. They prevent the previous numeric-prefix acceptance. Documentation links and repository layout are checked alongside `git diff --check`.
+
+## Remaining acceptance work
+
+Pass B, a better-qualified corner family, the plateau blend, body edge finishing, actual bottom cavities, non-overlapping front material partitions, automatic placement dependencies, full centerline sections, four G2 witnesses, and final identical-view comparisons remain open. No showcase publication was performed. This is a bounded progression checkpoint, not Attempt-1 acceptance.
diff --git a/fixtures/Experiments/IPhone17ProMax/blockout.firmament b/fixtures/Experiments/IPhone17ProMax/blockout.firmament
new file mode 100644
index 00000000..74f80134
--- /dev/null
+++ b/fixtures/Experiments/IPhone17ProMax/blockout.firmament
@@ -0,0 +1,184 @@
+// Pass A exterior blockout. Rear-view datum: X right, Y up, Z toward rear.
+Record PhoneSpec {
+ ProductWidth: Length
+ ProductLength: Length
+ ProductThickness: Length
+ BodyCornerRadius: Length
+ CameraPlateauWidth: Length
+ CameraPlateauHeight: Length
+ CameraPlateauRise: Length
+ CameraGlassRise: Length
+ CameraDiameter: Length
+ CameraLeftX: Length
+ CameraMiddleX: Length
+ CameraRightX: Length
+}
+Static Standard: PhoneSpec = PhoneSpec {
+ ProductWidth: 77.98mm
+ ProductLength: 163.43mm
+ ProductThickness: 8.75mm
+ BodyCornerRadius: 13.90mm
+ CameraPlateauWidth: 72.76mm
+ CameraPlateauHeight: 43mm
+ CameraPlateauRise: 2.55mm
+ CameraGlassRise: 1.88mm
+ CameraDiameter: 16.20mm
+ CameraLeftX: 14.37mm
+ CameraMiddleX: 32.36mm
+ CameraRightX: 64.16mm
+}
+
+Template < Spec: PhoneSpec > Struct BodyPart {
+ RoundedRect2 Outline { Center: [Spec.ProductWidth / 2,-Spec.ProductLength / 2] Size: [Spec.ProductWidth,Spec.ProductLength] Radius: Spec.BodyCornerRadius }
+ Profile Section { Loop Outer { Outline |> TraceLoop } }
+ Extrude Solid { Profile: Section From: 0mm To: Spec.ProductThickness }
+}
+Template < Spec: PhoneSpec > Struct FrontGlassPart {
+ RoundedRect2 Outline { Center: [Spec.ProductWidth / 2,-Spec.ProductLength / 2] Size: [Spec.ProductWidth - 2.40mm,Spec.ProductLength - 2.40mm] Radius: Spec.BodyCornerRadius - 1.20mm }
+ Profile Section { Loop Outer { Outline |> TraceLoop } }
+ Extrude Solid { Profile: Section From: 0mm To: 0.10mm }
+}
+Template < Spec: PhoneSpec > Struct DisplayPart {
+ RoundedRect2 Outline { Center: [Spec.ProductWidth / 2,-Spec.ProductLength / 2] Size: [Spec.ProductWidth - 5.12mm,Spec.ProductLength - 5.12mm] Radius: Spec.BodyCornerRadius - 2.56mm }
+ Profile Section { Loop Outer { Outline |> TraceLoop } }
+ Extrude Solid { Profile: Section From: 0mm To: 0.05mm }
+}
+Template < Spec: PhoneSpec > Struct FrontSensorPart {
+ Slot2 Outline { Center: [Spec.ProductWidth / 2,-7.91mm] Length: 20.76mm Width: 6.07mm }
+ Profile Section { Loop Outer { Outline |> TraceLoop } }
+ Extrude Solid { Profile: Section From: 0mm To: 0.02mm }
+}
+Template < Spec: PhoneSpec > Struct CameraPlateauPart {
+ RoundedRect2 Outline { Center: [Spec.ProductWidth / 2,-23.99mm] Size: [Spec.CameraPlateauWidth,Spec.CameraPlateauHeight] Radius: 11.5mm }
+ Profile Section { Loop Outer { Outline |> TraceLoop } }
+ Extrude Solid { Profile: Section From: Spec.ProductThickness To: Spec.ProductThickness + Spec.CameraPlateauRise }
+}
+Template < Spec: PhoneSpec > Struct RearCamera1Part {
+ Circle2 Outline { Center: [Spec.CameraLeftX,-14.37mm] Diameter: Spec.CameraDiameter }
+ Profile Section { Loop Outer { Outline |> TraceLoop } }
+ Extrude Solid { Profile: Section From: Spec.ProductThickness + Spec.CameraPlateauRise To: Spec.ProductThickness + Spec.CameraPlateauRise + Spec.CameraGlassRise }
+}
+Template < Spec: PhoneSpec > Struct RearCamera2Part {
+ Circle2 Outline { Center: [Spec.CameraLeftX,-33.61mm] Diameter: Spec.CameraDiameter }
+ Profile Section { Loop Outer { Outline |> TraceLoop } }
+ Extrude Solid { Profile: Section From: Spec.ProductThickness + Spec.CameraPlateauRise To: Spec.ProductThickness + Spec.CameraPlateauRise + Spec.CameraGlassRise }
+}
+Template < Spec: PhoneSpec > Struct RearCamera3Part {
+ Circle2 Outline { Center: [Spec.CameraMiddleX,-23.99mm] Diameter: Spec.CameraDiameter }
+ Profile Section { Loop Outer { Outline |> TraceLoop } }
+ Extrude Solid { Profile: Section From: Spec.ProductThickness + Spec.CameraPlateauRise To: Spec.ProductThickness + Spec.CameraPlateauRise + Spec.CameraGlassRise }
+}
+Template < Spec: PhoneSpec > Struct FlashPart {
+ Circle2 Outline { Center: [Spec.CameraRightX,-13.82mm] Diameter: 6.80mm }
+ Profile Section { Loop Outer { Outline |> TraceLoop } }
+ Extrude Solid { Profile: Section From: Spec.ProductThickness + Spec.CameraPlateauRise To: Spec.ProductThickness + Spec.CameraPlateauRise + 0.02mm }
+}
+Template < Spec: PhoneSpec > Struct RearSensorPart {
+ Circle2 Outline { Center: [Spec.CameraRightX,-34.16mm] Diameter: 6.65mm }
+ Profile Section { Loop Outer { Outline |> TraceLoop } }
+ Extrude Solid { Profile: Section From: Spec.ProductThickness + Spec.CameraPlateauRise To: Spec.ProductThickness + Spec.CameraPlateauRise + 0.02mm }
+}
+Template < Spec: PhoneSpec > Struct RearMicPart {
+ Circle2 Outline { Center: [Spec.CameraRightX,-23.99mm] Diameter: 1.15mm }
+ Profile Section { Loop Outer { Outline |> TraceLoop } }
+ Extrude Solid { Profile: Section From: Spec.ProductThickness + Spec.CameraPlateauRise To: Spec.ProductThickness + Spec.CameraPlateauRise + 0.02mm }
+}
+// Simple side controls and dark opening proxies; local XY maps onto the side face.
+Template < L: Length, W: Length, T: Length > Struct SideDetail {
+ Slot2 Outline { Center: [0mm,0mm] Length: L Width: W }
+ Profile Section { Loop Outer { Outline |> TraceLoop } }
+ Extrude Solid { Profile: Section From: 0mm To: T }
+}
+Assembly IPhone17ProMax {
+ <Assembly IPhone17ProMax>
+ <Part Body = BodyPart<Spec: Standard>>
+ Placement LegacyExplicit = [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];
+ </Part>
+ <Part FrontGlass = FrontGlassPart<Spec: Standard>>
+ Placement LegacyExplicit = [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];
+ </Part>
+ <Part Display = DisplayPart<Spec: Standard>>
+ Placement LegacyExplicit = [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];
+ </Part>
+ <Part FrontSensor = FrontSensorPart<Spec: Standard>>
+ Placement LegacyExplicit = [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];
+ </Part>
+ <Part CameraPlateau = CameraPlateauPart<Spec: Standard>>
+ Placement LegacyExplicit = [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];
+ </Part>
+ <Part RearCamera1 = RearCamera1Part<Spec: Standard>>
+ Placement LegacyExplicit = [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];
+ </Part>
+ <Part RearCamera2 = RearCamera2Part<Spec: Standard>>
+ Placement LegacyExplicit = [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];
+ </Part>
+ <Part RearCamera3 = RearCamera3Part<Spec: Standard>>
+ Placement LegacyExplicit = [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];
+ </Part>
+ <Part Flash = FlashPart<Spec: Standard>>
+ Placement LegacyExplicit = [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];
+ </Part>
+ <Part RearSensor = RearSensorPart<Spec: Standard>>
+ Placement LegacyExplicit = [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];
+ </Part>
+ <Part RearMic = RearMicPart<Spec: Standard>>
+ Placement LegacyExplicit = [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];
+ </Part>
+ <Part ActionButton = SideDetail<L: 6.9mm, W: 2.66mm, T: 0.45mm>>
+ Placement LegacyExplicit = [0,-1,0,0,0,0,1,0,-1,0,0,0,0,-34.28,4.375,1];
+ </Part>
+ <Part VolumeUp = SideDetail<L: 11.2mm, W: 2.66mm, T: 0.45mm>>
+ Placement LegacyExplicit = [0,-1,0,0,0,0,1,0,-1,0,0,0,0,-48.43,4.375,1];
+ </Part>
+ <Part VolumeDown = SideDetail<L: 11.2mm, W: 2.66mm, T: 0.45mm>>
+ Placement LegacyExplicit = [0,-1,0,0,0,0,1,0,-1,0,0,0,0,-62.63,4.375,1];
+ </Part>
+ <Part SideButton = SideDetail<L: 17.7mm, W: 2.66mm, T: 0.45mm>>
+ Placement LegacyExplicit = [0,1,0,0,0,0,1,0,1,0,0,0,77.98,-55.53,4.375,1];
+ </Part>
+ <Part CameraControl = SideDetail<L: 17.1mm, W: 3.13mm, T: 0.02mm>>
+ Placement LegacyExplicit = [0,1,0,0,0,0,1,0,1,0,0,0,77.98,-111.82,4.375,1];
+ </Part>
+ <Part ConnectorOpeningProxy = SideDetail<L: 9.0mm, W: 3.12mm, T: 0.02mm>>
+ Placement LegacyExplicit = [1,0,0,0,0,0,1,0,0,-1,0,0,38.99,-163.43,4.375,1];
+ </Part>
+ <Part PortOpeningProxy1 = SideDetail<L: 1.53mm, W: 1.53mm, T: 0.02mm>>
+ Placement LegacyExplicit = [1,0,0,0,0,0,1,0,0,-1,0,0,15.48,-163.43,4.375,1];
+ </Part>
+ <Part PortOpeningProxy2 = SideDetail<L: 1.53mm, W: 1.53mm, T: 0.02mm>>
+ Placement LegacyExplicit = [1,0,0,0,0,0,1,0,0,-1,0,0,17.96,-163.43,4.375,1];
+ </Part>
+ <Part PortOpeningProxy3 = SideDetail<L: 1.53mm, W: 1.53mm, T: 0.02mm>>
+ Placement LegacyExplicit = [1,0,0,0,0,0,1,0,0,-1,0,0,20.44,-163.43,4.375,1];
+ </Part>
+ <Part PortOpeningProxy4 = SideDetail<L: 1.53mm, W: 1.53mm, T: 0.02mm>>
+ Placement LegacyExplicit = [1,0,0,0,0,0,1,0,0,-1,0,0,22.92,-163.43,4.375,1];
+ </Part>
+ <Part PortOpeningProxy5 = SideDetail<L: 1.53mm, W: 1.53mm, T: 0.02mm>>
+ Placement LegacyExplicit = [1,0,0,0,0,0,1,0,0,-1,0,0,25.4,-163.43,4.375,1];
+ </Part>
+ <Part PortOpeningProxy6 = SideDetail<L: 1.53mm, W: 1.53mm, T: 0.02mm>>
+ Placement LegacyExplicit = [1,0,0,0,0,0,1,0,0,-1,0,0,32.09,-163.43,4.375,1];
+ </Part>
+ <Part PortOpeningProxy7 = SideDetail<L: 1.53mm, W: 1.53mm, T: 0.02mm>>
+ Placement LegacyExplicit = [1,0,0,0,0,0,1,0,0,-1,0,0,45.08,-163.43,4.375,1];
+ </Part>
+ <Part PortOpeningProxy8 = SideDetail<L: 1.53mm, W: 1.53mm, T: 0.02mm>>
+ Placement LegacyExplicit = [1,0,0,0,0,0,1,0,0,-1,0,0,51.3,-163.43,4.375,1];
+ </Part>
+ <Part PortOpeningProxy9 = SideDetail<L: 1.53mm, W: 1.53mm, T: 0.02mm>>
+ Placement LegacyExplicit = [1,0,0,0,0,0,1,0,0,-1,0,0,53.56,-163.43,4.375,1];
+ </Part>
+ <Part PortOpeningProxy10 = SideDetail<L: 1.53mm, W: 1.53mm, T: 0.02mm>>
+ Placement LegacyExplicit = [1,0,0,0,0,0,1,0,0,-1,0,0,55.81,-163.43,4.375,1];
+ </Part>
+ <Part PortOpeningProxy11 = SideDetail<L: 1.53mm, W: 1.53mm, T: 0.02mm>>
+ Placement LegacyExplicit = [1,0,0,0,0,0,1,0,0,-1,0,0,58.07,-163.43,4.375,1];
+ </Part>
+ <Part PortOpeningProxy12 = SideDetail<L: 1.53mm, W: 1.53mm, T: 0.02mm>>
+ Placement LegacyExplicit = [1,0,0,0,0,0,1,0,0,-1,0,0,60.32,-163.43,4.375,1];
+ </Part>
+ </Assembly>
+ Anchor: IPhone17ProMax;
+}
+
diff --git a/fixtures/Experiments/IPhone17ProMax/smooth-plateau-witness.firmament b/fixtures/Experiments/IPhone17ProMax/smooth-plateau-witness.firmament
new file mode 100644
index 00000000..a49cac05
--- /dev/null
+++ b/fixtures/Experiments/IPhone17ProMax/smooth-plateau-witness.firmament
@@ -0,0 +1,25 @@
+// Minimal public-authoring probe: expected section-chain-g1-degree-limit.
+// No claim that this is the phone's finished plateau or a G2 transition.
+Model SmoothPlateauWitness {
+ Units: mm
+ Concept Struct Frames {
+ Base: Plane { Origin: [0mm,0mm,0mm] Normal: [0,0,1] Up: [0,1,0] }
+ Top: Plane { Origin: [0mm,0mm,2.55mm] Normal: [0,0,1] Up: [0,1,0] }
+ }
+ Construction Plane BaseFrame { Trace: Frames.Base }
+ Construction Plane TopFrame { Trace: Frames.Top }
+ RoundedRect2 BaseOutline { Center: [0mm,0mm] Size: [72.76mm,43mm] Radius: 11.5mm }
+ Profile BaseProfile { Loop Outer { BaseOutline |> TraceLoop } }
+ SectionChain Transition {
+ Continuity: G1
+ Section Base { Frame: BaseFrame
+ Profile: BaseProfile
+ Seam: Bottom }
+ Section Top { Frame: TopFrame
+ Profile: BaseProfile
+ Seam: Bottom }
+ Start: Cap
+ End: Cap
+ }
+}
+
diff --git a/scripts/qualify-iphone-recon-x0.py b/scripts/qualify-iphone-recon-x0.py
new file mode 100644
index 00000000..a57ee737
--- /dev/null
+++ b/scripts/qualify-iphone-recon-x0.py
@@ -0,0 +1,119 @@
+"""Drawing fit and neutral previews from the CLI's derived assembly mesh (never CAD authority)."""
+import argparse
+import json
+from pathlib import Path
+import numpy as np
+from PIL import Image, ImageDraw
+import matplotlib
+matplotlib.use('Agg')
+import matplotlib.pyplot as plt
+
+parser = argparse.ArgumentParser()
+parser.add_argument('--out', type=Path, default=Path('artifacts/local/iphone-recon-x0'))
+args = parser.parse_args()
+out = args.out
+out.mkdir(parents=True, exist_ok=True)
+
+# PDF p2 Detail A. Positive distances inward from the top-left envelope corner.
+x = np.array([0, .04, .92, 3.80, 8.46, 13.90, 19.43])
+y = x[::-1].copy()
+extent = 19.43
+def fit_y(x, n):
+ return extent * (1 - np.maximum(0, 1 - (1 - np.asarray(x)/extent)**n)**(1/n))
+def loss(n):
+ return np.mean((fit_y(x, n)-y)**2)
+# Bounded golden-section minimization of a single continuous fit parameter.
+lo, hi = 2.01, 5.0
+phi = (5**.5-1)/2
+for _ in range(100):
+ a, b = hi-phi*(hi-lo), lo+phi*(hi-lo)
+ if loss(a) < loss(b): hi=b
+ else: lo=a
+n=(lo+hi)/2
+predicted = fit_y(x, n)
+errors = predicted-y
+result = {'family': '(1-x/L)^n + (1-y/L)^n = 1', 'extentMm': extent,
+ 'exponent': float(n), 'metric': 'vertical ordinate deviation at published X; not normal distance',
+ 'maxDeviationMm': float(max(abs(errors))), 'rmsDeviationMm': float(np.sqrt(loss(n))),
+ 'continuity': 'Analytic family G2 to straight sides for n>2; not materialized in BRep',
+ 'samples': [dict(xMm=float(a), yMm=float(b), fittedYMm=float(c), deviationMm=float(d))
+ for a,b,c,d in zip(x,y,predicted,errors)]}
+(out/'corner-fit.json').write_text(json.dumps(result, indent=2)+'\n')
+t = np.linspace(0, extent, 800)
+r = 13.9
+circle = np.where(t<r, r-np.sqrt(np.maximum(0,r*r-(t-r)**2)), 0)
+fig, ax = plt.subplots(figsize=(6,6))
+ax.plot(t, circle, label='Blockout: R13.9 circular corner', color='#888888')
+ax.plot(t, fit_y(t,n), label=f'Analytic candidate: n={n:.5f}', color='#12689a')
+ax.scatter(x,y,color='#b74a32',label='Detail A paired ordinates', zorder=5)
+ax.set(xlabel='X inward from left envelope (mm)', ylabel='Distance below top envelope (mm)',
+ title='Corner fit candidate - not a refined CAD body', aspect='equal')
+ax.invert_yaxis(); ax.grid(alpha=.2); ax.legend(fontsize=8)
+fig.tight_layout(); fig.savefig(out/'corner-fit.png',dpi=160); plt.close(fig)
+
+mesh=json.loads((out/'blockout.mesh.json').read_text())
+definitions={d['id']: d for d in mesh['definitions']}
+triangles=[]; colors=[]; names=[]
+for occurrence in mesh['occurrences']:
+ if occurrence.get('definitionId') not in definitions: continue
+ d=definitions[occurrence['definitionId']]
+ v=np.array(d['positions']).reshape(-1,3)
+ m=np.array(occurrence['transform']).reshape(4,4)
+ v=(np.c_[v,np.ones(len(v))]@m)[:,:3]
+ ts=v[np.array(d['indices']).reshape(-1,3)]
+ name=occurrence['path'].split('.')[-1]
+ color=('#25323b' if name.startswith('RearCamera') or name in ['RearSensor','RearMic','FrontSensor'] or 'Proxy' in name
+ else '#33434d' if name=='Display' else '#b8bfc4' if name=='CameraPlateau'
+ else '#f3f0df' if name=='Flash' else '#cdd1d4')
+ rgb=np.array(tuple(bytes.fromhex(color[1:])))/255
+ normals=np.cross(ts[:,1]-ts[:,0],ts[:,2]-ts[:,0])
+ lengths=np.linalg.norm(normals,axis=1)
+ normals=normals/np.maximum(lengths[:,None],1e-12)
+ light=np.array([.3,.4,1.]); light/=np.linalg.norm(light)
+ shade=.70+.30*np.abs(normals@light)
+ triangles.extend(ts); colors.extend(rgb[None,:]*shade[:,None]); names.extend([name]*len(ts))
+triangles=np.array(triangles); colors=np.array(colors); names=np.array(names)
+
+def render(label, direction, crop=None, front=False):
+ forward=np.array(direction,dtype=float); forward/=np.linalg.norm(forward)
+ up=np.array([0.,1.,0.])
+ right=np.cross(up,forward); right/=np.linalg.norm(right)
+ up=np.cross(forward,right)
+ tri=triangles.copy(); col=colors.copy()
+ # Front component slabs overlap by design in this blockout. Show their exposed
+ # front faces in declared display order; all vertices still come from CLI geometry.
+ mask=np.ones(len(tri),dtype=bool)
+ if front:
+ mask &= ~np.isin(names,['CameraPlateau','RearCamera1','RearCamera2','RearCamera3','Flash','RearMic','RearSensor'])
+ tri=tri[mask]; col=col[mask]; ns=names[mask]
+ [email protected]([right,up,forward]).T
+ lo=q[:,:,:2].min(axis=(0,1)); hi=q[:,:,:2].max(axis=(0,1))
+ if crop is not None: lo=np.array(crop[:2]); hi=np.array(crop[2:])
+ size=np.array([850,1050]); scale=min((size-80)/(hi-lo)); center=(hi+lo)/2
+ q[:,:,:2]=(q[:,:,:2]-center)*scale+size/2
+ q[:,:,1]=size[1]-q[:,:,1]
+ depth=np.full((size[1],size[0]),-np.inf); pixels=np.full((size[1],size[0],3),247,dtype=np.uint8)
+ for t,c,name in zip(q,col,ns):
+ mn=np.maximum(0,np.floor(t[:,:2].min(axis=0)).astype(int)); mx=np.minimum(size-1,np.ceil(t[:,:2].max(axis=0)).astype(int))
+ if np.any(mx<mn): continue
+ a,b,d=t
+ den=(b[1]-d[1])*(a[0]-d[0])+(d[0]-b[0])*(a[1]-d[1])
+ if abs(den)<1e-9: continue
+ xx,yy=np.meshgrid(np.arange(mn[0],mx[0]+1)+.5,np.arange(mn[1],mx[1]+1)+.5)
+ u=((b[1]-d[1])*(xx-d[0])+(d[0]-b[0])*(yy-d[1]))/den
+ v=((d[1]-a[1])*(xx-d[0])+(a[0]-d[0])*(yy-d[1]))/den
+ w=1-u-v; z=u*a[2]+v*b[2]+w*d[2]
+ if front: z=z+{'FrontGlass':.001,'Display':.002,'FrontSensor':.003}.get(name,0)
+ region=depth[mn[1]:mx[1]+1,mn[0]:mx[0]+1]
+ visible=(u>=0)&(v>=0)&(w>=0)&(z>region)
+ region[visible]=z[visible]
+ pixels[mn[1]:mx[1]+1,mn[0]:mx[0]+1][visible]=np.clip(c*255,0,255).astype(np.uint8)
+ im=Image.fromarray(pixels); draw=ImageDraw.Draw(im)
+ draw.text((20,15),'PASS A | '+label+' | CLI-derived geometry',fill='#30363b')
+ im.save(out/('blockout-'+label+'.png'))
+
+render('rear',[0,0,1]); render('front',[0,0,-1],front=True)
+render('side',[1,0,0]); render('three-quarter',[1,-.65,2])
+render('camera-closeup',[0,0,1],[-3,-51,81,3])
+render('corner-closeup',[0,0,1],[-2,-23,23,2])
+print(json.dumps(result,indent=2))