Artifact 4d5bf7109cee46969d2b24f6b38fcf6b762c98aed88e341c2f4307d50e6ee2f5:
- File lib/math.lua — part of check-in [b24c5f49c7] at 2021-07-05 03:07:21 on branch trunk — bug fixes, add spellshatter visuals, maybe finally defuckulate imbuement effect? (user: lexi, size: 471) [annotate] [blame] [check-ins using]
local fn = {} fn.vsep = function(vec) -- separate a vector into a direction + magnitude return vec:normalize(), vec:length() end fn.vdcomp = function(dist,v1,v2) -- compare the distance between two points -- (cheaper than calculating distance outright) local d if v2 then d = vector.subtract(v1,v2) else d = v1 end local dsq = (d.x ^ 2) + (d.y ^ 2) + (d.z ^ 2) return dsq / (dist^2) -- [0,1) == less then -- 1 == equal -- >1 == greater than end return fn