Added vec2:signi and vec2:sign to get the sign of each component

This commit is contained in:
Max Cahill 2021-06-08 11:49:29 +10:00
parent bcd94c134e
commit a73a44f424

View File

@ -433,6 +433,20 @@ function vec2:abs()
return self:copy():absi()
end
-----------------------------------------------------------
-- sign
-----------------------------------------------------------
function vec2:signi()
self.x = math.sign(self.x)
self.y = math.sign(self.y)
return self
end
function vec2:sign()
return self:copy():signi()
end
-----------------------------------------------------------
-- truncation/rounding
-----------------------------------------------------------