Implemented R-Tree

Would like to switch the identifer of the hole to a random string.
This commit is contained in:
2025-11-23 13:29:57 -05:00
parent 36c648cfe5
commit c208d069bb
11 changed files with 113 additions and 33 deletions

View File

@@ -14,3 +14,14 @@ static func chunk_array(arr: Array, chunk_size: int) -> Array:
static func vector2_to_vector3(v: Vector2) -> Vector3:
return Vector3(v.x, v.y, 0)
static func get_bounding_rect(vectors: PackedVector2Array) -> Rect2:
if vectors.is_empty():
return Rect2()
var rect := Rect2(vectors[0], Vector2.ZERO) # Initialize with the first point
for point in vectors:
rect = rect.expand(point)
# The 'position' of the Rect2 will be the minimum corner
return rect