diff --git a/surfaces/blender/brokkr_reference/brokkr_actions.json b/surfaces/blender/brokkr_reference/brokkr_actions.json index 38499c6..d86e468 100644 --- a/surfaces/blender/brokkr_reference/brokkr_actions.json +++ b/surfaces/blender/brokkr_reference/brokkr_actions.json @@ -177,7 +177,7 @@ }, { "name": "brokkr_reference.block_plate", - "doc": "Block a plate's first free cage from traces of its outline, each seen through a scene camera and naming the two consecutive corners it runs between: the only correspondence is a trace's ends to its corners. The crown (the corners and each side's points between) is solved until the sides as built draw on the traces; a side whose trace is not explained gains a point, up to 6. Depth comes from the views where two see a corner 9.7 degrees or more apart, from x = 0 for a mirrored plate's seam corners, and otherwise from a plane: the one given, or the one through the corners the views and the seam decide. Each corner says which (decided_by views, mirror or plane; views means the prior's share is under 0.2). A corner one view sees is refused when the plane stands over 66 degrees off that view. Returns the sheet for brokkr_kitbash.shell, checked by its parser, and fit_traces for brokkr_reference.fit_shell (left_out lists the traces fit_shell cannot state: another frame, or a partner's side -1). Writes nothing (docs/reference.md).", + "doc": "Block a plate's first free cage from traces of its outline, each seen through a scene camera and naming the two consecutive corners it runs between: the only correspondence is a trace's ends to its corners. The crown (the corners and each side's points between) is solved until the sides as built draw on the traces; a side whose trace is not explained gains a point, up to 6. Depth comes from the views where two see a corner and a pixel moves their meeting point less than share x the plate's extent, from x = 0 for a mirrored plate's seam corners whose view crosses it, and otherwise from a plane: the one given, or the one through the corners the views and the seam decide. Every corner, and every point between corners (sides[].inner), says what decided it by its prior_share: plane from 0.2 up, else mirror on the seam, else views; a side says corners, views, mirror or plane. A corner one view sees, a seam corner seen along x = 0 included, is refused when the plane stands over 66 degrees off that view. Returns the sheet for brokkr_kitbash.shell, checked by its parser, and fit_traces for brokkr_reference.fit_shell (left_out lists the traces fit_shell cannot state: another frame, or a partner's side -1). Writes nothing (docs/reference.md).", "changesScene": true, "editModeSafe": false, "result": "brokkr_mesh_polish_result", diff --git a/surfaces/blender/brokkr_reference/core.py b/surfaces/blender/brokkr_reference/core.py index 6e808d1..f34c73d 100644 --- a/surfaces/blender/brokkr_reference/core.py +++ b/surfaces/blender/brokkr_reference/core.py @@ -43,7 +43,7 @@ is solved by fit_runs with a plane and fairness for its prior; docs/reference.md triangulate(obs, seam) where sight lines meet, and how far apart they stand plate_sheet(crown, corners, flare, drop, dome, mirror, seam, facing) the crown, skirt and centre free-cage document - block_plate(views, plate, traces, parse, plane, share, tol) the blocked sheet and what decided each corner + block_plate(views, plate, traces, parse, plane, share, tol) the blocked sheet and what decided each crown point """ from __future__ import annotations @@ -882,7 +882,15 @@ def block_plate(views, plate, traces, parse, plane=None, share=0.1, tol=TOL): plane, so the views decide wherever they see. A side starts as its two corners; a side with a trace not explained gains a point and the plate is solved again, to K_MAX points. Skirt and centre are rebuilt from the solved crown (plate_sheet). Returns {"sheet", "fit_traces", "left_out", "corners", "sides", "plane", "rounds"}; - raises ReferenceFitError naming the field for everything it refuses.""" + raises ReferenceFitError naming the field for everything it refuses. + + A corner starts where its views meet when a pixel moves that point less than START x share x the plate's + extent; a seam corner where its sight line crosses x = 0, unless the line runs along the plane (SQUARE); any + other on the plane, lifted and guarded by SQUARE. What decided a point is read after the solve from its + prior_share, the same for every crown point: "plane" from VIEWS up (the prior holds its depth: the plane, and + for a side's inner points its fairness), else "mirror" on the seam, else "views". corners[] and each side's + "inner" (its points between corners) carry {"decided_by", "m_per_px", "prior_share"}; a side's own + "decided_by" is "corners" with no inner point, "plane" when any inner point is, else its inner points'.""" if not isinstance(plate, dict) or set(plate) - {"corners", "mirror", "seam"}: raise ReferenceFitError("plate must be {corners, mirror, seam}") names, mirror, seam_names = plate.get("corners"), plate.get("mirror", False), plate.get("seam", []) diff --git a/surfaces/blender/docs/reference.md b/surfaces/blender/docs/reference.md index c9473b1..eed579d 100644 --- a/surfaces/blender/docs/reference.md +++ b/surfaces/blender/docs/reference.md @@ -292,13 +292,20 @@ between them lie on it, and one view decides them. Where a corner's depth comes from, in this order: -- **the views**, where two or more see it and its sight lines stand 9.7 degrees or more apart. Under that the - triangulation is not used as a start: at 5 degrees corners of a 1.2 m plate landed 0.25 to 1.5 m off. -- **the mirror plane**, for a seam corner. +- **the views**, where two or more see it and one pixel moves the point their sight lines meet at less than + `share` x the plate's extent, the prior's own scale. Past that the views alone hold the corner looser than the + plane would and are not used as its start. The line is metres a pixel, so it moves with lens and range: a + 1.2 m plate 17.6 m off at 663 px reads 0.74 of the scale at 19 degrees and 2.77 at 5, where its corners landed + 0.25 to 1.5 m off; through a lens three times as long it reads 0.66 at 7 degrees and blocks. +- **the mirror plane**, for a seam corner whose sight line crosses x = 0 at 24 degrees or more. - **a plane**, for the rest: `plane` (`x,y,z; nx,ny,nz`, a point and the normal, in the frame), or with none given the plane through the corners the views and the seam decide, three or more. A corner one view sees is lifted onto it, and refused when the plane stands more than 66 degrees off square-on to that view: the lift stretches - past 2.5 times there. + past 2.5 times there. A seam corner whose one view runs along x = 0 is such a corner: it is lifted onto the + plane, held on x = 0, and refused by the same 66 degrees. + +That is where a corner starts. What the report says decided it is read after the solve, from the point's own +prior share, whatever kind of point it is. The crown is then solved by the same solver as `fit_shell`, with a different prior: each crown point's distance to the plane costs a pixel per `share` x the corners' extent, and each side's second differences a pixel per 0.2 @@ -307,7 +314,9 @@ and a view that sees nothing along its own sight line leaves that to the plane. corners. After each solve a side with a trace not explained (the same nine tenths within `tol`) gains one point and the plate is solved again, to six points a side; past that it is refused as `fit_shell` refuses a trace. -The cage is the crown ring, a skirt 0.06 m out and 0.07 m back of it, and one centre vertex: every crown side +The cage is the crown ring, a skirt 0.05 of the crown's extent out and 0.06 back of it, and one centre vertex +0.017 proud (the extent is the distance between the crown's two furthest points, so a plate of any size has the +same proportions): every crown side creased 1, the named corners pinned, the centre the declared pole unless the crown has four points. On a mirrored plate the seam's sides have no skirt and the seam's two ends are poles too. The skirt and centre are rebuilt from the solved crown and never solved. The sheet goes through `brokkr_kitbash`'s parser before it is @@ -315,9 +324,16 @@ returned, and `brokkr_kitbash.shell` builds it; `block_plate` writes nothing. The report: `sheet`; `fit_traces`, the traces as `fit_shell` takes them (each side a run of authored vertices), and `left_out`, the traces `fit_shell` cannot state (one with its own `frame`, or a partner's side -1 on a plate -that is not mirrored); per corner `decided_by` (`views` when the prior's share is under 0.2, `mirror` on the seam, -else `plane`), `parallax_deg`, `m_per_px` and `prior_share`; per side its points and each trace's readings; -`plane` with `from` `given` or `corners`; `rounds`, the solves it took. +that is not mirrored); per corner `decided_by`, `parallax_deg`, `m_per_px` and `prior_share`; per side its +points, each trace's readings, `inner` (the same `decided_by`, `m_per_px` and `prior_share` for each point between +its corners) and its own `decided_by`; `plane` with `from` `given` or `corners`; `rounds`, the solves it took. + +`decided_by` is read from `prior_share` for every crown point: `plane` from 0.2 up, the prior (the plane, and +for a side's inner points its fairness) holding the depth; under 0.2 `mirror` for a point on the seam and +`views` for any other. A seam corner seen from 10 degrees off the mirror plane reads `plane` (0.57), not +`mirror`. A side says `corners` when it has no point of its own, `plane` when any inner point does, else what +its inner points say: a side can read as explained to 0.1 px and stand 53 mm off with its one inner point at +0.41, and then it says `plane`. Refused, naming the field: a corner no trace ends at, a side traced in no view, a trace whose corners are not consecutive, an unknown camera, a scaled frame, a seam that is not one stretch of the outline, no plane where @@ -325,23 +341,54 @@ fewer than three corners are decided, the 66 degrees, a mirrored plate's corner from the others (name it in `seam`, or trace it where the views agree), a side not explained at six points, a sheet the cage's parser does not take, and a result that could pass the 16000 characters a receipt carries. -Measured (`tests/test_reference.py` BlockTests, Python 3.13 on Starfire). SPECTRE's roof from no blocking: the -ridge, traced in the side view alone, 7.3 mm at most from the cage `fit_shell` had fitted from a hand blocking; -the brow, traced in the hero's mirrored half and the side 62.8 degrees apart, a median of 8.4 mm and 78.6 mm at -most from it, in four points; 0.05 s. A twisted pentagon 1.2 m across with sides bowed 8% toward the camera, -17.6 m off at 663 px: 39 and 52 mm from the truth at 60 degrees with traces 0.5 and 1.5 px off, every corner -decided by the views; 65 and 135 mm at 19 degrees, where the plane already has 0.30 to 0.38 of each corner. At -that range and lens two views 19 degrees apart do not decide a corner by this report's own line. -Paladin's 16 plates, each a polygon traced in one view with the plane its agent gave: every corner decided by the -plane, the crown within 1 mm of the one the harness had lifted. Its two thigh shields traced as partners are -refused, a side 19 px unexplained: the sheet draws two different polygons, not one plate and its reflection. +Measured against a known truth (`tests/test_reference.py` BlockTests, Python 3.13 on Starfire; +`tests/fixtures/spectre_truth.json`). SPECTRE's pass-3 roof, a hard mirrored cage of 11 vertices, was built by +`brokkr_kitbash.shell`, rendered in Blender 5.3 through SPECTRE's two solved cameras at the sheet's pixel size, +and its edges traced off the renders: the ridge in the side view, the lip, outer edge and rear edge in the +hero's mirrored half and the side view, 62 degrees apart. The side view's pixel is 27.6 mm across at the plate. + +| traces | worst corner from the truth | +| --- | --- | +| as taken off the renders (up to 2.5 px from the truth's projection) | 39 mm | +| every point 1 px off, 12 draws | 69 mm median, 96 mm at most | +| every point 2 px off, 12 draws | 125 mm median, 190 mm at most | + +With every corner named, the worst corner of a blocked plate stood within 3.5 x the noise x the coarser view's +pixel, on a floor of 1.4 of that pixel from the render itself. That is one plate through one pair of views, not +a law. It is not a multiple of `m_per_px`: the same readings are 4.6 to 7.5 x noise x a view-decided corner's +`m_per_px`, and a seam corner 98 mm off reports 0.0008 m a pixel, because `m_per_px` is depth along the sight +line and most of this error lies across it. With only four corners named, the roof's ridge and outer edge are +one side each and are built as smooth runs through their hard knees: explained within `tol`, 196 mm from the +true edges (5.2 px is 144 mm there). Name a hard corner as a corner. + +Fairness, 0.2 x a side's chord, is set by known truth at traced noise. Over ten cells at 1 and 2 px (the rendered +roof with four corners named, with and without closing strokes moved 3 px, and a bowed pentagon at 60 and 30 +degrees and in one view), the mean of the cells' 90th percentiles and the worst draw, in mm: + +| FAIR | 0.1 | 0.15 | 0.2 | 0.25 | 0.3 | 0.4 | 0.5 | 1 | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | +| mean 90th percentile | 194 | 184 | 178 | 178 | 179 | 186 | 193 | 196 | +| worst draw | 301 | 275 | 273 | 272 | 312 | 382 | 494 | 577 | + +From exact traces weaker fairness is nearer the truth (a pentagon bowed 35% of its sides: 42 mm at 0.2, 16 at +0.5, 12 with none). + +Agreement with other fits, which is not accuracy. SPECTRE's second-pass roof from its hand traces: the ridge +7.3 mm at most and the brow a median of 8.4 mm from the cage `fit_shell` had fitted to the same pixels; with +1 px of noise on those traces the brow's median read 11 to 75 mm over six draws (Soul's probe, verdict cut-trace-block.s1). Paladin's 16 plates, each a polygon traced in +one view with the plane its agent gave: every corner decided by the plane, the crown within 1 mm of the one +the harness had lifted onto the same plane. Its two thigh shields traced as partners are refused, a side 19 px +unexplained: the sheet draws two different polygons, not one plate and its reflection. RAPTOR's hull plate +bearing the 27 (`tests/fixtures/raptor_plates.json`), marked by eye in the hero and the SIDE view: seven hull +marks admit no hero camera under 25 px rms, so the sheet's two views do not draw one hull; through that camera +the plate blocks with its sight lines 34 to 40 degrees apart and the prior holding 0.17 to 0.20 of each corner. What it gives up. One outline loop a plate: a plate that wraps a corner is two plates, and creases inside the -outline are not blocked. A bend smaller than `tol` is built straight: the bowed pentagon's 56 mm bow reads under -2 px and stays in the error above. Fairness holds a grown side flatter than its trace while the trace still -reads as explained: a plate whose sides bow 35% of their length ended 42 mm off its truth from exact traces, and -`fit_shell` on the returned `fit_traces` moved it 74 mm back. The plane through the decided corners is a guess -at a twisted plate, and where one view sees a corner the plane is all the depth it has: `decided_by` says so. +outline are not blocked. A bend smaller than `tol` is built straight, and a hard knee inside a side is rounded. +Fairness holds a grown side flatter than its trace while the trace still reads as explained (the side's +`decided_by` says when the prior holds it). The plane through the decided corners is a guess at a twisted +plate, and where one view sees a corner the plane is all the depth it has. Every crown point carries a skirt +vertex, so a point a side grows costs two. ## What it cannot do