function vector.normalize(v) local l = vector.length(v) if l == 0 then return vector.new(0,0,0) else return vector.divide(v, l) end end