diff options
| author | the lemons <citrons@mondecitronne.com> | 2023-04-24 15:20:36 -0500 |
|---|---|---|
| committer | the lemons <citrons@mondecitronne.com> | 2023-04-24 15:20:36 -0500 |
| commit | 425c5dae3521479a694528dff33d32989662dda7 (patch) | |
| tree | 5623e58763c41bd6a3c2e86691295751e21326b3 /util.lua | |
| parent | 0d2f8775b11b604adc0f9adf73c8f6379e075ad5 (diff) | |
obj:avel_to_accel (broken)
Diffstat (limited to 'util.lua')
| -rw-r--r-- | util.lua | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -31,4 +31,12 @@ function M.rot(a, x, y) return x*math.cos(a) - y*math.sin(a), x*math.sin(a) + y*math.cos(a) end +function M.magnitude(v) + local s = 0 + for _, a in ipairs(v) do + s = s + a*a + end + return math.sqrt(s) +end + return M |
