function math.sign(x) if x<0 then return -1 elseif x>0 then return 1 else return 0 end end function math.round(x) return math.floor(x+0.5) end function vector(x, y) return {x = x, y = y} end function getVectorValue(vector) return math.sqrt(vector.x ^ 2 + vector.y ^ 2) end function getAngleFromVector(vector) local reduce = 0 if vector.x < 0 then reduce = math.rad(180) end return math.atan(vector.y/vector.x) - reduce end