make angle methods consistent on vectors
This commit is contained in:
parent
6c5ad34536
commit
fdc15e1fd8
|
@ -23,9 +23,9 @@ function vect:lengthSquared()
|
||||||
return self.x * self.x + self.y * self.y
|
return self.x * self.x + self.y * self.y
|
||||||
end
|
end
|
||||||
|
|
||||||
---@return number
|
---@return number @angle in degrees
|
||||||
function vect:angle()
|
function vect:angle()
|
||||||
return math.atan2(self.y, self.x)
|
return math.deg(math.atan2(self.y, self.x))
|
||||||
end
|
end
|
||||||
|
|
||||||
---@return vector2D
|
---@return vector2D
|
||||||
|
@ -44,6 +44,7 @@ function vect:resize(x)
|
||||||
return vector2D(n.x * x, n.y * x)
|
return vector2D(n.x * x, n.y * x)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@param ang number @angle in degrees
|
||||||
---@return vector2D
|
---@return vector2D
|
||||||
function vect:rotate(ang)
|
function vect:rotate(ang)
|
||||||
local a = self:angle()
|
local a = self:angle()
|
||||||
|
|
Loading…
Reference in New Issue