@@ -1,10 +1,8 @@ local fn = {} fn.vsep = function(vec) -- separate a vector into a direction + magnitude - local magnitude = math.max(math.abs(vec.x), math.abs(vec.y), math.abs(vec.z)) - local inv = 1 / magnitude - return vector.multiply(vec,inv), magnitude + return vec:normalize(), vec:length() end fn.vdcomp = function(dist,v1,v2) -- compare the distance between two points -- (cheaper than calculating distance outright)