diff options
-rw-r--r-- | builtin/common/vector.lua | 5 | ||||
-rw-r--r-- | doc/lua_api.txt | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/builtin/common/vector.lua b/builtin/common/vector.lua index 90ba3cc8b..0549f9a56 100644 --- a/builtin/common/vector.lua +++ b/builtin/common/vector.lua @@ -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 diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 2a0b72053..31a1daefb 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1850,6 +1850,7 @@ Spatial Vectors * `vector.round(v)`: returns a vector, each dimension rounded to nearest int * `vector.apply(v, func)`: returns a vector * `vector.equals(v1, v2)`: returns a boolean +* `vector.sort(v1, v2)`: returns minp, maxp vectors of the cuboid defined by v1 and v2 For the following functions `x` can be either a vector or a number: |