Skip to content

feat(examples): compare input and output pixel error in the reprojection explainer - #712

Merged
kylebarron merged 11 commits into
mainfrom
kyle/explainer-output-pixels
Oct 14, 2026
Merged

kylebarron merged 11 commits into
mainfrom
kyle/explainer-output-pixels

Conversation

@kylebarron

@kylebarron kylebarron commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Note

This PR was written by Claude (Claude Code) on behalf of @kylebarron, not by @kylebarron.

The reprojection explainer can now show the reprojector's two error spaces, input pixels and output pixels (_errorSpace, from #711), and a second scenario where they differ strongly.

  • Scenarios. The explainer is driven by a scenario: an image, its projections, a reference line and its text. NLCD (Albers → Web Mercator) stays the default and looks the same.

    • A new Arctic scenario rolls a 30–85°N band of NASA's Blue Marble from longitude/latitude into a ring on a polar stereographic map (EPSG:3413), with the Arctic Circle as its reference line.
    • A "Scenario" select in the tuning panel switches between them, as does ?scenario=arctic in the URL.
  • Error space. The "Error measured" select, the M key, or ?metric=output switch between the two modes. Each mode draws and labels the gap it measures:

    • input mode shows, in the input image, a line from each test point to where the GPU's drawn position maps back;
    • output mode labels the gap on the map.

    Step 3 names where the 2-triangle mesh is worst, because that moves with the mode: in output pixels, NLCD's worst point is the middle of the top edge, not the center. The library-default triangle count in the closing caption is computed per scenario and mode, capped at 25,000 iterations.

  • Tuning panel. It's now a sidebar beside the slide, so it never covers the animation. It starts collapsed to a slim rail, and P (for "panel", formerly H) opens it. On screens under 700 px wide it floats instead. The keys are drawn as keycaps.

  • Layout fixes. Error labels stay clear of the panel titles, the counter and the description; the counter no longer wraps under a narrow map; and the description sits lower, clear of the counter when the map fills its panel.

  • README: the scenarios, the error metric, the keys, and commands that regenerate the Arctic image from NASA's source.

The Arctic image is NASA Earth Observatory's Blue Marble Next Generation (July 2004), which is free to use with credit, cropped and resampled to 2048×313 px.

To try it:

pnpm install
pnpm build
cd examples/explainers/reprojection-explainer
pnpm dev

Then open ?scenario=arctic, ?metric=output, or both.

Closes #708

🤖 Written by Claude Code

kylebarron and others added 7 commits October 14, 2026 15:51
Everything specific to the NLCD image (the image, its projections, the
49th parallel, the panel subtitles, kilometers per pixel, tolerance
choices, and the text of steps 1 and 3) moves into an NLCD `Scenario`,
which the scene builder, story, HUD, tuning panel and app take as input.
The default explainer is unchanged; a test pins its hand-written text.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…xplainer

A band of NASA Blue Marble imagery from 30°N to 85°N in longitude/latitude,
rolled into a ring on a north polar stereographic map (EPSG:3413). Its two
corners per side land on one meridian, so the 2-triangle mesh collapses the
whole image onto a line: a far more dramatic first attempt than NLCD's.
Its step 1 and step 3 text is a draft, marked "[Draft]".

The tuning panel gets a Scenario select, and `?scenario=arctic` opens the
explainer on it. Outline samples are set per image edge, since a band's top
edge is a small circle on the map and its bottom edge a large one.

The default-tolerance triangle count now runs up to 100,000 iterations: the
library's 10,000 stopped the Arctic at 19,826 triangles of 33,830.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The tuning panel's "Error measured" select, the M key, and `?metric=output`
switch the explainer between the reprojector's two error spaces
(`_errorSpace`): input pixels and output pixels. Each mode draws the gap it
measures: input mode adds, in the input image, a line from each test point to
where the GPU's drawn position maps back, and labels it there; output mode
labels the gap on the map. In output mode the counter says "output px" and
step 3 "output pixels".

Step 3 now names where the 2-triangle mesh is worst instead of assuming the
image center: in output pixels, NLCD's worst point is the middle of the top
edge, where Web Mercator stretches the map most. The NLCD text is unchanged
in input mode.

Error labels sit past the true end of their gap and move beside their dot
when that would cover the panel titles, the counter or the description, and
the counter no longer wraps under a narrow map.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The closing caption's library-default count needs about 17,000 iterations
for the Arctic band, the largest case. 100,000 left far more room than any
scenario needs; the lower cap also bounds how long a scenario that never
converges can block the page.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The tuning panel is now a sidebar beside the slide instead of a panel
floating over it, so it never hides the animation: open, the slide resizes
into the space left. It starts collapsed to a slim rail, so viewers can find
it without knowing to press H. On screens narrower than 700 px it floats
instead, which would otherwise leave the slide too small. The keys are drawn
as keycaps, and picking from a select hands focus back to the page so the
presenter keys work right away.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the feat label Oct 14, 2026
kylebarron and others added 4 commits October 14, 2026 16:02
P for "panel" is easier to remember than H.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tion

When the map fills its panel, as the Arctic ring does, the counter under it
ended right where the description began. The description now starts 30
slide units lower; the longest one still ends well above the control bar.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kylebarron
kylebarron marked this pull request as ready for review October 14, 2026 20:05

@kylebarron kylebarron left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@kylebarron
kylebarron merged commit 7d93d80 into main Oct 14, 2026
5 checks passed
@kylebarron
kylebarron deleted the kyle/explainer-output-pixels branch October 14, 2026 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant