Vector: Add vector.sort(a, b): return box edges

This function returns the box corners of the smallest box
that includes the two given coordinates.
This commit is contained in:
Auke Kok 2017-01-12 11:27:39 -08:00 committed by Nils Dagsson Moskopp
parent e48d06f7c7
commit 944e5ca4e9
Signed by: erle
GPG Key ID: A3BC671C35191080
1 changed files with 5 additions and 0 deletions

View File

@ -138,3 +138,8 @@ function vector.divide(a, b)
z = a.z / b}
end
end
function vector.sort(a, b)
return {x = math.min(a.x, b.x), y = math.min(a.y, b.y), z = math.min(a.z, b.z)},
{x = math.max(a.x, b.x), y = math.max(a.y, b.y), z = math.max(a.z, b.z)}
end