Skip to content

feat(examples): add reprojection explainer - #696

Merged
kylebarron merged 3 commits into
mainfrom
kyle/reprojection-explainer
Oct 8, 2026
Merged

kylebarron merged 3 commits into
mainfrom
kyle/reprojection-explainer

Conversation

@kylebarron

@kylebarron kylebarron commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

I'm honestly amazed at what Claude was able to do here.

This is both a helpful animation for a conference talk tomorrow and something that can live on the docs website itself.


Note

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

Reprojection explainer, mid fly-over

Adds examples/reprojection-explainer, a six-step animation of how deck.gl-raster reprojects a raster on the GPU with a triangle mesh. It works as a talk prop and on its own: each step has a title and an optional description, and a control bar makes it usable without a presenter.

What it shows

The source is NLCD land cover stored in Albers equal-area, where the 49th parallel is curved.

  1. The input image: the image as stored, next to the true 49th parallel in Web Mercator.
  2. Two triangles: the image is split along a diagonal.
  3. Project the corners: the 2 triangles fly over. The corners land exactly, but the border sags far below the true line: 261 source pixels, about 500 km.
  4. Refine the mesh: RasterReprojector.refine() replayed one split at a time on both panels. Each split lands where the GPU's straight-line guess is furthest off, and the new corner snaps to its exact position (2 → 194 triangles, 261 → 3.9 px). A slider scrubs through the splits.
  5. Map each triangle: every triangle of the final mesh flies into place.
  6. Done: the edges fade, leaving the reprojected image.

Everything is computed live. The mesh comes from @developmentseed/raster-reproject; refinement.ts reads its private priority queue to record each split, with no package change. Frames are drawn by a small TexturedTrianglesLayer, as textured triangles whose texture coordinates the GPU interpolates: the mechanism the animation explains. The only asset is the 2500×1641 Albers PNG; nothing reprojected is stored.

Also in this PR

Controls

→ / Space / PageDown go forward (finishing a running animation first), ← / PageUp go back, R replays, 1–6 jump to a step, D toggles descriptions, F switches the flight style, and H opens a tuning panel. The control bar appears when the mouse moves and fades out at rest, so it stays off the projector while presenting from the keyboard or a clicker.

Testing

  • 87 vitest tests for the pure parts: projection, refinement recording (checked against the library's triangle counts), layout, flights, pacing, the player, and the story frames.
  • pnpm -r typecheck, biome ci . and vite build pass on the branch, rebased onto feat(examples): experimental custom projection example with polar stereographic COGs #694.
  • Every step, both flight styles, the slider, the descriptions toggle, and keyboard and focus handling were checked in headed Chrome.

Notes

🤖 Written by Claude Code

A six-step animation of how deck.gl-raster reprojects a raster on the GPU.
The NLCD land cover image, stored in Albers equal-area, is cut into the mesh
that RasterReprojector builds, the refinement is replayed split by split, and
every triangle is drawn into its Web Mercator position by a small
textured-triangle layer: the same mechanism the animation explains.

Each step has a title and an optional description, and a control bar
(previous/next, step dots, replay, a slider over the refinement splits)
makes it usable without a presenter. Also adds a card to the docs examples
gallery and the design spec.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the feat label Oct 8, 2026
kylebarron and others added 2 commits October 7, 2026 22:28
The explainer's code is LLM-generated and unreviewed, so it shouldn't sit
with the examples meant for learning and reuse. It moves to a new
examples/explainers/ folder, with its own "Explainers" section on the docs
examples page and in examples/README.md. Both say the code is unreviewed.

The published URL stays flat (/examples/reprojection-explainer/): the docs
workflow builds examples/explainers/*/ and drops the folder name, as it
already does for examples/experimental/.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kylebarron
kylebarron enabled auto-merge (squash) October 8, 2026 04:37
@kylebarron
kylebarron merged commit 9cfe7f2 into main Oct 8, 2026
4 checks passed
@kylebarron
kylebarron deleted the kyle/reprojection-explainer branch October 8, 2026 04:39
@jo-chemla

jo-chemla commented Oct 8, 2026 •

Copy link
Copy Markdown

Impressive reprojection explainer!

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.

2 participants