mirror of
https://github.com/1bardesign/batteries.git
synced 2024-11-10 02:31:48 +00:00
Added vec2:signi and vec2:sign to get the sign of each component
This commit is contained in:
parent
bcd94c134e
commit
a73a44f424
14
vec2.lua
14
vec2.lua
@ -433,6 +433,20 @@ function vec2:abs()
|
|||||||
return self:copy():absi()
|
return self:copy():absi()
|
||||||
end
|
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
|
-- truncation/rounding
|
||||||
-----------------------------------------------------------
|
-----------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user