Grid Placement

PolygonTileMapper

AUTO-GENERATED FILE — DO NOT EDIT MANUALLY

Source: placement/manager/components/mapper/polygon_tile_mapper.gd

Version: 5.0

class_name: PolygonTileMapper extends: (none)

Summary

Handles polygon-to-tile-offset conversion with testable, separated concerns.

This class extracts the complex polygon processing logic from CollisionMapper to enable better testing and separation of responsibilities.

Coordinate semantics

  • Tile addressing is center-based. For 16×16 tiles, the center is at +8,+8 from the tile origin.
  • Tests and runtime share “bottom-inclusive, top-exclusive” behavior on axis-aligned boundaries to avoid fencepost rows when a polygon edge lies exactly on a tile boundary.

Pipeline stages:

  1. Transform polygon to world space and compute initial tile coverage
  2. Apply trapezoid expansion heuristics for convex polygons when beneficial
  3. Prune concave polygon fringes to remove unwanted overhangs
  4. Filter tiles by minimum area overlap to remove slivers (with concave center-point check)

Signals

(none)

Exports

(none)

Methods

  • print_diagnostics()