Stateless collision geometry math: Sutherland-Hodgman polygon clipping for polygon-rectangle overlap, plus shoelace area and point/intersection tests. Clipping handles both convex and concave polygons. The polygon clips against the four rectangle boundaries in turn; the area of the result decides whether the overlap meets the threshold. Default thresholds: 0.01 edge epsilon and 0.05 minimum overlap ratio, so sub-5% micro-overlaps are ignored. All clipping methods are public for unit testing.
Source: addons/grid_placement/placement/manager/components/collision_geometry_calculator.gd
Syntax
class CollisionGeometryCalculator extends RefCountedMembers
| Name | Kind | Summary |
|---|---|---|
debug_polygon_overlap | Property | |
AREA_REL_EPS | Field | |
AREA_ABS_EPS | Field | |
calculate_tile_overlap | Method | |
calculate_tile_overlap_numeric | Method | |
overlapped_tiles | Property | |
bounds | Property | |
start_tile | Property | |
end_tile | Property | |
tile_pos | Property | |
tile_world_center | Property | |
tile_rect | Property | |
overlapped_tiles | Property | |
bounds | Property | |
tile_range | Property | |
start_tile | Property | |
end_exclusive | Property | |
tile_pos | Property | |
tile_world_center | Property | |
tile_size_vec | Property | |
tile_rect | Property | |
overlapped_tiles | Property | |
bounds | Property | |
span | Property | |
tile_pos | Property | |
tile_world_center | Property | |
tile_size | Property | |
half_width | Property | |
half_height | Property | |
tile_diamond | Property | |
overlapped_tiles | Property | |
bounds | Property | |
span | Property | |
tile_pos | Property | |
tile_world_center | Property | |
tile_size | Property | |
half_w | Property | |
quarter_h | Property | |
half_h | Property | |
tile_hex | Property | |
polygons_overlap | Method | |
polygon_overlaps_rect | Method | |
clip_polygon_to_rect | Method | |
point_inside_boundary | Method | |
polygon_area | Method | |
point_in_polygon | Method |