I've been recently learning about quaternions and the amazing things you can do (mainly slerp for rotational smoothness), and looking through the code on the wiki, there is nothing about this part which is explained or anything, it's just there. Can someone please help me understand what this variable is and what role it plays in the quaternion?
local trace=m00+m11+m22
if trace>0 then
local s=math.sqrt(1+trace)
local r=0.5/s
Thanks in advance!

2 comments
That's a tough one... xD I still am a noob in LUA.
Trace refers to the trace of a matrix. Which is just the sum of its diagonal. The snipped you posted is just a part of the conversion between a rotation matrix and quaternions