diff --git a/Doxyfile b/Doxyfile index 55554dde3..02cbd995f 100644 --- a/Doxyfile +++ b/Doxyfile @@ -1264,7 +1264,7 @@ PAPER_TYPE = a4 # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. -EXTRA_PACKAGES = +EXTRA_PACKAGES = amsmath # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until diff --git a/src/Math/Matrix.h b/src/Math/Matrix.h index 3e363c50a..c494bac64 100644 --- a/src/Math/Matrix.h +++ b/src/Math/Matrix.h @@ -209,14 +209,26 @@ template class Matrix { /** * @brief Determinant * - * Computed recursively using Laplace's formula expanded down to 2x2 - * matrix, where the determinant is computed directly. Complexity is - * O(n!), the same as when computing the determinant directly. + * Computed recursively using Laplace's formula: + * @f[ + * \det(A) = \sum_{j=1}^n (-1)^{i+j} a_{i,j} \det(A^{i,j}) + * @f] + * @f$ A^{i, j} @f$ is matrix without i-th row and j-th column, see + * ij(). The formula is expanded down to 2x2 matrix, where the + * determinant is computed directly: + * @f[ + * \det(A) = a_{0, 0} a_{1, 1} - a_{1, 0} a_{0, 1} + * @f] */ inline T determinant() const { return Implementation::MatrixDeterminant()(*this); } /** * @brief Inverted matrix + * + * Computed using Cramer's rule: + * @f[ + * A^{-1} = \frac{1}{\det(A)} Adj(A) + * @f] */ Matrix inverted() const { Matrix out(Zero); diff --git a/src/Math/Vector.h b/src/Math/Vector.h index 81b59d283..6f06c4b00 100644 --- a/src/Math/Vector.h +++ b/src/Math/Vector.h @@ -37,7 +37,7 @@ template class Vector { const static size_t Size = size; /**< @brief %Vector size */ /** - * @brief Vector from array + * @brief %Vector from array * @return Reference to the data as if it was Vector, thus doesn't * perform any copying. * @@ -53,7 +53,13 @@ template class Vector { return *reinterpret_cast*>(data); } - /** @brief Dot product */ + /** + * @brief Dot product + * + * @f[ + * a \cdot b = \sum_{i=1}^n a_ib_i + * @f] + */ static T dot(const Vector& a, const Vector& b) { T out(0); @@ -63,7 +69,13 @@ template class Vector { return out; } - /** @brief Angle between vectors */ + /** + * @brief Angle between vectors + * + * @f[ + * \phi = \frac{a \cdot b}{|a| \cdot |b|} + * @f] + */ inline static T angle(const Vector& a, const Vector& b) { return acos(dot(a, b)/(a.length()*b.length())); } diff --git a/src/Math/Vector3.h b/src/Math/Vector3.h index 148f6d055..b470f10db 100644 --- a/src/Math/Vector3.h +++ b/src/Math/Vector3.h @@ -36,16 +36,23 @@ template class Vector3: public Vector { return *reinterpret_cast*>(data); } - /** @brief Vector in direction of X axis */ + /** @brief %Vector in direction of X axis */ inline constexpr static Vector3 xAxis(T length = T(1)) { return Vector3(length, T(), T()); } - /** @brief Vector in direction of Y axis */ + /** @brief %Vector in direction of Y axis */ inline constexpr static Vector3 yAxis(T length = T(1)) { return Vector3(T(), length, T()); } - /** @brief Vector in direction of Z axis */ + /** @brief %Vector in direction of Z axis */ inline constexpr static Vector3 zAxis(T length = T(1)) { return Vector3(T(), T(), length); } - /** @brief Cross product */ + /** + * @brief Cross product + * + * @f[ + * \begin{pmatrix} c_1 \\ c_2 \\ c_3 \end{pmatrix} = + * \begin{pmatrix}a_2b_3 - a_3b_2 \\ a_3b_1 - a_1b_3 \\ a_1b_2 - a_2b_1 \end{pmatrix} + * @f] + */ constexpr static Vector3 cross(const Vector3& a, const Vector3& b) { return Vector3(a[1]*b[2]-a[2]*b[1], a[2]*b[0]-a[0]*b[2],