Add AABB.size (#445)

This commit is contained in:
Cooldude2606 authored and GitHub committed 2026-06-27 14:02:49 +01:00
1 parent 27b1a34a83
commit 4fe0e9c0a6
4 files changed
+10 -4

No files matched your search

+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