Fixed build on MinGW

This commit is contained in:
Christophe Riccio 2011-06-02 10:08:44 +01:00
parent a0256b5946
commit 40f3e519a8

View File

@ -256,28 +256,28 @@ namespace quaternion
if(a <= typename detail::tquat<T>::value_type(0)) return x;
if(a >= typename detail::tquat<T>::value_type(1)) return y;
detail::tquat<T>::value_type fCos = dot(x, y);
T fCos = dot(x, y);
detail::tquat<T> y2(y); //BUG!!! tquat<T> y2;
if(fCos < typename detail::tquat<T>::value_type(0))
if(fCos < T(0))
{
y2 = -y;
fCos = -fCos;
}
//if(fCos > 1.0f) // problem
detail::tquat<T>::value_type k0, k1;
if(fCos > typename detail::tquat<T>::value_type(0.9999))
T k0, k1;
if(fCos > T(0.9999))
{
k0 = typename detail::tquat<T>::value_type(1) - a;
k1 = typename detail::tquat<T>::value_type(0) + a; //BUG!!! 1.0f + a;
k0 = T(1) - a;
k1 = T(0) + a; //BUG!!! 1.0f + a;
}
else
{
typename detail::tquat<T>::value_type fSin = sqrt(T(1) - fCos * fCos);
typename detail::tquat<T>::value_type fAngle = atan(fSin, fCos);
typename detail::tquat<T>::value_type fOneOverSin = T(1) / fSin;
k0 = sin((typename detail::tquat<T>::value_type(1) - a) * fAngle) * fOneOverSin;
k1 = sin((typename detail::tquat<T>::value_type(0) + a) * fAngle) * fOneOverSin;
T fSin = sqrt(T(1) - fCos * fCos);
T fAngle = atan(fSin, fCos);
T fOneOverSin = T(1) / fSin;
k0 = sin((T(1) - a) * fAngle) * fOneOverSin;
k1 = sin((T(0) + a) * fAngle) * fOneOverSin;
}
return detail::tquat<T>(
@ -295,7 +295,7 @@ namespace quaternion
T const & a
)
{
return glm::normalize(x * (detail::tquat<T>::value_type(1) - a) + (y * a));
return glm::normalize(x * (T(1) - a) + (y * a));
}
}//namespace quaternion