Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

Geometry2D

Inherits: Object

Provides methods for some common 2D geometric operations.

Description

Provides a set of helper functions to create geometric shapes, compute intersections between shapes, and process various other geometric operations in 2D.

Methods

PackedVector2Array[]

clip_polygons ( PackedVector2Array polygon_a, PackedVector2Array polygon_b )

PackedVector2Array[]

clip_polyline_with_polygon ( PackedVector2Array polyline, PackedVector2Array polygon )

PackedVector2Array

convex_hull ( PackedVector2Array points )

PackedVector2Array[]

decompose_polygon_in_convex ( PackedVector2Array polygon )

PackedVector2Array[]

exclude_polygons ( PackedVector2Array polygon_a, PackedVector2Array polygon_b )

Vector2

get_closest_point_to_segment ( Vector2 point, Vector2 s1, Vector2 s2 )

Vector2

get_closest_point_to_segment_uncapped ( Vector2 point, Vector2 s1, Vector2 s2 )

PackedVector2Array

get_closest_points_between_segments ( Vector2 p1, Vector2 q1, Vector2 p2, Vector2 q2 )

PackedVector2Array[]

intersect_polygons ( PackedVector2Array polygon_a,