PolygonTileOverlap

AUTO-GENERATED FILE – DO NOT EDIT MANUALLY

Utility functions for polygon-tile overlap calculations.

Provides static methods for geometric calculations used by both CollisionMapper and PolygonTileMapper to avoid code duplication.

Source File: addons/grid_building/placement/manager/components/mapper/polygon_tile_overlap.gd

Public Methods

compute_overlap_area

1
2
3
4
compute_overlap_area(
    polygon: PackedVector2Array,
    rect: Rect2
) -> float

Flags: static

Compute precise overlap area (world units^2) between a polygon and a rectangular tile using Sutherland–Hodgman clipping followed by the shoelace formula. Parameters: • polygon: PackedVector2Array – world points. • rect: Rect2 – tile rect in world. Returns: float – overlap area (>= 0).


Private Methods

_compute_polygon_bounds

1
_compute_polygon_bounds(polygon: PackedVector2Array) -> Rect2

Flags: static, private

Helper: Compute polygon bounding rectangle


_clip_polygon_to_rect

1
2
3
4
_clip_polygon_to_rect(
    polygon: PackedVector2Array,
    rect: Rect2
) -> PackedVector2Array

Flags: static, private

Helper: Clip polygon against rectangle using Sutherland-Hodgman algorithm


_point_inside_boundary

1
2
3
4
_point_inside_boundary(
    point: Vector2,
    boundary: Dictionary
) -> bool

Flags: static, private

Helper: Test if point is inside clipping boundary


_compute_intersection

1
2
3
4
5
_compute_intersection(
    a: Vector2,
    b: Vector2,
    boundary: Dictionary
) -> Vector2

Flags: static, private

Helper: Compute line-boundary intersection


_compute_polygon_area

1
_compute_polygon_area(polygon: PackedVector2Array) -> float

Flags: static, private

Helper: Compute polygon area using shoelace formula