Skip to content

fix(mapgen-studio): odd-Q flat-top orientation, canonical hex-space lattice, and tile-mesh contract#1638

Merged
mateicanavra merged 1 commit into
mainfrom
design/tile-orientation
Jun 12, 2026
Merged

fix(mapgen-studio): odd-Q flat-top orientation, canonical hex-space lattice, and tile-mesh contract#1638
mateicanavra merged 1 commit into
mainfrom
design/tile-orientation

Conversation

@mateicanavra

Copy link
Copy Markdown
Owner

Fixes tile.hexOddQ layers rendering with the wrong hex orientation and establishes a consistent tile-mesh visual contract.

Hex orientation fix

tile.hexOddQ was incorrectly rendered using pointy-top geometry — the same path as tile.hexOddR — producing rotated tiles on a sheared lattice. Column-offset (odd-Q) layouts are flat-top by construction. The fix aligns odd-Q rendering with mapgen-core's canonical hex space (projectOddqToHexSpace): columns √3·size apart, rows 1.5·size apart, odd columns shifted down 0.75·size. This is the same coordinate frame the Delaunay mesh and all world.xy layers are built in, so tile layers now co-register correctly with mesh and world stages.

A new hexPolygonOddQ function produces the flat-top hexagon that exactly tiles this lattice (vertical pitch compressed to the 1.5·size row spacing, no gaps or overlaps). The grid geometry builder dispatches to hexPolygonOddQ or hexPolygonPointy based on space. The boundsForTileGrid odd-Q branch is corrected to cover the same lattice. The intermediate pointy-top axial conversion helpers that were previously used for both spaces are removed.

Tile-mesh contract

  • UNKNOWN_COLOR (noData and non-finite values) is now fully transparent, so unfilled tiles draw nothing and leave no phantom mesh over the canvas background.
  • Hex stroke alpha follows the tile's fill alpha — transparent tiles also drop their borders.
  • The hardcoded near-black border literal is replaced with an exported TILE_BORDER_COLOR, a mid-luminance slate that remains legible against white, black, and graphite canvas backgrounds.

Tests added

  • Per-space vertex orientation assertions confirming odd-R is pointy-top and odd-Q is flat-top.
  • Canonical lattice spacing verification for odd-Q (column pitch, row pitch, odd-column offset).
  • noData tile invisibility: zero fill alpha and zero stroke alpha, with a filled neighbor retaining its border.

This was referenced Jun 12, 2026
@github-actions

Copy link
Copy Markdown

Railway preview (MapGen Studio): not provisioned for this PR.

Policy (Graphite stacks): previews are created only for the top-of-stack PR by default.

  • To force a preview for this PR: add label railway-preview
  • To suppress a preview: add label no-railway-preview

Debug: {"isClosed":false,"isFork":false,"suppress":false,"force":false,"isTopOfStack":false,"hasToken":true,"draft":false}

mateicanavra commented Jun 12, 2026

Copy link
Copy Markdown
Owner Author

Merge activity

  • Jun 12, 8:50 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jun 12, 9:59 PM UTC: Graphite rebased this pull request as part of a merge.
  • Jun 12, 9:59 PM UTC: @mateicanavra merged this pull request with Graphite.

@mateicanavra
mateicanavra changed the base branch from design/grid-icon to graphite-base/1638 June 12, 2026 21:56
@mateicanavra
mateicanavra changed the base branch from graphite-base/1638 to main June 12, 2026 21:57
…space lattice + tile-mesh contract (transparent noData, shared border ink)
@mateicanavra
mateicanavra force-pushed the design/tile-orientation branch from edc6c49 to dd1b7c0 Compare June 12, 2026 21:58
@mateicanavra
mateicanavra merged commit 25f475c into main Jun 12, 2026
This was referenced Jun 12, 2026
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.

1 participant