docs/reference.md: the untrimmed 90th percentile at 5.2 px and what it does not separate; m_per_px as a depth sensitivity with the measured hand-trace overshoot; reference_fit's last run

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-12-03 05:37:03 +01:00
commit 23ebf4dd18
2 changed files with 37 additions and 36 deletions

View file

@ -194,7 +194,7 @@ diagonal costs what one pixel of miss does.
| `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): nine tenths of every trace, 5% of it left out at each end, must lie this near its built run |
| `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
@ -204,35 +204,36 @@ for the mirrored half of a mirrored sheet (the reflections `brokkr_kitbash`'s pa
**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 with 5% of the trace left out at each end; 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 whole trace stands, ends included. 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.
`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 ends are left out and 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.69 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, the 5% and the default were read from 296 fits and set
by the margin rule (`tests/test_reference.py`, `FitTests`): what should pass reads 3.26 px at most (hand traces
wandering 1 and 2 px), what should not reads 7.65 and up (the Orchid's traces overdrawn 2% of their extent,
synthetic strokes 3% off), and 5 sits 1.53 from each.
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.96
(31 of 36 pass the default); strokes overdrawn 1% read from 2.63 (12 of 45 pass) and 2% from 5.34 (none pass, with
no margin). The reading orders 99.8% 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% 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, or one inside the 5% at an end, does not move the reading: `worst_px` shows it.
**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` says how far a point slides in depth across its run per pixel of error in the traces: along the part
of its 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
`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:
@ -248,10 +249,10 @@ put it. Read it per point against 0.2:
- 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 what one pixel of error on one point moves, not a bound on the fit's error. Clean strokes came back
`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.5 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
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
@ -264,14 +265,14 @@ 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.69 and 0.64 px, in 0.2 s; from blockings 5%, 10% and 20% of the ship's length off the built run lands
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`.
reports both as `worst_px`. `m_per_px` is a sensitivity to one pixel, not an error bound.
## What it cannot do

View file

@ -49,7 +49,7 @@
}
},
{
"name": "fit_shell returns a sheet with every trace explained within 5 px, and a row for each of the 12 moved points",
"name": "fit_shell returns a sheet with every trace explained within 5.2 px, and a row for each of the 12 moved points",
"ok": true,
"detail": {
"traces": [
@ -58,19 +58,19 @@
"worst_px": 0.021
},
{
"unexplained_px": 0.058,
"unexplained_px": 0.054,
"worst_px": 0.082
},
{
"unexplained_px": 0.053,
"unexplained_px": 0.052,
"worst_px": 0.071
},
{
"unexplained_px": 0.037,
"unexplained_px": 0.036,
"worst_px": 0.055
}
],
"seconds": 0.138,
"seconds": 0.176,
"chars": 2066
}
},
@ -123,7 +123,7 @@
{
"name": "a trace doubled back over itself is refused, naming the trace and the span no built run draws",
"ok": true,
"detail": "Error: traces[1] is not explained: 239 px of the trace, between 124 and 461 px along it, lie more than 5 px from the run as built (12.1 px at the 90th of a hundred, 5% of the trace left out at each end; up to 15.7 px). Nothing is returned as a fit. The trace draws something this run does not build (an overdrawn or doubled stroke, another edge, a bend the cage has too few points for): redraw it, or give the run more points. A very unsteady hand reads the same as a slight overdraw: if the trace is one clean stroke, ask again with tol over this reading. Nothing changed."
"detail": "Error: traces[1] is not explained: 235 px of the trace, between 126 and 461 px along it, lie more than 5.2 px from the run as built (11.6 px at the 90th of a hundred; up to 15.7 px). Nothing is returned as a fit. The trace draws something this run does not build (an overdrawn or doubled stroke, another edge, a bend the cage has too few points for): redraw it, or give the run more points. A very unsteady hand reads the same as a slight overdraw: if the trace is one clean stroke, ask again with tol over this reading. Nothing changed."
},
{
"name": "an unknown camera is refused naming the trace",
@ -162,7 +162,7 @@
}
],
"prior_share": 0.06,
"seconds": 0.022
"seconds": 0.027
}
},
{