# Reference views: the camera a picture was drawn through, traced lines scored against the build, and a shell fitted to them `surfaces/blender/brokkr_reference` is a Blender add-on that fits a scene to a reference image. A concept sheet, a render or a photograph draws its subject through a camera nobody wrote down; given points whose place in the world is known and the pixel where the image draws each, `solve_camera` finds that camera, so that a render through it lays over the image pixel for pixel and a line traced on the image can be scored against the build's edges. It is a host add-on in Brokkr's sense (`install.md`, "Host add-on actions"), a sibling of `brokkr_mesh_polish`: it imports that package's operator base and `Refused`, and nothing from `brokkr_bridge`. Enable `brokkr_mesh_polish` first; `brokkr_reference` refuses to register without it. `brokkr_actions.json` beside its `__init__.py` lists the three operators agents may run (`solve_camera`, `flow_score`, `fit_shell`); the arithmetic is `core.py` (numpy only, tested without Blender), which a script may import directly. The action writes its JSON report to `brokkr_mesh_polish_result`, returned in the receipt's `hostResult`. The package takes points and traced lines and gives cameras, scores and a fitted sheet. The images, the marks on them, traces and masks belong to whoever made them; nothing here opens an image. ## Conventions - World: x right, y forward, z up, metres. - Pixels: the image's, in whatever unit the points were marked in, u right and v down. `box` is the view's rectangle on the image, `u0,v0,u1,v1`; for an image that is one view it is `0,0,width,height`. - Camera record: `C` is where the camera stands, `R` turns world to camera (rows), the camera looks down its own -z with y up (Blender's), `f` is the focal length in pixels, `c` the principal point in pixels. `lens` is `f` in millimetres on a 36 mm sensor across the box's width. - Misses are weighed by a pseudo-Huber loss of 10 px: a build poses some points elsewhere than the image draws them, and one such point pulls the camera as its distance, not its square. The record is the truth. A Blender camera stood at it (`core.blender`) is derived, and `core.camera_of` reads one back into a record. ## solve_camera `brokkr_reference.solve_camera`. Host action fields are scalar, so points go in as text: | field | | | --- | --- | | `world` | `name=x,y,z; name=x,y,z ...` | | `pixels` | `name=u,v; name=u,v ...`; six or more names shared with `world`, the rest ignored | | `box` | `u0,v0,u1,v1` | | `model` | `auto` (default), `upright`, `rolled`, `free`, `square` | | `lens` | mm; 0 (default) solves it, 4 to 4000 holds it | | `turned` | names, spaces between, of points that turn as one about the vertical through `pivot` | | `pivot` | `x,y`; absent is `0,0` | | `camera_name` | a camera object to create or update at the solved camera; absent only computes | | `width` | pixels across the frame the box becomes (default 1000) | The models differ in what the camera may do beyond standing somewhere, turning and zooming. `upright` holds it level with its centre at the middle of the box. `rolled` lets it roll about its line of sight. `free` also solves the centre: a view cropped off-axis. `auto` solves all three and takes the one that predicts left-out points best (each point predicted by the camera solved without it), since a freer model always fits the marked points closer. `square` is for an elevation drawn square-on from far off: the points lie nearly in one plane across the line of sight, where a small turn of the camera and a narrower subject draw the same picture, so the camera is held looking straight along a world axis, whichever of the four fits best. `turned` is for one articulated group (a torso on its waist ring): its turn about the vertical through `pivot` is solved with the camera and reported as `twist`, in degrees from where the points were given. With `camera_name` the action creates that camera, or updates it if it exists (an object of that name that is not a camera is refused): its matrix, lens, shifts, a 36 mm sensor fitted horizontally, `clip_end` raised to four times the camera's distance if it was nearer, and the scene's render resolution set to `width` by the box's proportion. It does not make it the scene's active camera and does not touch `resolution_percentage`. A pixel of a render through it at 100% is then the image's pixel less the box's corner, times `width` over the box's width (`core.in_frame`; the frame's height is a whole number of pixels, so it can stand half a pixel off the box's). The report is the camera record: `C`, `R`, `f`, `c`, `box`, `lens`, `lens_band`, `lens_at_bound`, `lens_determined`, `planarity`, `plane`, `rms`, `median` and `worst` (`[name, pixels]`), `left_out` (the leave-one-out rms), `model`, `tried` (each model's `rms`, `left_out` and `lens`), `azimuth`, `elevation` and `distance` (where the camera stands round the points' middle), `roll`, `twist`, and `residuals` (`{name: [du, dv]}`, to a hundredth of a pixel in a receipt); plus `camera` (the object's name or null) and, when a camera was stood, `blender` (what `core.blender` gave it). Refusals name their cause: fewer than six shared names, a point that is not finite numbers, a name given twice, a box of no width or height, a lens outside 4 to 4000 mm. Marks that cannot decide a camera are refused before any solve: fewer than six different world points or six different pixels among the shared names (the message names two that share one), pixels all on one line, world points all on one line, and world points all in one plane with the model `free`. These are exact cases, to a billionth of the marks' extent (`core.EXACT`); points nearly in a line or a plane are solved, and `lens_determined` and the band say what they leave open. A report never holds a number that is not finite. `planarity` is how flat the marked world points are: their least extent over their greatest, 0 for a plane, 0.3 for points spread through a box. World points all in one plane (a deck, a wall, a flat sheet of marks) are solved, and `plane` is then the degrees between the line of sight and square-on to that plane (it is null otherwise). A plane never decides the centre, so `auto` tries `upright` and `rolled` only. Flat marks may not decide the lens, and `lens_determined` says whether these did. Seen obliquely a plane does, by its foreshortening. Seen square-on it does not: every lens draws it the same from its own distance, and a small tilt of the plane seen through a long lens draws what a short lens draws square-on, so the marks' error picks the headline lens. Measured on a plane of thirteen marks through a 50 mm lens, each mark a pixel off, six seeds a tilt: | degrees off square-on | headline lens, mm | band, mm | `lens_determined` | | --- | --- | --- | --- | | 0 | 4 to 4000 | 4 to 4000 | false, all six | | 3 | 4 to 90 | 4 to 4000 (one 45 to 134) | false, all six | | 6 | 42 to 62 | from 13 to 84, one 4 to 4000 | false, all six | | 9 | 46 to 57 | from 35 to 69 | true in five | | 15 | 48 to 53 | from 44 to 59 | true, all six | | 30 | 49 to 51 | from 45 to 57 | true, all six | The band held 50 mm in all 36. With marks 3 px off, one band of nine at 5 degrees did not (68 to 152, not determined). When `lens_determined` is false, do not read `lens` as the lens: hold `lens` from another view, or mark a point off the plane. ## How far to trust the lens Six or more points that are not all in one plane decide a camera. What they decide well is the picture: where each point is drawn. What a long or square-on view decides badly is how far off the camera stands, because distance and focal length trade against each other (a dolly zoom) and the picture barely changes. So: - The focal length is held inside 4 to 4000 mm. Without a bound the solve ran the focal length to overflow on long views; past 4000 mm a view is orthographic to any marking. `lens_at_bound` is `"long"` or `"short"` when the answer sits at an end: read that as "at least this long", not as a lens. - `lens_band` is `[low, high]`, walked out from the best lens in steps of a tenth in log f (about 10%) to the first lens each way that, held and refitted, misses 1.1 times the best rms. Every lens outside the band misses; each end is the first step that did, so the lenses that fit end somewhere in the step before it, and a band is never narrower than a step each way. The rms the walk is judged against is never taken under 1 pixel (`core.FINE`): marks placed truer than a hand places them fit every lens of a flat view to a millionth of a pixel, and one of those would be called best. It is an **equal-error band, not a confidence interval**: it says which lenses the marks cannot tell apart, and on probes a few such bands excluded the true lens. A band that ends at 4000 or at 4 was stopped by the bound. - For flat marks (`planarity` under 0.12, `core.PLANAR`) a band that reaches one end of the range is reported as the whole range, 4 to 4000. What closes the other end of such a band is a tilt of the plane traded against the lens, and the marks' error sets that either way: a square-on plane's band read 309 to 4000 mm on one seed with the true lens at 50. This gives up the one-sided reading ("at least 300 mm") for flat marks; marks with depth keep it. - `lens_determined` is true when the band lies inside 4 to 4000 mm and spans no more than 1.57 times (`core.DECIDED`), false otherwise, and null when `lens` was held. - There is no prior. Where the data cannot decide, the answer is a wide band rather than a plausible-looking 50 mm. - Hold `lens` only when views must agree: two views of one subject solved alone may each sit anywhere in their bands, and a fit rendered from elsewhere than the reference view depends on the lens the band does not fix. What this buys and costs, measured on a generated hull rendered at known cameras with 10 to 16 marked points (Blender 5.3 on Starfire): a 50 mm oblique view with 1 px of marking noise came back at 49.9 mm; a 135 mm view on a build 2% of its length out came back anywhere from 94 mm to the bound, with the camera's place off by eleven hull lengths, and a crease lifted through that camera onto the hull's mirror plane was still within 1.4% of the hull's length of the truth, moving at most 0.6% between the band's ends. A wide band is a warning about the camera's place, not about a lift made in the view's own frame. `rms` is the plain root mean square of the misses, in pixels at the marking unit, though the solve minimises the pseudo-Huber loss; `median` beside it shows when a few points carry the error. A solve with `auto` on 13 points takes several seconds (three models, each from 16 starts, plus a left-out solve per point per model). ## flow_score: traced lines against built edges `flow_score` says how much of each traced line the build already carries as an edge. It reads the evaluated meshes (modifiers applied) and keeps the edges the camera sees: creases (two faces whose normals differ by more than `angle` degrees, at least one of them facing the camera), contours (one face toward the camera, one away) and open borders, each where two of three points along it are hidden behind nothing the scene shows. A face that looks away by its winding does not count as seen, so a cage with flipped normals shows no creases. | field | | | --- | --- | | `camera_name` | the camera object the view is seen through (`solve_camera` stands one) | | `box` | `u0,v0,u1,v1`: the camera's frame on the image, in the pixels the lines were traced in; absent is the render's own frame from 0,0 | | `height` | the figure's height in the box's pixels; an edge within 1% of it is near. 0 (default) is the box's height | | `lines` | `tag: u,v u,v ...; tag: u,v u,v ...` | | `objects` | `name; name; ...`, the meshes whose edges are read; absent is every mesh the render shows. Everything the scene shows hides | | `angle` | degrees (default 18) | The report: `lines` (`{tag: {on, off, run}}`), `edges` (the count of seen edges by kind), `objects` and `height`. `on` is the share of the line with a seen edge within 1% of the height and within 20 degrees of the line's own direction; `off` the mean distance to such an edge in % of the height, capped at 5; `run` the longest unbroken share that is on. The edges themselves are not returned and not kept: they are computed on each call. The hiding test's sight line stops short of each point by a thousandth (`HIDE`) of the diagonal of the edge's own piece, the connected part of its mesh that it lies on, so that the edge's own faces do not hide it: a box joined into one mesh with a ground 200 times its size keeps the box's margin. A surface nearer the edge than that hides it when it stands further off than a thousandth of the diagonal of the object it belongs to, measured whole: the margin is the smaller of the two, whatever else the scene holds. A greeble modelled into its hull's own connected surface has the hull's margin, and a surface nearer it than a thousandth of the hull does not hide it. A strip 0.3% of a box's diagonal in front of an edge hides it at scales 0.01, 1 and 100, and with a ground 20 or 40 times the box among the meshes read; chips a fortieth of a box hide its edge from 0.05% of its diagonal. Past the own object's margin the first surface met decides. Edges read true from cameras to about 20000 diagonals off, where the ray's own rounding reaches the margin. The action writes nothing to the scene (its row says `changesScene` because the operator base pushes an undo step). ## fit_shell: a shell's sheet fitted to traces of its hard runs A kitbash shell (`kitbash.md`, "Making a shell") is blocked in by eye; `fit_shell` moves the cage points of its traced runs until the runs, as Blender builds them and the cameras draw them, lie on the traces. A run is a hard crease or rim run of a loft or of a free cage, named as the sheet's creases name runs. The unknowns are the authored points on the traced runs; a mirrored sheet is one set of points seen twice, so a trace of each half through one camera is two views of the run (Francois et al. 2003), and that is where depth comes from in a single picture. Each built point of a run is pulled onto its trace along the trace's normal, and the run's two ends onto the trace's ends; no point of a trace is matched to a point of the run or of another trace (after Debevec's Facade and Drummond and Cipolla's edge tracker). A prior holds every point to the sheet as it stands: a move of `share` of the sheet's diagonal costs what one pixel of miss does. ```json {"action": "brokkr_reference.fit_shell", "object_name": "Pauldron", "traces": "[{\"camera\": \"Concept\", \"box\": [0, 0, 1024, 1024], \"run\": {\"column\": 3, \"from\": 0, \"to\": 5}, \"side\": 1, \"line\": [[412.5, 96.0], [431.0, 180.2], [440.8, 266.0]]}, {\"camera\": \"Concept\", \"box\": [0, 0, 1024, 1024], \"run\": {\"column\": 3, \"from\": 0, \"to\": 5}, \"side\": -1, \"line\": [[612.0, 90.5], [590.2, 176.0], [583.1, 262.4]]}]"} ``` | field | | | --- | --- | | `object_name` | a shell made by `brokkr_kitbash.shell`, unscaled; its place in the world is the sheet's frame | | `traces` | a JSON array, up to 12000 characters, of `{camera, box, run, side, line}` | | `share` | the prior (default 0.1) | | `tol` | pixels (default 5.2): nine tenths of every trace must lie this near its built run | In a trace, `camera` names a camera object (`solve_camera` stands one) and `box` is its frame on the image, absent for the render's own; `run` is `{"ring": i, "from": a, "to": b}` or `{"column": j, "from": a, "to": b}` on a loft and `{"verts": [v, ...]}`, the run's vertices in order, on a free cage, all in authored indices; `side` is 1, or -1 for the mirrored half of a mirrored sheet (the reflections `brokkr_kitbash`'s parser makes: `Sheet.mirror_of`); `line` is `[[u, v], ...]` in the box's pixels, drawn from the run's first point to its last. **It returns a fit only where the built runs explain every trace.** After the fit, each trace is walked a pixel at a time and each point's distance from its run, as built and drawn, is taken. The trace's reading, `unexplained_px`, is the 90th percentile of those distances; over `tol` the action is refused, naming the trace, its reading, how much of it lies past `tol` and where, and nothing is returned as a fit. `worst_px` is the furthest any point of the trace stands. The fit's own residual is no such test: on strokes doubled back over part of themselves 3% of the view off, every fit converged and without this check all of them came back, up to 0.10 m wrong on a 2 m crease. The reading is not the worst point because a hand trace's tip is where two traces cannot agree: the Orchid's hand-traced pair reads 0.80 px, with one tip 9.2 px off its run, and that pair's least 1% overdraw has a worst point of 9.1 px. The percentile and the default were read from 296 fits and set by the margin rule (`tests/test_reference.py`, `FitTests`): what should pass reads 3.76 px at most (hand traces wandering 1 and 2 px), what should not reads 7.27 and up (the Orchid's traces overdrawn 2% of their extent; synthetic strokes 3% off read 7.70), and 5.2 sits 1.39 from each. **A very unsteady hand and a slight overdraw are not told apart.** Hand traces wandering 4 px read up to 5.84 (31 of 36 pass the default); strokes overdrawn 1% read from 2.57 (11 of 45 pass) and 2% from 5.10 (2 of 45 pass). The reading orders 99.6% of hand trace against 2 to 3% overdraw pairs rightly, but no threshold stands 1.2 from both the 4 px hand traces and the 2% overdraws. So the reading is in the report of every accepted fit and in every refusal: near 5, look at the trace. An accepted trace reading 3 to 5 px may be a 1 or 2% overdraw; a refused one reading 5 to 6 may be a clean stroke from an unsteady hand, and asking again with `tol` over its reading is the caller's judgement. A doubled stretch shorter than a tenth of the trace does not move the reading: `worst_px` shows it. **It writes nothing.** The report carries `sheet`, the shell's own request with the traced points moved, ready for `brokkr_kitbash.shell`, which is the cage's one writer; `flow_score` on the rebuilt shell is the score. The rest of the report: `traces` (`[{unexplained_px, worst_px}]`), `points` (`[{ring, point, moved_m, m_per_px, prior_share}]` on a loft, `[{vertex, ...}]` on a free cage, one per moved point) and `seconds`. `m_per_px` is a point's depth sensitivity: how many metres one pixel of error in the traces moves that point along its line of sight, taken on the part of the line of sight that stands across the run there (the worst of the traces that draw it), from the inverse of the fit's normal matrix, prior included (Triggs et al. 2000, sections 9 and 10). A point's slide along its own run is left out: the traces do not decide it and it does not move the built run. `prior_share` is `m_per_px` over `share` x the diagonal: near 1 the traces say nothing about the point's depth and it stands where the blocking put it. Read it per point against 0.2: - **Under 0.2 the traces decide the point.** A mirrored pair traced in one view: over 18 fits every point reads 0.080 or under and the built run is right to 0.7 mm. The Orchid's concept c09 pair reads 0.018 at most. - **Over 0.2 the blocking holds it.** One half traced in one view: over the same 18 fits every inner point reads 0.50 to 1.0 (the sine of the angle its run stands off the line of sight) and the built run is 18 to 355 mm wrong. Either Orchid trace alone reads 0.27 and up on every point. 0.2 is the geometric mean of 0.080 and 0.50, 2.5 from each. - A run's end seen along the run reads low even on a single trace (down to 0.005): there the line of sight is the run's own direction, and the depth across the run is decided. - A run on the mirror plane (a spine, a keel) has no partner and needs none: its points stay on the plane, which decides their depth. A spine traced once read 0.019 at most and came back within 0.15 mm. `m_per_px` is a sensitivity, and `tol` x `m_per_px` is no bound on the fit's error. Clean strokes came back within 0.16 of `tol` x the worst `m_per_px` they report. Hand traces whose wander holds over 30 px did not: of 24 fitted (wander 2 and 4 px), 13 ended further off than that, up to 2.45 times (20 to 87 mm on a 2 m crease), while every point read a `prior_share` under 0.05. A low reading says the traces decide the point; how well they decide it is as good as the traces are. What it refuses before fitting, naming the trace: a run with an edge under weight 1 (a semi-sharp edge rounds off by an amount the fit does not model), a run whose end does not hold (a dart; a ring run from point 0 of a mirrored sheet, which runs on across the middle), a run with a point held partway (a corner point or a crossing crease: trace it as two), a closed loop, an unknown camera, a line of fewer than two points, a run named in the other form's words (`verts` on a loft, a ring or column on a free cage), a scaled shell, and a result that would pass the 16000 characters a receipt carries. Measured (Blender 5.3 and Python 3.13 on Starfire): a mirrored column of 10 points traced in one view at a time, from blockings 0.10 m and 0.30 m off a 2 m crease, came back within 0.7 mm in 0.1 to 0.6 s. The Orchid's c09 petal edges, traced by hand through a camera solved from hand marks (13 px rms), are accepted at the default, reading 0.80 and 0.68 px, in 0.2 s; from blockings 5%, 10% and 20% of the ship's length off the built run lands in one place, 2.0% of the length from a stand-in mesh in the mean and 3.4% at worst. A mirrored free cage's crease of six vertices, blocked 0.056 m off, came back within 0.43 mm through the action in 0.02 s. What it gives up: it fits hard runs only. Silhouettes of the smooth surface and semi-sharp creases are not fitted; a run's depth with no mirror partner, no second view and no mirror plane under it is the blocking's. The acceptance reads nine tenths of a trace: it passes a short doubled stretch and a tip that stands off, and reports both as `worst_px`. `m_per_px` is a sensitivity to one pixel, not an error bound. ## block_plate: a plate's first cage from its traces `fit_shell` refines a cage somebody blocked. `brokkr_reference.block_plate` makes the first one. A plate is a closed outline of named corners in order; side i runs from corner i to corner i + 1 and is one hard crease of the plate's crown. A trace is one side drawn in one view, `{camera, box, frame, from, to, side, line}`: `from` and `to` are two consecutive corners and the line is drawn from the one to the other. That is the only correspondence there is: a trace's two ends are its two corners. Every other point of the crown is placed by `fit_shell`'s residual, the pixel distance from the side as built to the trace. Nothing matches a point of one trace to a point of another. `frame_object` is the plate's frame. A trace's `frame` is the part's pose in that view where it differs (a limb swung, a hull pitched); `side` -1 is a view of the plate's reflection across the frame's x = 0, which is the other half of a mirrored plate or the same plate on the partner limb. `plate` is `{corners, mirror, seam}`. On a mirrored plate `seam` names the corners on x = 0, two or more next to each other: they are held there, the sides 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 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. That factor of 1 is the prior's own unit, not a derived value; the tests pin it between a plate that blocks and one that is refused. 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 has three corners started at 0.72 of the scale with its views 19 degrees apart, 0.83 at 16.5, between 1.22 and 1.23 at 11 and 2.73 at 5. With no plane given it blocks down to 16.5 degrees (73 mm from the truth) and is refused at 11, where it would have stood 104 mm off: the line switches blocking and refusal, it is no cliff in accuracy. At 5 degrees its corners landed 0.25 to 1.5 m off; through a lens three times as long it starts at 0.65 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. 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 x its chord. A distance to a plane does not resist a move in the plane, so the views decide wherever they see, and a view that sees nothing along its own sight line leaves that to the plane. A side starts as its two 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.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 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`, `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 fewer than three corners are decided, the 66 degrees, a mirrored plate's corner that starts or ends across x = 0 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 against a known truth (`tests/test_reference.py` BlockTests, Python 3.13 on Starfire; `tests/fixtures/spectre_truth.json`), on one plate through one pair of views. SPECTRE's pass-3 roof, a hard mirrored cage of 11 vertices, was built by `brokkr_kitbash.shell` and rendered in Blender 5.3 through SPECTRE's two solved cameras at the sheet's pixel size. Its edges were 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. How the traces were taken. No hand drew them. A search follows a seed polyline, takes the strongest brightness step within a window across each edge, lays a straight stroke through the steps found on each segment, and ends each stroke where it crosses its neighbours. The seed is the truth's projection moved off the answer, in eight families: the whole seed by 0.5, 1 or 1.5 px in a drawn direction (a 2.5 px window), or each of its vertices by a normal draw of 1 or 2 px (3.5 px), 2 px (5 px), 3 px (6 px) or 4 px (8 px). Every corner is named. A take's worst point stands far from the truth's projection, 3 to 12 px at the families' medians: two strokes that run nearly along each other cross far from the corner. Forty fresh draws a family (the fixture holds twelve of each of six, 72 takes, which the test blocks; the 2 px, 5 px and the 4 px, 8 px families are in neither): | seed | window | blocked of 40 | worst traced point, px: median, most | worst corner, mm: median, most | worst corner over worst point x 27.6 mm, at most | | --- | --- | --- | --- | --- | --- | | moved 0.5 px as one | 2.5 px | 40 | 3.4, 30.2 | 47, 913 | 1.11 | | moved 1 px as one | 2.5 px | 39 | 3.5, 30.4 | 67, 916 | 1.15 | | moved 1.5 px as one | 2.5 px | 39 | 3.6, 24.9 | 66, 370 | 1.19 | | each vertex 1 px | 3.5 px | 35 | 8.5, 28.2 | 171, 559 | 1.13 | | each vertex 2 px | 3.5 px | 35 | 9.1, 28.8 | 153, 745 | 1.14 | | each vertex 2 px | 5 px | 30 | 9.4, 41.5 | 170, 512 | 1.25 | | each vertex 3 px | 6 px | 17 | 10.2, 73.6 | 231, 2038 | 1.15 | | each vertex 4 px | 8 px | 8 | 12.0, 29.0 | 322, 417 | 1.33 | The fixture's 72 takes read 1.18 at most (62 block; nine are refused at a side not explained at six points, one at the cage's parser). These ratios are not the bound. A take's worst point is one far crossing, and it inflates what the corner is measured against: the worst a trace does for its worst point is to have no outlier, every point the same d px off the truth's projection. With no search, the truth's projection moved: | every traced point d px off | worst corner over d x 27.6 mm, at most | | --- | --- | | each view moved as one, 12 directions by 12, at 1, 2, 3 px (all 144 block) | 1.505, 1.504, 1.502 (1.10 at the median) | | each stroke its own direction, searched | 1.58 | | each point its own direction, searched, at 1 and 3 px | 1.67, 1.66 | The bound: worst corner <= 2.08 x d x pixel, d the furthest any traced point stands from the truth's projection and pixel the coarser view's. 2.08 is the geometric mean of the 1.505 and of 2.865, what the blocking reads on the same 144 without its end terms; it stands 1.25 over the worst a search found, which is not the worst there is, and 1.57 over the worst family of takes. The test holds the 144, the searched worst at 1 and 3 px and the 72 takes to it. It is a reading on one plate through one pair of views, 62 degrees apart, not a law, and it says a plate is as good as its worst traced point: one stroke end 30 px off puts a corner 0.9 m off, and nothing in the report says so, because that trace is explained. No bound is given in the traces' rms: against it the fixture's takes run 0.57 to 5.3. The same search seeded on the truth's projection itself, with a 2.5 px window, reads 39 mm; that is the window ending every stroke within 2.5 px of the answer, and it is not an accuracy. The error is not a multiple of `m_per_px` either: 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, its strokes those of the search seeded on the truth with the noise added, with and without closing strokes moved 3 px, and a bowed pentagon at 60 and 30 degrees and in one view), 168 draws: the mean of the cells' 90th percentiles and the worst draw, in mm, over the draws that blocked, and the draws refused, which no percentile counts: | 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 | | refused of 168 | 19 | 20 | 23 | 24 | 24 | 25 | 26 | 27 | A higher FAIR, which is weaker fairness, refuses more draws, so each column's percentiles are over a different set. On other seeds (Soul's probe, verdict cut-trace-block.s2, FAIR 0.1, 0.2, 0.3, 0.5) the mean 90th percentile read 216, 188, 216, 250, the worst draw 542, 855, 679, 807 and the refused 18, 21, 26, 27; on a third (verdict cut-trace-block.s3, all eight) 196, 196, 195, 202, 199, 220, 234, 255, the worst draw 652, 876, 690, 843, 871, 500, 673, 741 and the refused 10, 15, 20, 20, 22, 22, 23, 23. FAIR is flat from 0.1 to 0.3 and worse above: 0.2 and 0.25 tie in the table, and 0.1 to 0.2 stand within 1 mm on the third set. 0.2 is kept as a point on that plateau, not a resolved lowest. 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, 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 It solves one pinhole camera for one view: no lens distortion, no two views solved together, one turned group and no other pose. It does not find the points; marking them is the caller's. Points on posed joints fit worse than points on rigid features of one body, because the build's pose is not the drawing's. It does not say whether the subject is the right size: a build twice too large is the same picture from twice as far. `block_plate` blocks one outline loop a plate and no crease inside it. ## From a script ```python from brokkr_reference import core cam = core.solve(world, pixels, box, model="auto") # dicts by name; the record u_v = core.project(cam, points) # where it draws world points origin, direction = core.ray(cam, (u, v)) # a pixel's line of sight point = core.lift(cam, (u, v), plane_point, plane_normal) # a traced pixel on a plane run = core.crease_run(column) # the hard crease Blender builds from a cage column fit = core.fit_sheet(sheet, cage, frame, traces, cams) # the fitted sheet and its report; cage is brokkr_kitbash.core.sheet(sheet) out = core.block_plate(views, plate, traces, parse) # a plate's first sheet and what decided each corner; parse is brokkr_kitbash.core.sheet score = core.along(line, segments, height) # on, off, run against [u0, v0, u1, v1] segments params = core.blender(cam, 1000) # matrix_world, lens, shifts, resolution cam2 = core.camera_of(params, box) # and back ``` The tests are `tests/test_reference.py` (no Blender), `tests/live/reference.py` (a known scene rendered, solved through the action and rendered again; `reference.result.json` is its last run) and `tests/live/reference_flow.py` (`crease_run` against Blender's own subdivision, a box and a folded sheet scored by `flow_score`; `reference_flow.result.json` is its last run) and `tests/live/reference_fit.py` (a mirrored loft and a mirrored free cage, each blocked off its design, fitted through the action and rebuilt by `brokkr_kitbash.shell`; `reference_fit.result.json` is its last run) and `tests/live/reference_block.py` (a bowed plate and a mirrored plate blocked through the action from traces alone, built by `brokkr_kitbash.shell` and handed to `fit_shell`; `reference_block.result.json` is its last run).