Browse Source

Math: document the usual notation for complex/dual/quat numbers.

pull/267/head
Vladimír Vondruš 8 years ago
parent
commit
ec34009025
  1. 12
      src/Magnum/Math/Complex.h
  2. 9
      src/Magnum/Math/Dual.h
  3. 10
      src/Magnum/Math/DualComplex.h
  4. 10
      src/Magnum/Math/DualQuaternion.h
  5. 4
      src/Magnum/Math/Quaternion.h

12
src/Magnum/Math/Complex.h

@ -79,7 +79,13 @@ template<class T> inline Rad<T> angle(const Complex<T>& normalizedA, const Compl
@brief Complex number
@tparam T Data type
Represents 2D rotation. See @ref transformations for brief introduction.
Represents 2D rotation. Usually denoted as the following in equations, with
@f$ a_0 @f$ being the @ref real() part and @f$ a_i @f$ the @ref imaginary()
part: @f[
c = a_0 + i a_i
@f]
See @ref transformations for brief introduction.
@see @ref Magnum::Complex, @ref Magnum::Complexd, @ref Matrix3
*/
template<class T> class Complex {
@ -191,11 +197,11 @@ template<class T> class Complex {
return Implementation::isNormalizedSquared(dot());
}
/** @brief Real part */
/** @brief Real part (@f$ a_0 @f$) */
T& real() { return _real; }
constexpr T real() const { return _real; } /**< @overload */
/** @brief Imaginary part */
/** @brief Imaginary part (@f$ a_i @f$) */
T& imaginary() { return _imaginary; }
constexpr T imaginary() const { return _imaginary; } /**< @overload */

9
src/Magnum/Math/Dual.h

@ -45,6 +45,11 @@ namespace Implementation {
/**
@brief Dual number
@tparam T Underlying data type
Usually denoted as the following in equations, with @f$ a_0 @f$ being the
@ref real() part and @f$ a_\epsilon @f$ the @ref dual() part: @f[
\hat a = a_0 + \epsilon a_\epsilon
@f]
*/
template<class T> class Dual {
template<class> friend class Dual;
@ -121,13 +126,13 @@ template<class T> class Dual {
return !operator==(other);
}
/** @brief Real part */
/** @brief Real part (@f$ a_0 @f$) */
T& real() { return _real; }
/* Returning const so it's possible to call constexpr functions on the
result. WTF, C++?! */
constexpr const T real() const { return _real; } /**< @overload */
/** @brief Dual part */
/** @brief Dual part (@f$ a_\epsilon @f$) */
T& dual() { return _dual; }
/* Returning const so it's possible to call constexpr functions on the
result. WTF, C++?! */

10
src/Magnum/Math/DualComplex.h

@ -43,8 +43,14 @@ namespace Implementation {
@brief Dual complex number
@tparam T Underlying data type
Represents 2D rotation and translation. See @ref transformations for brief
introduction.
Represents 2D rotation and translation. Usually denoted as the following in
equations, with @f$ q_0 @f$ being the @ref real() part and @f$ q_\epsilon @f$
the @ref dual() part: @f[
\hat q = q_0 + \epsilon q_\epsilon
@f]
See @ref Dual and @ref Complex for further notation description and
@ref transformations for brief introduction.
@see @ref Magnum::DualComplex, @ref Magnum::DualComplexd, @ref Dual,
@ref Complex, @ref Matrix3
@todo Can this be done similarly as in dual quaternions? It sort of works, but

10
src/Magnum/Math/DualQuaternion.h

@ -179,8 +179,14 @@ template<class T> inline DualQuaternion<T> sclerpShortestPath(const DualQuaterni
@brief Dual quaternion
@tparam T Underlying data type
Represents 3D rotation and translation. See @ref transformations for brief
introduction.
Represents 3D rotation and translation. Usually denoted as the following in
equations, with @f$ q_0 @f$ being the @ref real() part and @f$ q_\epsilon @f$
the @ref dual() part: @f[
\hat q = q_0 + \epsilon q_\epsilon
@f]
See @ref Dual and @ref Quaternion for further notation description and
@ref transformations for a brief introduction.
@see @ref Magnum::DualQuaternion, @ref Magnum::DualQuaterniond, @ref Dual,
@ref Quaternion, @ref Matrix4
*/

4
src/Magnum/Math/Quaternion.h

@ -333,13 +333,13 @@ template<class T> class Quaternion {
return Implementation::isNormalizedSquared(dot());
}
/** @brief Vector part */
/** @brief Vector part (@f$ \boldsymbol{q}_V @f$) */
Vector3<T>& vector() { return _vector; }
/* Returning const so it's possible to call constexpr functions on the
result. WTF, C++?! */
constexpr const Vector3<T> vector() const { return _vector; } /**< @overload */
/** @brief Scalar part */
/** @brief Scalar part (@f$ q_S @f$) */
T& scalar() { return _scalar; }
constexpr T scalar() const { return _scalar; } /**< @overload */

Loading…
Cancel
Save