Add AABB.size (#445)

This commit is contained in:
Cooldude2606
2026-06-27 14:02:49 +01:00
committed by GitHub
parent 27b1a34a83
commit 4fe0e9c0a6
4 changed files with 10 additions and 4 deletions
+7
View File
@@ -17,6 +17,13 @@ function AABB.valid(aabb)
return aabb.left_top.x < aabb.right_bottom.x and aabb.left_top.y < aabb.right_bottom.y
end
--- Returns the size of the area contained within an AABB
--- @param aabb BoundingBox
--- @return number
function AABB.size(aabb)
return (aabb.right_bottom.x - aabb.left_top.x) * (aabb.right_bottom.y - aabb.left_top.y)
end
--- Clone an area, allows for safe mutation of an input value
--- @param aabb BoundingBox
--- @return BoundingBox