Work around math.acos(-1) returning NaN on LuaJIT... sometimes.
This commit is contained in:
parent
6a5771348c
commit
18dd29d1b5
@ -139,6 +139,13 @@ function quaternion:to_axis_angle()
|
||||
local s = math.sqrt(1-self.w*self.w)
|
||||
local x, y, z
|
||||
|
||||
-- HACK: Why the fuck is this ever NaN?
|
||||
-- I suspect a LuaJIT optimization bug - it doesn't happen in the repl.
|
||||
if angle ~= angle then
|
||||
angle = math.pi * 2
|
||||
s = 0
|
||||
end
|
||||
|
||||
if s < constants.FLT_EPSILON then
|
||||
x = self.x
|
||||
y = self.y
|
||||
|
Loading…
x
Reference in New Issue
Block a user