Repository navigation
perf: rasterise Danseiji base maps without walking the edge per pixel - #48
Merged
Merged
Conversation
- MapBounds.crossings(atY:) gives where a polygon boundary crosses a row; the tile and single-image samplers test each row's pixels against it instead of walking the polygon per pixel - Danseiji's inverse tests its edge through a precomputed InsideGrid; only cells the edge crosses walk the polygon - Danseiji IV bounds plus inverse over 1.25M points: 1.35 s to 0.07 s on an M-series Mac, single-threaded Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
nighthawk
added a commit
that referenced
this pull request
Oct 28, 2026
…#48) - MapBounds.crossings(atY:) gives where a polygon boundary crosses a row; the tile and single-image samplers test each row's pixels against it instead of walking the polygon per pixel - Danseiji's inverse tests its edge through a precomputed InsideGrid; only cells the edge crosses walk the polygon - Danseiji IV bounds plus inverse over 1.25M points: 1.35 s to 0.07 s on an M-series Mac, single-threaded Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #46. Maparoni's MCP tools now offer the Danseiji projections (maparoni/lambdaroni#290). A Danseiji IV render on Blue Marble took about 15 s on
lambdaroni-dev, and the same render on street tiles hit Phoenix's 15 s timeout.The time went into Danseiji's 388-vertex edge polygon, which was walked twice for every output pixel. The sampler walked it to check the map bounds, then Danseiji's
inversewalked it again. A 1200 px render is about a million pixels, and the Lambda's 512 MB gets a fraction of a vCPU.MapBounds.crossings(atY:)gives a polygon boundary's crossings for one row. The samplers compute these once per row and test each pixel against them. Every polygon-bounded projection benefits.InsideGrid, a 128×128 grid that knows which cells are inside, outside or on the edge. Only the edge cells walk the polygon.Danseiji IV's bounds check plus inverse over 1.25M points took 1.35 s before and 0.07 s after, single-threaded on an M-series Mac.
Testing:
swift test. New tests check that the grid and the row crossings agree with the full polygon walk on random points. That covers all six Danseiji edges, including points nudged onto the edge itself.🤖 Generated with Claude Code