don't give NaN's when normalizing 0

This commit is contained in:
Colby Klein 2016-12-13 15:10:09 -08:00
parent ff7cc186e7
commit 5fffa2f9d8

View File

@ -133,6 +133,9 @@ end
-- @treturn vec3 out
function vec3.normalize(out, a)
local l = vec3.len(a)
if l == 0 then
return out
end
out.x = a.x / l
out.y = a.y / l
out.z = a.z / l