Skip to content

feat: rotated geographic world reference - #3

Merged
neovolgan merged 1 commit into
developfrom
claude/rotated-projection
Oct 16, 2026
Merged

neovolgan merged 1 commit into
developfrom
claude/rotated-projection

Conversation

@neovolgan

Copy link
Copy Markdown
Collaborator

Implements section 1 of the transfer contract (#2).

What changes

  • WorldGeoReference.RotationDegrees:
    • range −45…45, default 0;
    • rotates the local (east, south) metric plane about the bounds centre;
    • placement is anchored to the rotated bounds' minimum corner, at the origin cell.
  • With rotation 0, Project and Geographic run the original formulas verbatim, so existing worlds project bit-identically. A test compares them against the old expression.
  • SectionBounds is the lon/lat box of the section's four corners, clipped to the reference.
  • RequiredTiles uses the rotated corners.
  • A rotated reference raises the world format to 7, in C# and JS, so an older editor refuses such a file instead of dropping the rotation. Unrotated worlds keep their version.
  • OsmWorldImportRequest gains RotationDegrees = 0, so the UI can expose it later.
  • worldGeographic (world-geography.js), used by the elevation overlay, mirrors the core projection.

Tests

  • RotatedProjectionTests:
    • round-trip in several sections;
    • a street at bearing 11.22° becomes a grid column;
    • rotated bounds are anchored at the origin;
    • the section source box covers all corners;
    • validation rejects out-of-range and non-finite rotations;
    • version 7.
  • Importer test: a 16×10 m house drawn skewed in real lon/lat imports under the rotated reference exactly like a north-aligned house under an unrotated one (same position, size and footprint kind). Its original lon/lat stays in SourceFeatures untouched.
  • JS: worldGeographic matches values printed by the C# projection to within 1e-11°; unrotated output is unchanged.
  • Results:
    • dotnet run --project tests/SimplePZMapmaker.Tests (with PZMAP_WORKSPACE set): 338/338 passed;
    • npm test: 184/184 passed.

For Pilna this gives 4774×5521 tiles at 1 m/tile with θ = −11.22, using real coordinates instead of the pre-rotated pseudo lon/lat the pipeline used until now.

🤖 Generated with Claude Code

https://claude.ai/code/session_015ECCGjSrSADcjxBmXdCBpm


Generated by Claude Code

WorldGeoReference.RotationDegrees (-45..45) rotates the local metric plane
before it is laid on the tile grid, so a street grid that is not
north-aligned imports axis-aligned while source lon/lat stay real.
Placement is anchored to the rotated bounds' minimum corner; with no
rotation the original formulas run verbatim. SectionBounds and
RequiredTiles use the rotated corners. A rotated reference raises the
world format to 7; the OSM world import request accepts the rotation and
the editor's world-to-lon/lat helper mirrors the core projection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015ECCGjSrSADcjxBmXdCBpm
@neovolgan
neovolgan added this pull request to stack #7 October 16, 2026 21:14
@neovolgan
neovolgan merged commit 81d162e into develop Oct 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants