Paul sent me the following issue with the use of copysign in Christians alternative method which is described on this page. Since I don't have much expertise with C++ code and haven't used copysign myself I will pass on Pauls comments:

The article mentions an alternative method using _copysign(x,y) but a common behavior of this function is to return (+1) when y=0 given the following matrix 1 0 0 this alternate method produces different results Q.x = sqrt( max( 0, 1 + m00 - m11 - m22 ) ) / 2; producing Q.x = 0.7071068 whereas the original algorithm: qx = (m21 - m12) / ( 4 *qw ) here it is clear that when (m21 - m12) equals (0) then (qx) will be zero if you use a version of copysign that returns +1,0,-1 then it might work. |