diff options
Diffstat (limited to 'builtin/common/vector.lua')
-rw-r--r-- | builtin/common/vector.lua | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/builtin/common/vector.lua b/builtin/common/vector.lua index 88ccfe6da..e9ed3aab3 100644 --- a/builtin/common/vector.lua +++ b/builtin/common/vector.lua @@ -39,6 +39,14 @@ function vector.round(v) } end +function vector.apply(v, func) + return { + x = func(v.x), + y = func(v.y), + z = func(v.z) + } +end + function vector.distance(a, b) local x = a.x - b.x local y = a.y - b.y |