Draft — Unreleased:This page is in active development. APIs, class names, and behavior may change before the release is finalized. Use it as a preview of what's coming — not as a stable integration target.
Handles polygon-to-tile-offset conversion with testable, separated concerns. This class extracts the complex polygon processing logic from CollisionMapper2D 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)
Source: addons/grid_placement/placement/manager/components/mapper/polygon_tile_mapper.gd
Syntax
class PolygonTileMapperMembers
| Name | Kind | Summary |
|---|---|---|
MIN_POLY_TILE_OVERLAP_RATIO | Field | |
default_ratio | Property | Configuration for area-based filtering thresholds |
convex_ratio | Property | |
expanded_trapezoid_ratio | Property | |
expansion_candidate_ratio | Property | |
offsets | Property | Result of polygon processing with diagnostic information |
did_expand_trapezoid | Property | |
was_convex | Property | |
initial_offset_count | Property | |
final_offset_count | Property | |
print_diagnostics | Method | |
compute_tile_offsets | Method | |
center_tile | Property | |
compute_tile_offsets_with_positioner | Method | |
center_tile | Property | |
world_points | Property | |
tile_size | Property | |
has_tile_shape | Property | |
tile_shape_val | Property | |
offsets | Property | |
tile_shape_val | Property | |
offsets | Property | |
is_convex | Property | |
did_expand_trapezoid | Property | |
expansion_result | Property | |
thresholds | Property | |
min_area | Property | |
filtered | Property | |
abs_tile | Property | |
tile_rect | Property | |
area | Property | |
process_polygon_with_diagnostics | Method | |
result | Property | |
center_tile | Property | |
world_points | Property | |
tile_size | Property | |
has_tile_shape | Property | |
tile_shape_val | Property | |
offsets | Property | |
expansion_result | Property | |
thresholds | Property | |
result | Property | |
analysis | Property | |
hollow_shape | Property | |
expanded | Property | |
validated | Property | |
min_ratio | Property | |
min_area | Property | |
filtered | Property | |
abs_tile | Property | |
tile_rect | Property | |
area | Property | |
should_include | Property | |
tile_center_world | Property | |
eps | Property | |
xs | Property | |
ys | Property | |
found_x | Property | |
found_y | Property | |
bounds | Property | |
height_tiles | Property | |
max_y | Property | |
adjusted | Property | |
ys | Property | |
xs_by_y | Property | |
validated | Property | |
tile_area | Property | |
min_expansion_area | Property | |
abs_tile | Property | |
tile_center_local | Property | |
tile_rect | Property | |
area | Property | |
original_set | Property | |
tile_center_local | Property | |
tile_center_world | Property | |
get_polygon_tile_overlap_area | Method | |
poly_bounds | Property | |
is_rect | Property | |
corners | Property | |
found | Property |
Source
addons/grid_placement/placement/manager/components/mapper/polygon_tile_mapper.gd
Plugin docs root:gdscript/plugins/grid_placement_dev/docs