Merge branch '0.9.5' of https://github.com/g-truc/glm into 0.9.5

This commit is contained in:
Christophe Riccio 2013-12-26 00:25:39 +01:00
commit 13676679ab

View File

@ -18,10 +18,12 @@ namespace glm
{ {
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'angle' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'angle' only accept floating-point inputs");
genType Dot = clamp(dot(x, y), genType(0), genType(1));
#ifdef GLM_FORCE_RADIANS #ifdef GLM_FORCE_RADIANS
return acos(dot(x, y)); return acos(Dot);
#else #else
return degrees(acos(dot(x, y))); return degrees(acos(Dot));
#endif #endif
} }
@ -34,10 +36,12 @@ namespace glm
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'angle' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'angle' only accept floating-point inputs");
T Dot = clamp(dot(x, y), T(0), T(1));
#ifdef GLM_FORCE_RADIANS #ifdef GLM_FORCE_RADIANS
return acos(dot(x, y)); return acos(Dot);
#else #else
return degrees(acos(dot(x, y))); return degrees(acos(Dot));
#endif #endif
} }
@ -51,10 +55,12 @@ namespace glm
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'orientedAngle' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'orientedAngle' only accept floating-point inputs");
T Dot = clamp(dot(x, y), T(0), T(1));
#ifdef GLM_FORCE_RADIANS #ifdef GLM_FORCE_RADIANS
T const Angle(acos(dot(x, y))); T const Angle(acos(Dot));
#else #else
T const Angle(degrees(acos(dot(x, y)))); T const Angle(degrees(acos(Dot)));
#endif #endif
detail::tvec2<T, P> const TransformedVector(glm::rotate(x, Angle)); detail::tvec2<T, P> const TransformedVector(glm::rotate(x, Angle));
if(all(epsilonEqual(y, TransformedVector, T(0.01)))) if(all(epsilonEqual(y, TransformedVector, T(0.01))))
@ -73,10 +79,12 @@ namespace glm
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'orientedAngle' only accept floating-point inputs"); GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'orientedAngle' only accept floating-point inputs");
T Dot = clamp(dot(x, y), T(0), T(1));
#ifdef GLM_FORCE_RADIANS #ifdef GLM_FORCE_RADIANS
T const Angle(acos(dot(x, y))); T const Angle(acos(Dot));
#else #else
T const Angle(degrees(acos(dot(x, y)))); T const Angle(degrees(acos(Dot)));
#endif #endif
if(dot(ref, cross(x, y)) < T(0)) if(dot(ref, cross(x, y)) < T(0))