Skip to content

PolygonTileMapper

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.

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. Align narrow parented polygons to match local positioning
  5. Filter tiles by minimum area overlap to remove slivers
compute_tile_offsets( polygon_node: CollisionPolygon2D, map: TileMapLayer ) -> Array[Vector2i]

Primary entry point for polygon-to-tile conversion

process_polygon_with_diagnostics( polygon_node: CollisionPolygon2D, map: TileMapLayer ) -> ProcessingResult

Full processing with diagnostic information for testing and debugging

addons/grid_building/placement/manager/components/mapper/polygon_tile_mapper.gd


This page was auto-generated from GDScript source. Edit the source file to improve documentation.

Generated on 2025-09-07