Code cleanup

This commit is contained in:
Matthias Richter 2012-05-19 01:34:56 +02:00
parent b259e75208
commit 4f03a71f59

View File

@ -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)