From 2468d2497f8cc856e4b08704912331e69cacc4e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 24 Feb 2013 14:15:40 +0100 Subject: [PATCH] Math: doc++ --- doc/matrix-vector.dox | 4 ++-- src/Math/DualQuaternion.h | 14 +++++++------- src/Math/Matrix3.h | 5 +++-- src/Math/Matrix4.h | 7 ++++--- src/Math/Quaternion.h | 2 +- 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/doc/matrix-vector.dox b/doc/matrix-vector.dox index c1ded9d3f..c12adb0b6 100644 --- a/doc/matrix-vector.dox +++ b/doc/matrix-vector.dox @@ -128,8 +128,8 @@ Color3 and Color4 name their components `rgba` instead of `xyzw`. For more involved operations with components there is the swizzle() function: @code -Vector4 original(-1, 2, 3, 4); -Vector4 bgra = swizzle<'b', 'g', 'r', 'a'>(original); // { 3, 2, -1, 4 } +Vector<4, int> original(-1, 2, 3, 4); +Vector<4, int> bgra = swizzle<'b', 'g', 'r', 'a'>(original); // { 3, 2, -1, 4 } Vector<6, int> w10xyz = swizzle<'w', '1', '0', 'x', 'y', 'z'>(original); // { 4, 1, 0, -1, 2, 3 } @endcode diff --git a/src/Math/DualQuaternion.h b/src/Math/DualQuaternion.h index d528c1a5a..8c2e87b82 100644 --- a/src/Math/DualQuaternion.h +++ b/src/Math/DualQuaternion.h @@ -212,7 +212,7 @@ template class DualQuaternion: public Dual> { return Math::sqrt(lengthSquared()); } - /** @brief Normalized quaternion (of unit length) */ + /** @brief Normalized dual quaternion (of unit length) */ inline DualQuaternion normalized() const { return (*this)/length(); } @@ -220,9 +220,9 @@ template class DualQuaternion: public Dual> { /** * @brief Inverted dual quaternion * - * See invertedNormalized() which is faster for normalized - * dual quaternions. @f[ - * \hat q^{-1} = \frac{\hat q^*}{||\hat q||^2} + * See invertedNormalized() which is faster for normalized dual + * quaternions. @f[ + * \hat q^{-1} = \frac{\hat q^*}{|\hat q|^2} * @f] */ inline DualQuaternion inverted() const { @@ -234,7 +234,7 @@ template class DualQuaternion: public Dual> { * * Equivalent to quaternionConjugated(). Expects that the quaternion is * normalized. @f[ - * \hat q^{-1} = \frac{\hat q^*}{||\hat q||^2} = \hat q^* + * \hat q^{-1} = \frac{\hat q^*}{|\hat q|^2} = \hat q^* * @f] * @see inverted() */ @@ -249,7 +249,7 @@ template class DualQuaternion: public Dual> { * * See transformPointNormalized(), which is faster for normalized dual * quaternions. @f[ - * v' = qv \overline{\hat q^{-1}} = q ([\boldsymbol 0, 1] + \epsilon [\boldsymbol v, 0]) \overline{\hat q^{-1}} + * v' = \hat q v \overline{\hat q^{-1}} = \hat q ([\boldsymbol 0, 1] + \epsilon [\boldsymbol v, 0]) \overline{\hat q^{-1}} * @f] * @see DualQuaternion(const Vector3&), dual(), Matrix4::transformPoint(), * Quaternion::transformVector() @@ -263,7 +263,7 @@ template class DualQuaternion: public Dual> { * * Faster alternative to transformPoint(), expects that the dual * quaternion is normalized. @f[ - * v' = qv \overline{\hat q^{-1}} = qv \overline{\hat q^*} = q ([\boldsymbol 0, 1] + \epsilon [\boldsymbol v, 0]) \overline{\hat q^*} + * v' = \hat q v \overline{\hat q^{-1}} = \hat q v \overline{\hat q^*} = \hat q ([\boldsymbol 0, 1] + \epsilon [\boldsymbol v, 0]) \overline{\hat q^*} * @f] * @see DualQuaternion(const Vector3&), dual(), Matrix4::transformPoint(), * Quaternion::transformVectorNormalized() diff --git a/src/Math/Matrix3.h b/src/Math/Matrix3.h index 3cd3f6135..e67e909cf 100644 --- a/src/Math/Matrix3.h +++ b/src/Math/Matrix3.h @@ -170,7 +170,7 @@ template class Matrix3: public Matrix<3, T> { * @brief Right-pointing 2D vector * * First two elements of first column. - * @see Vector2::xAxis() + * @see up(), Vector2::xAxis(), Matrix4::right() */ inline Vector2& right() { return (*this)[0].xy(); } inline constexpr Vector2 right() const { return (*this)[0].xy(); } /**< @overload */ @@ -179,7 +179,7 @@ template class Matrix3: public Matrix<3, T> { * @brief Up-pointing 2D vector * * First two elements of second column. - * @see Vector2::yAxis() + * @see right(), Vector2::yAxis(), Matrix4::up() */ inline Vector2& up() { return (*this)[1].xy(); } inline constexpr Vector2 up() const { return (*this)[1].xy(); } /**< @overload */ @@ -220,6 +220,7 @@ template class Matrix3: public Matrix<3, T> { * \boldsymbol v' = \boldsymbol M \begin{pmatrix} v_x \\ v_y \\ 0 \end{pmatrix} * @f] * @see Complex::transformVector(), Matrix4::transformVector() + * @todo extract 2x2 matrix and multiply directly? (benchmark that) */ inline Vector2 transformVector(const Vector2& vector) const { return ((*this)*Vector3(vector, T(0))).xy(); diff --git a/src/Math/Matrix4.h b/src/Math/Matrix4.h index 36af432c4..dfa9dad5f 100644 --- a/src/Math/Matrix4.h +++ b/src/Math/Matrix4.h @@ -308,7 +308,7 @@ template class Matrix4: public Matrix<4, T> { * @brief Right-pointing 3D vector * * First three elements of first column. - * @see Vector3::xAxis() + * @see up(), backward(), Vector3::xAxis(), Matrix3::right() */ inline Vector3& right() { return (*this)[0].xyz(); } inline constexpr Vector3 right() const { return (*this)[0].xyz(); } /**< @overload */ @@ -317,7 +317,7 @@ template class Matrix4: public Matrix<4, T> { * @brief Up-pointing 3D vector * * First three elements of second column. - * @see Vector3::yAxis() + * @see right(), backward(), Vector3::yAxis(), Matrix3::up() */ inline Vector3& up() { return (*this)[1].xyz(); } inline constexpr Vector3 up() const { return (*this)[1].xyz(); } /**< @overload */ @@ -326,7 +326,7 @@ template class Matrix4: public Matrix<4, T> { * @brief Backward-pointing 3D vector * * First three elements of third column. - * @see Vector3::yAxis() + * @see right(), up(), Vector3::yAxis() */ inline Vector3& backward() { return (*this)[2].xyz(); } inline constexpr Vector3 backward() const { return (*this)[2].xyz(); } /**< @overload */ @@ -367,6 +367,7 @@ template class Matrix4: public Matrix<4, T> { * \boldsymbol v' = \boldsymbol M \begin{pmatrix} v_x \\ v_y \\ v_z \\ 0 \end{pmatrix} * @f] * @see Quaternion::transformVector(), Matrix3::transformVector() + * @todo extract 3x3 matrix and multiply directly? (benchmark that) */ inline Vector3 transformVector(const Vector3& vector) const { return ((*this)*Vector4(vector, T(0))).xyz(); diff --git a/src/Math/Quaternion.h b/src/Math/Quaternion.h index a7c04bb22..de204ca00 100644 --- a/src/Math/Quaternion.h +++ b/src/Math/Quaternion.h @@ -44,7 +44,7 @@ template class Quaternion { * @brief Dot product * * @f[ - * p \cdot q = \boldsymbol p_V \cdot \boldsymbol q_V + p_S q_S + * p \cdot q = \boldsymbol p_V \cdot \boldsymbol q_V + p_S q_S * @f] * @see dot() const */