Skip to content
ct

Class

PlacementGeometryMath

Generated GDScript class reference for GridPlacement.PlacementGeometryMath.

Status
Draft
Version
v6.0
Updated
Development docs generated from GDScript source

This is unreleased documentation in active development. APIs, class names, and behavior may change before the final release.

Geometry & collision math utilities for the grid building addon. Provides compact, well-documented helper functions used across the addon for tile/polygon overlap and collision tasks. Main responsibilities include:

  • Computing polygon vs polygon intersection areas (uses Godot Geometry2D).
  • Producing tile polygons for square and isometric tiles and testing polygon overlaps against tiles (area-based and optimized native collision checks).
  • Converting various Shape2D types to polygon approximations for geometry processing (Rectangle, Circle, Capsule, ConvexPolygon, fallback to rect).
  • Utility helpers: axis-aligned rectangle detection and polygon bounding rect. Note: Tile shape enforcement: All functions use TileSet.TileShape enum values.[br] Use: TileSet.TILE_SHAPE_SQUARE, TileSet.TILE_SHAPE_ISOMETRIC, TileSet.TILE_SHAPE_HALF_OFFSET_SQUARE [br] Avoid using raw integers (0, 1, 2) or strings ("square", "isometric", etc.)

Source: addons/grid_placement/utils/placement_geometry_math.gd

Syntax

class PlacementGeometryMath

Members

NameKindSummary
polygon_intersection_areaMethod
get_tile_polygonMethod
intersection_area_with_tileMethod
does_polygon_overlap_tileMethod
does_shape_overlap_tile_optimizedMethod
does_polygon_overlap_tile_optimizedMethod
get_polygon_boundsMethod
convert_shape_to_polygonMethod
intersection_polygon_areaMethod
is_exact_polygon_matchMethod
exact_polygon_areaMethod
isometric_floating_point_fallbackMethod
closeProperty
square_bounding_box_fallbackMethod
min_tileProperty
max_tileProperty
tile_rectProperty
min_polyProperty
max_polyProperty
poly_rectProperty
intersection_rectProperty
intersection_areaProperty
overlap_xProperty
overlap_yProperty