From 7ae00deee72def232a5fa2825d47c164e2218f73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 5 Jan 2013 23:27:49 +0100 Subject: [PATCH] Math: removed constexpr from non-trivial Quaternion methods. They will probably involve SIMD operations, which cannot be implemented as constexpr. --- src/Math/Quaternion.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Math/Quaternion.h b/src/Math/Quaternion.h index dac5f1a39..4effe4f28 100644 --- a/src/Math/Quaternion.h +++ b/src/Math/Quaternion.h @@ -79,7 +79,7 @@ template class Quaternion { * * @see operator*=(T) */ - inline constexpr Quaternion operator*(T scalar) const { + inline Quaternion operator*(T scalar) const { return Quaternion(*this)*=scalar; } @@ -88,7 +88,7 @@ template class Quaternion { * * @see operator/=(T) */ - inline constexpr Quaternion operator/(T scalar) const { + inline Quaternion operator/(T scalar) const { return Quaternion(*this)/=scalar; } @@ -97,7 +97,7 @@ template class Quaternion { * * The computation is *not* done in-place. */ - inline constexpr Quaternion operator*(const Quaternion& other) const { + inline Quaternion operator*(const Quaternion& other) const { return {_scalar*other._vector + other._scalar*_vector + Vector3::cross(_vector, other._vector), _scalar*other._scalar - Vector3::dot(_vector, other._vector)}; } @@ -112,22 +112,22 @@ template class Quaternion { } /** @brief %Quaternion length squared */ - inline constexpr T lengthSquared() const { + inline T lengthSquared() const { return _vector.dot() + _scalar*_scalar; } /** @brief %Quaternion length */ - inline constexpr T length() const { + inline T length() const { return std::sqrt(lengthSquared()); } /** @brief Normalized quaternion */ - inline constexpr Quaternion normalized() const { + inline Quaternion normalized() const { return (*this)/length(); } /** @brief Conjugated quaternion */ - inline constexpr Quaternion conjugated() const { + inline Quaternion conjugated() const { return {-_vector, _scalar}; } @@ -137,7 +137,7 @@ template class Quaternion { * If the quaternion is already normalized, this function is * equivalent to conjugated(). */ - inline constexpr Quaternion inverted() const { + inline Quaternion inverted() const { return conjugated()/lengthSquared(); }