Implemented R-Tree
Would like to switch the identifer of the hole to a random string.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user