Browse Source

Math: doc++

pull/278/head
Vladimír Vondruš 13 years ago
parent
commit
2468d2497f
  1. 4
      doc/matrix-vector.dox
  2. 14
      src/Math/DualQuaternion.h
  3. 5
      src/Math/Matrix3.h
  4. 7
      src/Math/Matrix4.h
  5. 2
      src/Math/Quaternion.h

4
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<int> original(-1, 2, 3, 4);
Vector4<int> 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

14
src/Math/DualQuaternion.h

@ -212,7 +212,7 @@ template<class T> class DualQuaternion: public Dual<Quaternion<T>> {
return Math::sqrt(lengthSquared());
}
/** @brief Normalized quaternion (of unit length) */
/** @brief Normalized dual quaternion (of unit length) */
inline DualQuaternion<T> normalized() const {
return (*this)/length();
}
@ -220,9 +220,9 @@ template<class T> class DualQuaternion: public Dual<Quaternion<T>> {
/**
* @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<T> inverted() const {
@ -234,7 +234,7 @@ template<class T> class DualQuaternion: public Dual<Quaternion<T>> {
*
* 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 T> class DualQuaternion: public Dual<Quaternion<T>> {
*
* 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 T> class DualQuaternion: public Dual<Quaternion<T>> {
*
* 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()

5
src/Math/Matrix3.h

@ -170,7 +170,7 @@ template<class T> 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<T>& right() { return (*this)[0].xy(); }
inline constexpr Vector2<T> right() const { return (*this)[0].xy(); } /**< @overload */
@ -179,7 +179,7 @@ template<class T> 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<T>& up() { return (*this)[1].xy(); }
inline constexpr Vector2<T> up() const { return (*this)[1].xy(); } /**< @overload */
@ -220,6 +220,7 @@ template<class T> 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<T> transformVector(const Vector2<T>& vector) const {
return ((*this)*Vector3<T>(vector, T(0))).xy();

7
src/Math/Matrix4.h

@ -308,7 +308,7 @@ template<class T> 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<T>& right() { return (*this)[0].xyz(); }
inline constexpr Vector3<T> right() const { return (*this)[0].xyz(); } /**< @overload */
@ -317,7 +317,7 @@ template<class T> 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<T>& up() { return (*this)[1].xyz(); }
inline constexpr Vector3<T> up() const { return (*this)[1].xyz(); } /**< @overload */
@ -326,7 +326,7 @@ template<class T> 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<T>& backward() { return (*this)[2].xyz(); }
inline constexpr Vector3<T> backward() const { return (*this)[2].xyz(); } /**< @overload */
@ -367,6 +367,7 @@ template<class T> 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<T> transformVector(const Vector3<T>& vector) const {
return ((*this)*Vector4<T>(vector, T(0))).xyz();

2
src/Math/Quaternion.h

@ -44,7 +44,7 @@ template<class T> 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
*/

Loading…
Cancel
Save