Browse Source

Math: document that Quaternion::rotationAxis() might return NaN vector.

pull/7/head
Vladimír Vondruš 13 years ago
parent
commit
4c1608378a
  1. 4
      src/Math/Quaternion.h
  2. 4
      src/Math/Test/QuaternionTest.cpp

4
src/Math/Quaternion.h

@ -170,7 +170,9 @@ template<class T> class Quaternion {
/**
* @brief Rotation axis of unit quaternion
*
* Expects that the quaternion is normalized. @f[
* Expects that the quaternion is normalized. Returns either unit-length
* vector for valid rotation quaternion or NaN vector for
* default-constructed quaternion. @f[
* \boldsymbol a = \frac{\boldsymbol q_V}{\sqrt{1 - q_S^2}}
* @f]
* @see rotationAngle(), rotation()

4
src/Math/Test/QuaternionTest.cpp

@ -213,6 +213,10 @@ void QuaternionTest::rotation() {
CORRADE_COMPARE(q2, Quaternion(Vector3(-0.5f, -0.5f, -0.5f), 0.5f));
CORRADE_COMPARE(q2.rotationAngle(), deg(120.0f));
CORRADE_COMPARE(q2.rotationAxis(), -axis);
/* Default-constructed quaternion has zero angle and NaN axis */
CORRADE_COMPARE(Quaternion().rotationAngle(), deg(0.0f));
CORRADE_VERIFY(Quaternion().rotationAxis() != Quaternion().rotationAxis());
}
void QuaternionTest::angle() {

Loading…
Cancel
Save