mirror of
https://github.com/vrld/hump.git
synced 2024-11-23 12:24:19 +00:00
Code cleanup
This commit is contained in:
parent
b259e75208
commit
4f03a71f59
@ -116,14 +116,14 @@ end
|
|||||||
|
|
||||||
function vector:normalize_inplace()
|
function vector:normalize_inplace()
|
||||||
local l = self:len()
|
local l = self:len()
|
||||||
if l > 0 then self.x, self.y = self.x / l, self.y / l end
|
if l > 0 then
|
||||||
|
self.x, self.y = self.x / l, self.y / l
|
||||||
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
function vector:normalized()
|
function vector:normalized()
|
||||||
local l = self:len()
|
return self:clone():normalize_inplace()
|
||||||
if l == 0 then return self end
|
|
||||||
return self / l
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function vector:rotate_inplace(phi)
|
function vector:rotate_inplace(phi)
|
||||||
|
Loading…
Reference in New Issue
Block a user