Browse Source

Math: doc++

pull/7/head
Vladimír Vondruš 13 years ago
parent
commit
d2af088880
  1. 16
      src/Math/Complex.h
  2. 4
      src/Math/Matrix3.h
  3. 4
      src/Math/Matrix4.h
  4. 10
      src/Math/Quaternion.h
  5. 10
      src/Math/Vector.h
  6. 2
      src/Math/Vector2.h
  7. 4
      src/Math/Vector3.h
  8. 4
      src/Math/Vector4.h

16
src/Math/Complex.h

@ -47,7 +47,7 @@ template<class T> class Complex {
inline constexpr /*implicit*/ Complex(): _real(T(0)), _imaginary(T(0)) {}
/**
* @brief Construct complex from real and imaginary part
* @brief Construct complex number from real and imaginary part
*
* @f[
* c = a + ib
@ -73,10 +73,10 @@ template<class T> class Complex {
inline constexpr T imaginary() const { return _imaginary; }
/**
* @brief Add and assign complex
* @brief Add complex number and assign
*
* The computation is done in-place. @f[
* c_0 + c_1 = a_0 + a_1 + i(b_0 + b_1)
* c_0 + c_1 = (a_0 + a_1) + i(b_0 + b_1)
* @f]
*/
inline Complex<T>& operator+=(const Complex<T>& other) {
@ -86,7 +86,7 @@ template<class T> class Complex {
}
/**
* @brief Add complex
* @brief Add complex number
*
* @see operator+=()
*/
@ -95,7 +95,7 @@ template<class T> class Complex {
}
/**
* @brief Negated complex
* @brief Negated complex number
*
* @f[
* -c = -a -ib
@ -106,10 +106,10 @@ template<class T> class Complex {
}
/**
* @brief Subtract and assign complex
* @brief Subtract complex number and assign
*
* The computation is done in-place. @f[
* c_0 - c_1 = a_0 - a_1 + i(b_0 - b_1)
* c_0 - c_1 = (a_0 - a_1) + i(b_0 - b_1)
* @f]
*/
inline Complex<T>& operator-=(const Complex<T>& other) {
@ -119,7 +119,7 @@ template<class T> class Complex {
}
/**
* @brief Subtract complex
* @brief Subtract complex number
*
* @see operator-=()
*/

4
src/Math/Matrix3.h

@ -206,7 +206,7 @@ template<class T> class Matrix3: public Matrix<3, T> {
* @brief Transform 2D vector with the matrix
*
* Translation is not involved in the transformation. @f[
* \boldsymbol v' = \boldsymbol M (v_x, v_y, 0)^T
* \boldsymbol v' = \boldsymbol M \begin{pmatrix} v_x \\ v_y \\ 0 \end{pmatrix}
* @f]
* @see transformPoint(), Matrix4::transformVector()
*/
@ -218,7 +218,7 @@ template<class T> class Matrix3: public Matrix<3, T> {
* @brief Transform 2D point with the matrix
*
* Unlike in transformVector(), translation is also involved. @f[
* \boldsymbol v' = \boldsymbol M (v_x, v_y, 1)^T
* \boldsymbol v' = \boldsymbol M \begin{pmatrix} v_x \\ v_y \\ 1 \end{pmatrix}
* @f]
* @see Matrix4::transformPoint()
*/

4
src/Math/Matrix4.h

@ -354,7 +354,7 @@ template<class T> class Matrix4: public Matrix<4, T> {
* @brief Transform 3D vector with the matrix
*
* Translation is not involved in the transformation. @f[
* \boldsymbol v' = \boldsymbol M (v_x, v_y, v_z, 0)^T
* \boldsymbol v' = \boldsymbol M \begin{pmatrix} v_x \\ v_y \\ v_z \\ 0 \end{pmatrix}
* @f]
* @see transformPoint(), Quaternion::transformVector(),
* Matrix3::transformVector()
@ -367,7 +367,7 @@ template<class T> class Matrix4: public Matrix<4, T> {
* @brief Transform 3D point with the matrix
*
* Unlike in transformVector(), translation is also involved. @f[
* \boldsymbol v' = \boldsymbol M (v_x, v_y, v_z, 1)^T
* \boldsymbol v' = \boldsymbol M \begin{pmatrix} v_x \\ v_y \\ v_z \\ 1 \end{pmatrix}
* @f]
* @see DualQuaternion::transformPoint(), Matrix3::transformPoint()
*/

10
src/Math/Quaternion.h

@ -57,7 +57,7 @@ template<class T> class Quaternion {
* @brief Angle between normalized quaternions
*
* Expects that both quaternions are normalized. @f[
* \theta = acos \left( \frac{p \cdot q}{|p| \cdot |q|} \right)
* \theta = acos \left( \frac{p \cdot q}{|p| |q|} \right) = acos(p \cdot q)
* @f]
*/
inline static Rad<T> angle(const Quaternion<T>& normalizedA, const Quaternion<T>& normalizedB) {
@ -93,7 +93,7 @@ template<class T> class Quaternion {
* Expects that both quaternions are normalized. @f[
* q_{SLERP} = \frac{sin((1 - t) \theta) q_A + sin(t \theta) q_B}{sin \theta}
* ~~~~~~~~~~
* \theta = acos \left( \frac{q_A \cdot q_B}{|q_A| \cdot |q_B|} \right)
* \theta = acos \left( \frac{q_A \cdot q_B}{|q_A| \cdot |q_B|} \right) = acos(q_A \cdot q_B)
* @f]
* @see lerp()
*/
@ -338,7 +338,7 @@ template<class T> class Quaternion {
* with other values, because it doesn't compute the square root. @f[
* q \cdot q = \boldsymbol q_V \cdot \boldsymbol q_V + q_S^2
* @f]
* @see dot(const Quaternion<T>&, const Quaternion<T>&)
* @see dot(const Quaternion&, const Quaternion&)
*/
inline T dot() const {
return dot(*this, *this);
@ -377,7 +377,7 @@ template<class T> class Quaternion {
*
* See invertedNormalized() which is faster for normalized
* quaternions. @f[
* q^{-1} = \frac{q^*}{|q|^2} = \frac{[-\boldsymbol q_V, q_S]}{q \cdot q}
* q^{-1} = \frac{q^*}{|q|^2} = \frac{q^*}{q \cdot q}
* @f]
*/
inline Quaternion<T> inverted() const {
@ -389,7 +389,7 @@ template<class T> class Quaternion {
*
* Equivalent to conjugated(). Expects that the quaternion is
* normalized. @f[
* q^{-1} = q^* = [-\boldsymbol q_V, q_S]
* q^{-1} = \frac{q^*}{|q|^2} = q^*
* @f]
*/
inline Quaternion<T> invertedNormalized() const {

10
src/Math/Vector.h

@ -82,7 +82,7 @@ template<std::size_t size, class T> class Vector {
* @brief Angle between normalized vectors
*
* Expects that both vectors are normalized. @f[
* \theta = acos \left( \frac{\boldsymbol a \cdot \boldsymbol b}{|\boldsymbol a| \cdot |\boldsymbol b|} \right) = acos (\boldsymbol a \cdot \boldsymbol b)
* \theta = acos \left( \frac{\boldsymbol a \cdot \boldsymbol b}{|\boldsymbol a| |\boldsymbol b|} \right) = acos (\boldsymbol a \cdot \boldsymbol b)
* @f]
*/
inline static Rad<T> angle(const Vector<size, T>& normalizedA, const Vector<size, T>& normalizedB) {
@ -141,10 +141,9 @@ template<std::size_t size, class T> class Vector {
/**
* @brief Raw data
* @return One-dimensional array of `size*size` length in column-major
* order.
* @return One-dimensional array of `size*size` length.
*
* @see operator[]
* @see operator[]()
*/
inline T* data() { return _data; }
inline constexpr const T* data() const { return _data; } /**< @overload */
@ -387,7 +386,7 @@ template<std::size_t size, class T> class Vector {
* other values, because it doesn't compute the square root. @f[
* \boldsymbol a \cdot \boldsymbol a = \sum_{i=0}^{n-1} \boldsymbol a_i^2
* @f]
* @see dot(const Vector<size, T>&, const Vector<size, T>&)
* @see dot(const Vector&, const Vector&)
*/
inline T dot() const {
return dot(*this, *this);
@ -400,6 +399,7 @@ template<std::size_t size, class T> class Vector {
* values. @f[
* |\boldsymbol a| = \sqrt{\boldsymbol a \cdot \boldsymbol a}
* @f]
* @todo something like std::hypot() for possibly better precision?
*/
inline T length() const {
return std::sqrt(dot());

2
src/Math/Vector2.h

@ -81,7 +81,7 @@ template<class T> class Vector2: public Vector<2, T> {
* @brief Constructor
*
* @f[
* \boldsymbol v = (x, y)^T
* \boldsymbol v = \begin{pmatrix} x \\ y \end{pmatrix}
* @f]
*/
inline constexpr /*implicit*/ Vector2(T x, T y): Vector<2, T>(x, y) {}

4
src/Math/Vector3.h

@ -113,7 +113,7 @@ template<class T> class Vector3: public Vector<3, T> {
* @brief Constructor
*
* @f[
* \boldsymbol v = (x, y, z)^T
* \boldsymbol v = \begin{pmatrix} x \\ y \\ z \end{pmatrix}
* @f]
*/
inline constexpr /*implicit*/ Vector3(T x, T y, T z): Vector<3, T>(x, y, z) {}
@ -122,7 +122,7 @@ template<class T> class Vector3: public Vector<3, T> {
* @brief Constructor
*
* @f[
* \boldsymbol v = (v_x, v_y, z)^T
* \boldsymbol v = \begin{pmatrix} v_x \\ v_y \\ z \end{pmatrix}
* @f]
*/
inline constexpr /*implicit*/ Vector3(const Vector2<T>& xy, T z): Vector<3, T>(xy[0], xy[1], z) {}

4
src/Math/Vector4.h

@ -43,7 +43,7 @@ template<class T> class Vector4: public Vector<4, T> {
* @brief Constructor
*
* @f[
* \boldsymbol v = (x, y, z, w)^T
* \boldsymbol v = \begin{pmatrix} x \\ y \\ z \\ w \end{pmatrix}
* @f]
*/
inline constexpr /*implicit*/ Vector4(T x, T y, T z, T w): Vector<4, T>(x, y, z, w) {}
@ -52,7 +52,7 @@ template<class T> class Vector4: public Vector<4, T> {
* @brief Constructor
*
* @f[
* \boldsymbol v = (v_x, v_y, v_z, w)^T
* \boldsymbol v = \begin{pmatrix} v_x \\ v_y \\ v_z \\ w \end{pmatrix}
* @f]
*/
inline constexpr /*implicit*/ Vector4(const Vector3<T>& xyz, T w): Vector<4, T>(xyz[0], xyz[1], xyz[2], w) {}

Loading…
Cancel
Save