From 66a313bc0d87c726694b284c7a4f3bc347537175 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 12 Oct 2018 17:04:25 +0200 Subject: [PATCH] Math: doc++ --- src/Magnum/Math/Complex.h | 51 ++++++++++++++++---------------- src/Magnum/Math/DualComplex.h | 2 +- src/Magnum/Math/DualQuaternion.h | 2 +- src/Magnum/Math/Quaternion.h | 2 +- 4 files changed, 29 insertions(+), 28 deletions(-) diff --git a/src/Magnum/Math/Complex.h b/src/Magnum/Math/Complex.h index 754f50de6..4d24aa169 100644 --- a/src/Magnum/Math/Complex.h +++ b/src/Magnum/Math/Complex.h @@ -97,7 +97,7 @@ template class Complex { * @param angle Rotation angle (counterclockwise) * * @f[ - * c = cos \theta + i sin \theta + * c = \cos(\theta) + i \sin(\theta) * @f] * @see @ref angle(), @ref Matrix3::rotation(), * @ref Quaternion::rotation() @@ -135,7 +135,7 @@ template class Complex { explicit Complex(NoInitT) noexcept {} /** - * @brief Construct complex number from real and imaginary part + * @brief Construct a complex number from real and imaginary part * * @f[ * c = a + ib @@ -144,7 +144,7 @@ template class Complex { constexpr /*implicit*/ Complex(T real, T imaginary) noexcept: _real(real), _imaginary(imaginary) {} /** - * @brief Construct complex number from vector + * @brief Construct a complex number from a vector * * To be used in transformations later. @f[ * c = v_x + iv_y @@ -154,20 +154,20 @@ template class Complex { constexpr explicit Complex(const Vector2& vector) noexcept: _real(vector.x()), _imaginary(vector.y()) {} /** - * @brief Construct complex number from another of different type + * @brief Construct a complex number from another of different type * * Performs only default casting on the values, no rounding or anything * else. */ template constexpr explicit Complex(const Complex& other) noexcept: _real{T(other._real)}, _imaginary{T(other._imaginary)} {} - /** @brief Construct complex number from external representation */ + /** @brief Construct a complex number from external representation */ template::from(std::declval()))> constexpr explicit Complex(const U& other): Complex{Implementation::ComplexConverter::from(other)} {} /** @brief Copy constructor */ constexpr /*implicit*/ Complex(const Complex&) noexcept = default; - /** @brief Convert complex number to external representation */ + /** @brief Convert a complex number to external representation */ template::to(std::declval>()))> constexpr explicit operator U() const { return Implementation::ComplexConverter::to(*this); } @@ -221,21 +221,22 @@ template class Complex { constexpr T imaginary() const { return _imaginary; } /**< @overload */ /** - * @brief Convert complex number to vector + * @brief Convert a complex number to vector * * @f[ * \boldsymbol v = \begin{pmatrix} a \\ b \end{pmatrix} * @f] + * @see @ref Complex(const Vector2&) */ constexpr explicit operator Vector2() const { return {_real, _imaginary}; } /** - * @brief Rotation angle of complex number + * @brief Rotation angle of a complex number * * @f[ - * \theta = atan2(b, a) + * \theta = \operatorname{atan2}(b, a) * @f] * @see @ref rotation() */ @@ -244,7 +245,7 @@ template class Complex { } /** - * @brief Convert complex number to rotation matrix + * @brief Convert a complex number to a rotation matrix * * @f[ * M = \begin{pmatrix} @@ -261,7 +262,7 @@ template class Complex { } /** - * @brief Add complex number and assign + * @brief Add a complex number and assign * * The computation is done in-place. @f[ * c_0 + c_1 = (a_0 + a_1) + i(b_0 + b_1) @@ -274,7 +275,7 @@ template class Complex { } /** - * @brief Add complex number + * @brief Add a complex number * * @see @ref operator+=(const Complex&) */ @@ -294,7 +295,7 @@ template class Complex { } /** - * @brief Subtract complex number and assign + * @brief Subtract a complex number and assign * * The computation is done in-place. @f[ * c_0 - c_1 = (a_0 - a_1) + i(b_0 - b_1) @@ -307,7 +308,7 @@ template class Complex { } /** - * @brief Subtract complex number + * @brief Subtract a complex number * * @see @ref operator-=(const Complex&) */ @@ -316,10 +317,10 @@ template class Complex { } /** - * @brief Multiply with scalar and assign + * @brief Multiply with a scalar and assign * * The computation is done in-place. @f[ - * c \cdot t = ta + itb + * c t = a t + i b t * @f] */ Complex& operator*=(T scalar) { @@ -329,7 +330,7 @@ template class Complex { } /** - * @brief Multiply with scalar + * @brief Multiply with a scalar * * @see @ref operator*=(T) */ @@ -338,10 +339,10 @@ template class Complex { } /** - * @brief Divide with scalar and assign + * @brief Divide with a scalar and assign * * The computation is done in-place. @f[ - * \frac c t = \frac a t + i \frac b t + * \frac{c}{t} = \frac{a}{t} + i \frac{b}{t} * @f] */ Complex& operator/=(T scalar) { @@ -351,7 +352,7 @@ template class Complex { } /** - * @brief Divide with scalar + * @brief Divide with a scalar * * @see @ref operator/=(T) */ @@ -360,7 +361,7 @@ template class Complex { } /** - * @brief Multiply with complex number + * @brief Multiply with a complex number * * @f[ * c_0 c_1 = (a_0 + ib_0)(a_1 + ib_1) = (a_0 a_1 - b_0 b_1) + i(a_1 b_0 + a_0 b_1) @@ -442,7 +443,7 @@ template class Complex { } /** - * @brief Rotate vector with complex number + * @brief Rotate a vector with the complex number * * @f[ * v' = c v = c (v_x + iv_y) @@ -464,7 +465,7 @@ template class Complex { }; /** @relates Complex -@brief Multiply scalar with complex +@brief Multiply a scalar with a complex number Same as @ref Complex::operator*(T) const. */ @@ -473,10 +474,10 @@ template inline Complex operator*(T scalar, const Complex& comple } /** @relates Complex -@brief Divide complex with number and invert +@brief Divide a complex number with a scalar and invert @f[ - \frac t c = \frac t a + i \frac t b + \frac{t}{c} = \frac{t}{a} + i \frac{t}{b} @f] @see @ref Complex::operator/() */ diff --git a/src/Magnum/Math/DualComplex.h b/src/Magnum/Math/DualComplex.h index 298c51f68..768751bbd 100644 --- a/src/Magnum/Math/DualComplex.h +++ b/src/Magnum/Math/DualComplex.h @@ -65,7 +65,7 @@ template class DualComplex: public Dual> { * @param angle Rotation angle (counterclockwise) * * @f[ - * \hat c = (cos \theta + i sin \theta) + \epsilon (0 + i0) + * \hat c = (\cos(\theta) + i \sin(\theta)) + \epsilon (0 + i0) * @f] * @see @ref Complex::rotation(), @ref Matrix3::rotation(), * @ref DualQuaternion::rotation() diff --git a/src/Magnum/Math/DualQuaternion.h b/src/Magnum/Math/DualQuaternion.h index 7c30ed0c3..3fc96df1d 100644 --- a/src/Magnum/Math/DualQuaternion.h +++ b/src/Magnum/Math/DualQuaternion.h @@ -200,7 +200,7 @@ template class DualQuaternion: public Dual> { * @param normalizedAxis Normalized rotation axis * * Expects that the rotation axis is normalized. @f[ - * \hat q = [\boldsymbol a \cdot sin \frac \theta 2, cos \frac \theta 2] + \epsilon [\boldsymbol 0, 0] + * \hat q = [\boldsymbol a \cdot \sin(\frac{\theta}{2}), \cos(\frac{\theta}{2})] + \epsilon [\boldsymbol 0, 0] * @f] * @see @ref rotation() const, @ref Quaternion::rotation(), * @ref Matrix4::rotation(), @ref DualComplex::rotation(), diff --git a/src/Magnum/Math/Quaternion.h b/src/Magnum/Math/Quaternion.h index 45944db51..07da65c85 100644 --- a/src/Magnum/Math/Quaternion.h +++ b/src/Magnum/Math/Quaternion.h @@ -247,7 +247,7 @@ template class Quaternion { * @param normalizedAxis Normalized rotation axis * * Expects that the rotation axis is normalized. @f[ - * q = [\boldsymbol a \cdot sin \frac \theta 2, cos \frac \theta 2] + * q = [\boldsymbol a \cdot \sin(\frac{\theta}{2}), \cos(\frac{\theta}{2})] * @f] * @see @ref angle(), @ref axis(), @ref DualQuaternion::rotation(), * @ref Matrix4::rotation(), @ref Complex::rotation(),