diff --git a/src/Magnum/Math/BoolVector.h b/src/Magnum/Math/BoolVector.h index 4c930b1f4..26af20b51 100644 --- a/src/Magnum/Math/BoolVector.h +++ b/src/Magnum/Math/BoolVector.h @@ -108,14 +108,14 @@ template class BoolVector { */ constexpr /*implicit*/ BoolVector() noexcept: _data{} {} - /** @brief Construct zero-filled boolean vector */ + /** @brief Construct a zero-filled boolean vector */ constexpr explicit BoolVector(ZeroInitT) noexcept: _data{} {} /** @brief Construct without initializing the contents */ explicit BoolVector(NoInitT) noexcept {} /** - * @brief Construct boolean vector from segment values + * @brief Construct a boolean vector from segment values * @param first Value for first 8bit segment * @param next Values for next Bbit segments */ @@ -125,20 +125,20 @@ template class BoolVector { template::type> constexpr /*implicit*/ BoolVector(UnsignedByte first, T... next) noexcept: _data{first, UnsignedByte(next)...} {} #endif - /** @brief Construct boolean vector with one value for all fields */ + /** @brief Construct a boolean vector with one value for all fields */ #ifdef DOXYGEN_GENERATING_OUTPUT explicit BoolVector(T value) noexcept; #else template::value && size != 1, bool>::type> constexpr explicit BoolVector(T value) noexcept: BoolVector(typename Implementation::GenerateSequence::Type(), value ? FullSegmentMask : 0) {} #endif - /** @brief Construct boolean vector from external representation */ + /** @brief Construct a boolean vector from external representation */ template::from(std::declval()))> constexpr explicit BoolVector(const U& other) noexcept: BoolVector{Implementation::BoolVectorConverter::from(other)} {} /** @brief Copy constructor */ constexpr /*implicit*/ BoolVector(const BoolVector&) noexcept = default; - /** @brief Convert boolean vector to external representation */ + /** @brief Convert a boolean vector to external representation */ template::to(std::declval>()))> constexpr explicit operator U() const { return Implementation::BoolVectorConverter::to(*this); } @@ -157,7 +157,7 @@ template class BoolVector { return (_data[i/8] >> i%8) & 0x01; } - /** @brief Set bit at given position */ + /** @brief Set a bit at given position */ BoolVector& set(std::size_t i, bool value) { value ? _data[i/8] |= (1 << i%8) : _data[i/8] &= ~(1 << i%8); diff --git a/src/Magnum/Math/Matrix.h b/src/Magnum/Math/Matrix.h index 2e523f1af..d79c41c94 100644 --- a/src/Magnum/Math/Matrix.h +++ b/src/Magnum/Math/Matrix.h @@ -70,10 +70,10 @@ template class Matrix: public RectangularMatrix{typename Implementation::GenerateSequence::Type(), Vector(T(1))} {} /** - * @brief Identity constructor + * @brief Construct an identity matrix * - * Creates an identity matrix. @p value allows you to specify value on - * diagonal. + * The @p value allows you to specify a value on diagonal. + * @see @ref fromDiagonal() */ constexpr explicit Matrix(IdentityInitT, T value = T(1)) noexcept: RectangularMatrix{typename Implementation::GenerateSequence::Type(), Vector(value)} {} @@ -83,14 +83,14 @@ template class Matrix: public RectangularMatrix{NoInit} {} - /** @brief Construct matrix from column vectors */ + /** @brief Construct from column vectors */ template constexpr /*implicit*/ Matrix(const Vector& first, const U&... next) noexcept: RectangularMatrix(first, next...) {} - /** @brief Construct matrix with one value for all elements */ + /** @brief Construct with one value for all elements */ constexpr explicit Matrix(T value) noexcept: RectangularMatrix{typename Implementation::GenerateSequence::Type(), value} {} /** - * @brief Construct matrix from another of different type + * @brief Construct from a matrix of adifferent type * * Performs only default casting on the values, no rounding or * anything else. Example usage: @@ -103,7 +103,7 @@ template class Matrix: public RectangularMatrix::from(std::declval()))> constexpr explicit Matrix(const U& other): RectangularMatrix(Implementation::RectangularMatrixConverter::from(other)) {} /** - * @brief Construct matrix by slicing or expanding another of a different size + * @brief Construct by slicing or expanding a matrix of different size * * If the other matrix is larger, takes only the first @cpp size @ce * columns and rows from it; if the other matrix is smaller, it's diff --git a/src/Magnum/Math/Matrix3.h b/src/Magnum/Math/Matrix3.h index dad682e7c..72a3593e8 100644 --- a/src/Magnum/Math/Matrix3.h +++ b/src/Magnum/Math/Matrix3.h @@ -203,10 +203,9 @@ template class Matrix3: public Matrix3x3 { constexpr /*implicit*/ Matrix3() noexcept: Matrix3x3{IdentityInit, T(1)} {} /** - * @brief Identity constructor + * @brief Construct an identity matrix * - * Creates an identity matrix. @p value allows you to specify value on - * diagonal. + * The @p value allows you to specify value on diagonal. */ constexpr explicit Matrix3(IdentityInitT, T value = T{1}) noexcept: Matrix3x3{IdentityInit, value} {} @@ -216,20 +215,20 @@ template class Matrix3: public Matrix3x3 { /** @copydoc Matrix::Matrix(NoInitT) */ constexpr explicit Matrix3(NoInitT) noexcept: Matrix3x3{NoInit} {} - /** @brief Construct matrix from column vectors */ + /** @brief Construct from column vectors */ constexpr /*implicit*/ Matrix3(const Vector3& first, const Vector3& second, const Vector3& third) noexcept: Matrix3x3(first, second, third) {} - /** @brief Construct matrix with one value for all elements */ + /** @brief Construct with one value for all elements */ constexpr explicit Matrix3(T value) noexcept: Matrix3x3{value} {} /** @copydoc Matrix::Matrix(const RectangularMatrix&) */ template constexpr explicit Matrix3(const RectangularMatrix<3, 3, U>& other) noexcept: Matrix3x3(other) {} - /** @brief Construct matrix from external representation */ + /** @brief Construct from external representation */ template::from(std::declval()))> constexpr explicit Matrix3(const U& other) noexcept: Matrix3x3(Implementation::RectangularMatrixConverter<3, 3, T, U>::from(other)) {} /** - * @brief Construct matrix by slicing or expanding another of a different size + * @brief Construct by slicing or expanding a matrix of a different size * * If the other matrix is larger, takes only the first @cpp size @ce * columns and rows from it; if the other matrix is smaller, it's @@ -241,7 +240,7 @@ template class Matrix3: public Matrix3x3 { constexpr /*implicit*/ Matrix3(const RectangularMatrix<3, 3, T>& other) noexcept: Matrix3x3(other) {} /** - * @brief Check whether the matrix represents rigid transformation + * @brief Check whether the matrix represents a rigid transformation * * Rigid transformation consists only of rotation and translation (i.e. * no scaling or projection). @@ -279,7 +278,7 @@ template class Matrix3: public Matrix3x3 { } /** - * @brief 2D rotation and scaling part of the matrix + * @brief 2D rotation and shear part of the matrix * * Normalized upper-left 2x2 part of the matrix. Assuming the following * matrix, with the upper-left 2x2 part represented by column vectors @@ -429,7 +428,7 @@ template class Matrix3: public Matrix3x3 { } /** - * @brief Non-uniform scaling part of the matrix, squared + * @brief Non-uniform scaling part of the matrix * * Length of vectors in upper-left 2x2 part of the matrix. Use the * faster alternative @ref scalingSquared() where possible. Assuming @@ -603,7 +602,7 @@ template class Matrix3: public Matrix3x3 { Matrix3 invertedRigid() const; /** - * @brief Transform 2D vector with the matrix + * @brief Transform a 2D vector with the matrix * * Unlike in @ref transformPoint(), translation is not involved in the * transformation. @f[ @@ -618,7 +617,7 @@ template class Matrix3: public Matrix3x3 { } /** - * @brief Transform 2D point with the matrix + * @brief Transform a 2D point with the matrix * * Unlike in @ref transformVector(), translation is also involved in * the transformation. @f[ diff --git a/src/Magnum/Math/Matrix4.h b/src/Magnum/Math/Matrix4.h index 894ef977c..46cf4c608 100644 --- a/src/Magnum/Math/Matrix4.h +++ b/src/Magnum/Math/Matrix4.h @@ -120,7 +120,7 @@ template class Matrix4: public Matrix4x4 { static Matrix4 rotation(Rad angle, const Vector3& normalizedAxis); /** - * @brief 3D rotation matrix around X axis + * @brief 3D rotation matrix around the X axis * @param angle Rotation angle (counterclockwise) * * Faster than calling @cpp Matrix4::rotation(angle, Vector3::xAxis()) @ce. @f[ @@ -138,7 +138,7 @@ template class Matrix4: public Matrix4x4 { static Matrix4 rotationX(Rad angle); /** - * @brief 3D rotation matrix around Y axis + * @brief 3D rotation matrix around the Y axis * @param angle Rotation angle (counterclockwise) * * Faster than calling @cpp Matrix4::rotation(angle, Vector3::yAxis()) @ce. @f[ @@ -156,7 +156,7 @@ template class Matrix4: public Matrix4x4 { static Matrix4 rotationY(Rad angle); /** - * @brief 3D rotation matrix around Z axis + * @brief 3D rotation matrix around the Z axis * @param angle Rotation angle (counterclockwise) * * Faster than calling @cpp Matrix4::rotation(angle, Vector3::zAxis()) @ce. @f[ @@ -188,9 +188,9 @@ template class Matrix4: public Matrix4x4 { static Matrix4 reflection(const Vector3& normal); /** - * @brief 3D shearing matrix along XY plane - * @param amountX Amount of shearing along X axis - * @param amountY Amount of shearing along Y axis + * @brief 3D shearing matrix along the XY plane + * @param amountX Amount of shearing along the X axis + * @param amountY Amount of shearing along the Y axis * * Z axis remains unchanged. @f[ * \boldsymbol{A} = \begin{pmatrix} @@ -211,9 +211,9 @@ template class Matrix4: public Matrix4x4 { } /** - * @brief 3D shearing matrix along XZ plane - * @param amountX Amount of shearing along X axis - * @param amountZ Amount of shearing along Z axis + * @brief 3D shearing matrix along the XZ plane + * @param amountX Amount of shearing along the X axis + * @param amountZ Amount of shearing along the Z axis * * Y axis remains unchanged. @f[ * \boldsymbol{A} = \begin{pmatrix} @@ -234,9 +234,9 @@ template class Matrix4: public Matrix4x4 { } /** - * @brief 3D shearing matrix along YZ plane - * @param amountY Amount of shearing along Y axis - * @param amountZ Amount of shearing along Z axis + * @brief 3D shearing matrix along the YZ plane + * @param amountY Amount of shearing along the Y axis + * @param amountZ Amount of shearing along the Z axis * * X axis remains unchanged. @f[ * \boldsymbol{A} = \begin{pmatrix} @@ -365,7 +365,7 @@ template class Matrix4: public Matrix4x4 { static Matrix4 lookAt(const Vector3& eye, const Vector3& target, const Vector3& up); /** - * @brief Create matrix from rotation/scaling part and translation part + * @brief Create a matrix from a rotation/scaling part and a translation part * @param rotationScaling Rotation/scaling part (upper-left 3x3 * matrix) * @param translation Translation part (first three elements of @@ -388,10 +388,9 @@ template class Matrix4: public Matrix4x4 { constexpr /*implicit*/ Matrix4() noexcept: Matrix4x4{IdentityInit, T(1)} {} /** - * @brief Identity constructor + * @brief Construct an identity matrix * - * Creates an identity matrix. @p value allows you to specify value on - * diagonal. + * The @p value allows you to specify value on diagonal. */ constexpr explicit Matrix4(IdentityInitT, T value = T{1}) noexcept: Matrix4x4{IdentityInit, value} {} @@ -401,20 +400,20 @@ template class Matrix4: public Matrix4x4 { /** @copydoc Matrix::Matrix(NoInitT) */ constexpr explicit Matrix4(NoInitT) noexcept: Matrix4x4{NoInit} {} - /** @brief Construct matrix from column vectors */ + /** @brief Construct from column vectors */ constexpr /*implicit*/ Matrix4(const Vector4& first, const Vector4& second, const Vector4& third, const Vector4& fourth) noexcept: Matrix4x4(first, second, third, fourth) {} - /** @brief Construct matrix with one value for all elements */ + /** @brief Construct with one value for all elements */ constexpr explicit Matrix4(T value) noexcept: Matrix4x4{value} {} /** @copydoc Matrix::Matrix(const RectangularMatrix&) */ template constexpr explicit Matrix4(const RectangularMatrix<4, 4, U>& other) noexcept: Matrix4x4(other) {} - /** @brief Construct matrix from external representation */ + /** @brief Construct from external representation */ template::from(std::declval()))> constexpr explicit Matrix4(const U& other): Matrix4x4(Implementation::RectangularMatrixConverter<4, 4, T, U>::from(other)) {} /** - * @brief Construct matrix by slicing or expanding another of a different size + * @brief Construct by slicing or expanding a matrix of a different size * * If the other matrix is larger, takes only the first @cpp size @ce * columns and rows from it; if the other matrix is smaller, it's @@ -426,7 +425,7 @@ template class Matrix4: public Matrix4x4 { constexpr /*implicit*/ Matrix4(const RectangularMatrix<4, 4, T>& other) noexcept: Matrix4x4(other) {} /** - * @brief Check whether the matrix represents rigid transformation + * @brief Check whether the matrix represents a rigid transformation * * Rigid transformation consists only of rotation and translation (i.e. * no scaling or projection). @@ -467,7 +466,7 @@ template class Matrix4: public Matrix4x4 { } /** - * @brief 3D rotation and scaling part of the matrix + * @brief 3D rotation and shear part of the matrix * * Normalized upper-left 3x3 part of the matrix. Assuming the following * matrix, with the upper-left 3x3 part represented by column vectors @@ -634,7 +633,7 @@ template class Matrix4: public Matrix4x4 { } /** - * @brief Non-uniform scaling part of the matrix, squared + * @brief Non-uniform scaling part of the matrix * * Length of vectors in upper-left 3x3 part of the matrix. Use the * faster alternative @ref scalingSquared() where possible. Assuming @@ -838,7 +837,7 @@ template class Matrix4: public Matrix4x4 { Matrix4 invertedRigid() const; /** - * @brief Transform 3D vector with the matrix + * @brief Transform a 3D vector with the matrix * * Unlike in @ref transformVector(), translation is not involved in the * transformation. @f[ @@ -853,7 +852,7 @@ template class Matrix4: public Matrix4x4 { } /** - * @brief Transform 3D point with the matrix + * @brief Transform a 3D point with the matrix * * Unlike in @ref transformVector(), translation is also involved in * the transformation. @f[ diff --git a/src/Magnum/Math/Quaternion.h b/src/Magnum/Math/Quaternion.h index c058bec15..9a3337716 100644 --- a/src/Magnum/Math/Quaternion.h +++ b/src/Magnum/Math/Quaternion.h @@ -259,7 +259,7 @@ template class Quaternion { static Quaternion rotation(Rad angle, const Vector3& normalizedAxis); /** - * @brief Create quaternion from rotation matrix + * @brief Create a quaternion from a rotation matrix * * Expects that the matrix is orthogonal (i.e. pure rotation). * @see @ref toMatrix(), @ref DualComplex::fromMatrix(), @@ -275,7 +275,7 @@ template class Quaternion { constexpr /*implicit*/ Quaternion() noexcept: _scalar{T(1)} {} /** - * @brief Identity constructor + * @brief Construct an identity quaternion * * Creates unit quaternion. @f[ * q = [\boldsymbol 0, 1] @@ -283,14 +283,14 @@ template class Quaternion { */ constexpr explicit Quaternion(IdentityInitT) noexcept: _scalar{T(1)} {} - /** @brief Construct zero-initialized quaternion */ + /** @brief Construct a zero-initialized quaternion */ constexpr explicit Quaternion(ZeroInitT) noexcept: _vector{ZeroInit}, _scalar{T{0}} {} /** @brief Construct without initializing the contents */ explicit Quaternion(NoInitT) noexcept: _vector{NoInit} {} /** - * @brief Construct quaternion from vector and scalar + * @brief Construct from a vector and a scalar * * @f[ * q = [\boldsymbol v, s] @@ -299,7 +299,7 @@ template class Quaternion { constexpr /*implicit*/ Quaternion(const Vector3& vector, T scalar) noexcept: _vector(vector), _scalar(scalar) {} /** - * @brief Construct quaternion from vector + * @brief Construct from a vector * * To be used in transformations later. @f[ * q = [\boldsymbol v, 0] @@ -309,7 +309,7 @@ template class Quaternion { constexpr explicit Quaternion(const Vector3& vector) noexcept: _vector(vector), _scalar(T(0)) {} /** - * @brief Construct dual complex number from another of different type + * @brief Construct from a quaternion of different type * * Performs only default casting on the values, no rounding or anything * else. @@ -369,7 +369,7 @@ template class Quaternion { constexpr T scalar() const { return _scalar; } /**< @overload */ /** - * @brief Rotation angle of unit quaternion + * @brief Rotation angle of a unit quaternion * * Expects that the quaternion is normalized. @f[ * \theta = 2 \cdot \arccos(q_S) @@ -379,7 +379,7 @@ template class Quaternion { Rad angle() const; /** - * @brief Rotation axis of unit quaternion + * @brief Rotation axis of a unit quaternion * * Expects that the quaternion is normalized. Returns either unit-length * vector for valid rotation quaternion or NaN vector for @@ -391,7 +391,7 @@ template class Quaternion { Vector3 axis() const; /** - * @brief Convert quaternion to rotation matrix + * @brief Convert to a rotation matrix * * @see @ref fromMatrix(), @ref DualQuaternion::toMatrix(), * @ref Matrix4::from(const Matrix3x3&, const Vector3&) @@ -399,7 +399,16 @@ template class Quaternion { Matrix3x3 toMatrix() const; /** - * @brief Add and assign quaternion + * @brief Negated quaternion + * + * @f[ + * -q = [-\boldsymbol q_V, -q_S] + * @f] + */ + Quaternion operator-() const { return {-_vector, -_scalar}; } + + /** + * @brief Add and assign a quaternion * * The computation is done in-place. @f[ * p + q = [\boldsymbol p_V + \boldsymbol q_V, p_S + q_S] @@ -412,7 +421,7 @@ template class Quaternion { } /** - * @brief Add quaternion + * @brief Add a quaternion * * @see @ref operator+=() */ @@ -421,16 +430,7 @@ template class Quaternion { } /** - * @brief Negated quaternion - * - * @f[ - * -q = [-\boldsymbol q_V, -q_S] - * @f] - */ - Quaternion operator-() const { return {-_vector, -_scalar}; } - - /** - * @brief Subtract and assign quaternion + * @brief Subtract and assign a quaternion * * The computation is done in-place. @f[ * p - q = [\boldsymbol p_V - \boldsymbol q_V, p_S - q_S] @@ -443,7 +443,7 @@ template class Quaternion { } /** - * @brief Subtract quaternion + * @brief Subtract a quaternion * * @see @ref operator-=() */ @@ -452,7 +452,7 @@ template class Quaternion { } /** - * @brief Multiply with scalar and assign + * @brief Multiply with a scalar and assign * * The computation is done in-place. @f[ * q \cdot a = [\boldsymbol q_V \cdot a, q_S \cdot a] @@ -465,7 +465,7 @@ template class Quaternion { } /** - * @brief Multiply with scalar + * @brief Multiply with a scalar * * @see @ref operator*=(T) */ @@ -474,7 +474,7 @@ template class Quaternion { } /** - * @brief Divide with scalar and assign + * @brief Divide with a scalar and assign * * The computation is done in-place. @f[ * \frac q a = [\frac {\boldsymbol q_V} a, \frac {q_S} a] @@ -487,7 +487,7 @@ template class Quaternion { } /** - * @brief Divide with scalar + * @brief Divide with a scalar * * @see @ref operator/=(T) */ @@ -496,7 +496,7 @@ template class Quaternion { } /** - * @brief Multiply with quaternion + * @brief Multiply with a quaternion * * @f[ * p q = [p_S \boldsymbol q_V + q_S \boldsymbol p_V + \boldsymbol p_V \times \boldsymbol q_V, @@ -567,7 +567,7 @@ template class Quaternion { Quaternion invertedNormalized() const; /** - * @brief Rotate vector with quaternion + * @brief Rotate a vector with a quaternion * * See @ref transformVectorNormalized(), which is faster for normalized * quaternions. @f[ @@ -583,7 +583,7 @@ template class Quaternion { } /** - * @brief Rotate vector with normalized quaternion + * @brief Rotate a vector with a normalized quaternion * * Faster alternative to @ref transformVector(), expects that the * quaternion is normalized. Done using the following equation: @f[ @@ -619,7 +619,7 @@ template class Quaternion { }; /** @relates Quaternion -@brief Multiply scalar with quaternion +@brief Multiply a scalar with a quaternion Same as @ref Quaternion::operator*(T) const. */ @@ -628,7 +628,7 @@ template inline Quaternion operator*(T scalar, const Quaternion& } /** @relates Quaternion -@brief Divide quaternion with number and invert +@brief Divide a quaternion with a scalar and invert @f[ \frac a q = [\frac a {\boldsymbol q_V}, \frac a {q_S}] diff --git a/src/Magnum/Math/RectangularMatrix.h b/src/Magnum/Math/RectangularMatrix.h index de100151b..a0295d68e 100644 --- a/src/Magnum/Math/RectangularMatrix.h +++ b/src/Magnum/Math/RectangularMatrix.h @@ -72,7 +72,7 @@ template class RectangularMatrix { }; /** - * @brief Matrix from array + * @brief Matrix from an array * @return Reference to the data as if it was matrix, thus doesn't * perform any copying. * @@ -88,7 +88,7 @@ template class RectangularMatrix { } /** - * @brief Construct matrix from vector + * @brief Construct a matrix from a vector * * Rolls the vector into matrix, i.e. first `rows` elements of the * vector will make first column of resulting matrix. @@ -99,7 +99,7 @@ template class RectangularMatrix { } /** - * @brief Construct diagonal matrix + * @brief Construct a diagonal matrix * * @see @ref diagonal() */ @@ -114,18 +114,18 @@ template class RectangularMatrix { */ constexpr /*implicit*/ RectangularMatrix() noexcept: RectangularMatrix{typename Implementation::GenerateSequence::Type{}, ZeroInit} {} - /** @brief Construct zero-filled matrix */ + /** @brief Construct a zero-filled matrix */ constexpr explicit RectangularMatrix(ZeroInitT) noexcept: RectangularMatrix{typename Implementation::GenerateSequence::Type{}, ZeroInit} {} - /** @brief Construct matrix without initializing the contents */ + /** @brief Construct without initializing the contents */ explicit RectangularMatrix(NoInitT) noexcept: RectangularMatrix{typename Implementation::GenerateSequence::Type{}, NoInit} {} - /** @brief Construct matrix from column vectors */ + /** @brief Construct from column vectors */ template constexpr /*implicit*/ RectangularMatrix(const Vector& first, const U&... next) noexcept: _data{first, next...} { static_assert(sizeof...(next)+1 == cols, "Improper number of arguments passed to RectangularMatrix constructor"); } - /** @brief Construct matrix with one value for all components */ + /** @brief Construct with one value for all components */ constexpr explicit RectangularMatrix(T value) noexcept: RectangularMatrix{typename Implementation::GenerateSequence::Type(), value} {} /** @@ -160,7 +160,7 @@ template class RectangularMatrix { constexpr const T* data() const { return _data[0].data(); } /**< @overload */ /** - * @brief Matrix column + * @brief Column at given position * * Particular elements can be accessed using @ref Vector::operator[](), * e.g.: @@ -174,7 +174,7 @@ template class RectangularMatrix { constexpr const Vector& operator[](std::size_t col) const { return _data[col]; } /**< @overload */ /** - * @brief Matrix row + * @brief Row at given position * * Consider using @ref transposed() when accessing rows frequently, as * this is slower than accessing columns due to the way the matrix is @@ -257,7 +257,7 @@ template class RectangularMatrix { RectangularMatrix operator-() const; /** - * @brief Add and assign matrix + * @brief Add and assign a matrix * * The computation is done column-wise in-place. @f[ * \boldsymbol A_j = \boldsymbol A_j + \boldsymbol B_j @@ -271,7 +271,7 @@ template class RectangularMatrix { } /** - * @brief Add matrix + * @brief Add a matrix * * @see @ref operator+=() */ @@ -280,7 +280,7 @@ template class RectangularMatrix { } /** - * @brief Subtract and assign matrix + * @brief Subtract and assign a matrix * * The computation is done column-wise in-place. @f[ * \boldsymbol A_j = \boldsymbol A_j - \boldsymbol B_j @@ -294,7 +294,7 @@ template class RectangularMatrix { } /** - * @brief Subtract matrix + * @brief Subtract a matrix * * @see @ref operator-=() */ @@ -303,54 +303,54 @@ template class RectangularMatrix { } /** - * @brief Multiply matrix with number and assign + * @brief Multiply with a scalar and assign * * The computation is done column-wise in-place. @f[ * \boldsymbol A_j = a \boldsymbol A_j * @f] */ - RectangularMatrix& operator*=(T number) { + RectangularMatrix& operator*=(T scalar) { for(std::size_t i = 0; i != cols; ++i) - _data[i] *= number; + _data[i] *= scalar; return *this; } /** - * @brief Multiply matrix with number + * @brief Multiply with a scalar * * @see @ref operator*=(T), @ref operator*(T, const RectangularMatrix&) */ - RectangularMatrix operator*(T number) const { - return RectangularMatrix(*this) *= number; + RectangularMatrix operator*(T scalar) const { + return RectangularMatrix(*this) *= scalar; } /** - * @brief Divide matrix with number and assign + * @brief Divide with a scalar and assign * * The computation is done column-wise in-place. @f[ * \boldsymbol A_j = \frac{\boldsymbol A_j} a * @f] */ - RectangularMatrix& operator/=(T number) { + RectangularMatrix& operator/=(T scalar) { for(std::size_t i = 0; i != cols; ++i) - _data[i] /= number; + _data[i] /= scalar; return *this; } /** - * @brief Divide matrix with number + * @brief Divide with a scalar * * @see @ref operator/=(T), * @ref operator/(T, const RectangularMatrix&) */ - RectangularMatrix operator/(T number) const { - return RectangularMatrix(*this) /= number; + RectangularMatrix operator/(T scalar) const { + return RectangularMatrix(*this) /= scalar; } /** - * @brief Multiply matrix + * @brief Multiply a matrix * * @f[ * (\boldsymbol {AB})_{ji} = \sum_{k=0}^{m-1} \boldsymbol A_{ki} \boldsymbol B_{jk} @@ -360,7 +360,7 @@ template class RectangularMatrix { template RectangularMatrix operator*(const RectangularMatrix& other) const; /** - * @brief Multiply vector + * @brief Multiply a vector * * Internally the same as multiplying with one-column matrix, but * returns vector. @f[ @@ -527,7 +527,7 @@ template using Matrix4x3 = RectangularMatrix<4, 3, T>; #endif /** @relates RectangularMatrix -@brief Multiply number with matrix +@brief Multiply a scalar with a matrix Same as @ref RectangularMatrix::operator*(T) const. */ @@ -537,13 +537,13 @@ template inline RectangularMatrix::type #endif - number, const RectangularMatrix& matrix) + scalar, const RectangularMatrix& matrix) { - return matrix*number; + return matrix*scalar; } /** @relates RectangularMatrix -@brief Divide matrix with number and invert +@brief Divide a matrix with a scalar and invert The computation is done column-wise. @f[ \boldsymbol B_j = \frac a {\boldsymbol A_j} @@ -556,18 +556,18 @@ template inline RectangularMatrix::type #endif - number, const RectangularMatrix& matrix) + scalar, const RectangularMatrix& matrix) { RectangularMatrix out{NoInit}; for(std::size_t i = 0; i != cols; ++i) - out[i] = number/matrix[i]; + out[i] = scalar/matrix[i]; return out; } /** @relates RectangularMatrix -@brief Multiply vector with rectangular matrix +@brief Multiply a vector with a rectangular matrix Internally the same as multiplying one-column matrix with one-row matrix. @f[ (\boldsymbol {aA})_{ji} = \boldsymbol a_i \boldsymbol A_j diff --git a/src/Magnum/Math/Unit.h b/src/Magnum/Math/Unit.h index d6fdcaa0d..0fe064999 100644 --- a/src/Magnum/Math/Unit.h +++ b/src/Magnum/Math/Unit.h @@ -53,13 +53,13 @@ template class Derived, class T> class Unit { */ constexpr /*implicit*/ Unit() noexcept: _value(T(0)) {} - /** @brief Construct zero value */ + /** @brief Construct a zero value */ constexpr explicit Unit(ZeroInitT) noexcept: _value(T(0)) {} /** @brief Construct without initializing the contents */ explicit Unit(NoInitT) noexcept {} - /** @brief Explicit conversion from unitless type */ + /** @brief Explicit conversion from a unitless type */ constexpr explicit Unit(T value) noexcept: _value(value) {} /** @brief Construct from another underlying type */ @@ -106,46 +106,46 @@ template class Derived, class T> class Unit { return Unit(-_value); } - /** @brief Add and assign value */ + /** @brief Add and assign a value */ Unit& operator+=(Unit other) { _value += other._value; return *this; } - /** @brief Add value */ + /** @brief Add a value */ constexpr Unit operator+(Unit other) const { return Unit(_value + other._value); } - /** @brief Subtract and assign value */ + /** @brief Subtract and assign a value */ Unit& operator-=(Unit other) { _value -= other._value; return *this; } - /** @brief Subtract value */ + /** @brief Subtract a value */ constexpr Unit operator-(Unit other) const { return Unit(_value - other._value); } - /** @brief Multiply with number and assign */ + /** @brief Multiply with a number and assign */ Unit& operator*=(T number) { _value *= number; return *this; } - /** @brief Multiply with number */ + /** @brief Multiply with a number */ constexpr Unit operator*(T number) const { return Unit(_value*number); } - /** @brief Divide with number and assign */ + /** @brief Divide with a number and assign */ Unit& operator/=(T number) { _value /= number; return *this; } - /** @brief Divide with number */ + /** @brief Divide with a number */ constexpr Unit operator/(T number) const { return Unit(_value/number); } diff --git a/src/Magnum/Math/Vector.h b/src/Magnum/Math/Vector.h index dccb41d4c..9909768e9 100644 --- a/src/Magnum/Math/Vector.h +++ b/src/Magnum/Math/Vector.h @@ -136,7 +136,7 @@ template class Vector { }; /** - * @brief Vector from array + * @brief Vector from an array * @return Reference to the data as if it was Vector, thus doesn't * perform any copying. * @@ -178,17 +178,17 @@ template class Vector { */ constexpr explicit Vector(ZeroInitT) noexcept: _data{} {} - /** @brief Construct vector without initializing the contents */ + /** @brief Construct a vector without initializing the contents */ explicit Vector(NoInitT) noexcept {} - /** @brief Construct vector from components */ + /** @brief Construct a vector from components */ #ifdef DOXYGEN_GENERATING_OUTPUT template constexpr /*implicit*/ Vector(T first, U... next) noexcept; #else template::type> constexpr /*implicit*/ Vector(T first, U... next) noexcept: _data{first, next...} {} #endif - /** @brief Construct vector with one value for all components */ + /** @brief Construct a vector with one value for all components */ #ifdef DOXYGEN_GENERATING_OUTPUT constexpr explicit Vector(T value) noexcept; #else @@ -196,7 +196,7 @@ template class Vector { #endif /** - * @brief Construct vector from another of different type + * @brief Construct a vector from another of different type * * Performs only default casting on the values, no rounding or * anything else. Example usage: @@ -205,13 +205,13 @@ template class Vector { */ template constexpr explicit Vector(const Vector& other) noexcept: Vector(typename Implementation::GenerateSequence::Type(), other) {} - /** @brief Construct vector from external representation */ + /** @brief Construct a vector from external representation */ template::from(std::declval()))> constexpr explicit Vector(const U& other) noexcept: Vector(Implementation::VectorConverter::from(other)) {} /** @brief Copy constructor */ constexpr /*implicit*/ Vector(const Vector&) noexcept = default; - /** @brief Convert vector to external representation */ + /** @brief Convert a vector to external representation */ template::to(std::declval>()))> constexpr explicit operator U() const { return Implementation::VectorConverter::to(*this); } @@ -247,28 +247,28 @@ template class Vector { } /** - * @brief Component-wise less than + * @brief Component-wise less than comparison * * @m_keyword{lessThan(),GLSL lessThan(),} */ BoolVector operator<(const Vector& other) const; /** - * @brief Component-wise less than or equal + * @brief Component-wise less than or equal comparison * * @m_keyword{lessThanEqual(),GLSL lessThanEqual(),} */ BoolVector operator<=(const Vector& other) const; /** - * @brief Component-wise greater than or equal + * @brief Component-wise greater than or equal comparison * * @m_keyword{greaterThanEqual(),GLSL greaterThanEqual(),} */ BoolVector operator>=(const Vector& other) const; /** - * @brief Component-wise greater than + * @brief Component-wise greater than comparison * * @m_keyword{greaterThan(),GLSL greaterThan(),} */ @@ -309,7 +309,7 @@ template class Vector { Vector operator-() const; /** - * @brief Add and assign vector + * @brief Add and assign a vector * * The computation is done in-place. @f[ * \boldsymbol a_i = \boldsymbol a_i + \boldsymbol b_i @@ -323,7 +323,7 @@ template class Vector { } /** - * @brief Add vector + * @brief Add a vector * * @see @ref operator+=(), @ref sum() */ @@ -332,7 +332,7 @@ template class Vector { } /** - * @brief Subtract and assign vector + * @brief Subtract and assign a vector * * The computation is done in-place. @f[ * \boldsymbol a_i = \boldsymbol a_i - \boldsymbol b_i @@ -346,7 +346,7 @@ template class Vector { } /** - * @brief Subtract vector + * @brief Subtract a vector * * @see @ref operator-=() */ @@ -355,7 +355,7 @@ template class Vector { } /** - * @brief Multiply vector with number and assign + * @brief Multiply with a scalar and assign * * The computation is done in-place. @f[ * \boldsymbol a_i = b \boldsymbol a_i @@ -363,26 +363,26 @@ template class Vector { * @see @ref operator*=(const Vector&), * @ref operator*=(Vector&, FloatingPoint) */ - Vector& operator*=(T number) { + Vector& operator*=(T scalar) { for(std::size_t i = 0; i != size; ++i) - _data[i] *= number; + _data[i] *= scalar; return *this; } /** - * @brief Multiply vector with number + * @brief Multiply with a scalar * * @see @ref operator*(const Vector&) const, * @ref operator*=(T), @ref operator*(T, const Vector&), * @ref operator*(const Vector&, FloatingPoint) */ - Vector operator*(T number) const { - return Vector(*this) *= number; + Vector operator*(T scalar) const { + return Vector(*this) *= scalar; } /** - * @brief Divide vector with number and assign + * @brief Divide with a scalar and assign * * The computation is done in-place. @f[ * \boldsymbol a_i = \frac{\boldsymbol a_i} b @@ -390,26 +390,26 @@ template class Vector { * @see @ref operator/=(const Vector&), * @ref operator/=(Vector&, FloatingPoint) */ - Vector& operator/=(T number) { + Vector& operator/=(T scalar) { for(std::size_t i = 0; i != size; ++i) - _data[i] /= number; + _data[i] /= scalar; return *this; } /** - * @brief Divide vector with number + * @brief Divide with a scalar * * @see @ref operator/(const Vector&) const, * @ref operator/=(T), @ref operator/(T, const Vector&), * @ref operator/(const Vector&, FloatingPoint) */ - Vector operator/(T number) const { - return Vector(*this) /= number; + Vector operator/(T scalar) const { + return Vector(*this) /= scalar; } /** - * @brief Multiply vector component-wise and assign + * @brief Multiply a vector component-wise and assign * * The computation is done in-place. @f[ * \boldsymbol a_i = \boldsymbol a_i \boldsymbol b_i @@ -425,7 +425,7 @@ template class Vector { } /** - * @brief Multiply vector component-wise + * @brief Multiply a vector component-wise * * @see @ref operator*(T) const, @ref operator*=(const Vector&), * @ref operator*(const Vector&, const Vector&), @@ -436,7 +436,7 @@ template class Vector { } /** - * @brief Divide vector component-wise and assign + * @brief Divide a vector component-wise and assign * * The computation is done in-place. @f[ * \boldsymbol a_i = \frac{\boldsymbol a_i}{\boldsymbol b_i} @@ -452,7 +452,7 @@ template class Vector { } /** - * @brief Divide vector component-wise + * @brief Divide a vector component-wise * * @see @ref operator/(T) const, @ref operator/=(const Vector&), * @ref operator/(const Vector&, const Vector&) @@ -537,7 +537,7 @@ template class Vector { } /** - * @brief Vector projected onto line + * @brief Vector projected onto a line * * Returns a vector projected onto @p line. Enabled only for * floating-point types. @f[ @@ -555,7 +555,7 @@ template class Vector { } /** - * @brief Vector projected onto normalized line + * @brief Vector projected onto a normalized line * * Slightly faster alternative to @ref projected(), expects @p line to * be normalized. Enabled only for floating-point types. @f[ @@ -649,7 +649,7 @@ template class Vector { }; /** @relates Vector -@brief Multiply number with vector +@brief Multiply a scalar with a vector Same as @ref Vector::operator*(T) const. */ @@ -659,13 +659,13 @@ template inline Vector operator*( #else typename std::common_type::type #endif - number, const Vector& vector) + scalar, const Vector& vector) { - return vector*number; + return vector*scalar; } /** @relates Vector -@brief Divide vector with number and invert +@brief Divide a vector with a scalar and invert @f[ \boldsymbol c_i = \frac b {\boldsymbol a_i} @@ -678,18 +678,18 @@ template inline Vector operator/( #else typename std::common_type::type #endif - number, const Vector& vector) + scalar, const Vector& vector) { Vector out; for(std::size_t i = 0; i != size; ++i) - out[i] = number/vector[i]; + out[i] = scalar/vector[i]; return out; } /** @relates Vector -@brief Do modulo of integral vector and assign +@brief Do modulo of an integral vector and assign The computation is done in-place. */ @@ -707,7 +707,7 @@ operator%=(Vector& a, Integral b) { } /** @relates Vector -@brief Modulo of integral vector +@brief Modulo of an integral vector */ template inline #ifdef DOXYGEN_GENERATING_OUTPUT @@ -753,7 +753,7 @@ operator%(const Vector& a, const Vector& b) { } /** @relates Vector -@brief Bitwise NOT of integral vector +@brief Bitwise NOT of an integral vector */ template inline #ifdef DOXYGEN_GENERATING_OUTPUT @@ -867,7 +867,7 @@ operator^(const Vector& a, const Vector& b) { } /** @relates Vector -@brief Do bitwise left shift of integral vector and assign +@brief Do bitwise left shift of an integral vector and assign The computation is done in-place. */ @@ -892,7 +892,7 @@ operator<<=(Vector& vector, } /** @relates Vector -@brief Bitwise left shift of integral vector +@brief Bitwise left shift of an integral vector */ template inline #ifdef DOXYGEN_GENERATING_OUTPUT @@ -913,7 +913,7 @@ operator<<(const Vector& vector, } /** @relates Vector -@brief Do bitwise right shift of integral vector and assign +@brief Do bitwise right shift of an integral vector and assign The computation is done in-place. */ @@ -937,7 +937,7 @@ operator>>=(Vector& vector, } /** @relates Vector -@brief Bitwise left shift of integral vector +@brief Bitwise left shift of an integral vector */ template inline #ifdef DOXYGEN_GENERATING_OUTPUT @@ -957,7 +957,7 @@ operator>>(const Vector& vector, } /** @relates Vector -@brief Multiply integral vector with floating-point number and assign +@brief Multiply an integral vector with a floating-point scalar and assign Similar to @ref Vector::operator*=(T), except that the multiplication is done in floating-point. The computation is done in-place. @@ -968,15 +968,15 @@ Vector& #else typename std::enable_if::value && std::is_floating_point::value, Vector&>::type #endif -operator*=(Vector& vector, FloatingPoint number) { +operator*=(Vector& vector, FloatingPoint scalar) { for(std::size_t i = 0; i != size; ++i) - vector[i] = Integral(vector[i]*number); + vector[i] = Integral(vector[i]*scalar); return vector; } /** @relates Vector -@brief Multiply integral vector with floating-point number +@brief Multiply an integral vector with a floating-point scalar Similar to @ref Vector::operator*(T) const, except that the multiplication is done in floating-point. @@ -987,13 +987,13 @@ Vector #else typename std::enable_if::value && std::is_floating_point::value, Vector>::type #endif -operator*(const Vector& vector, FloatingPoint number) { +operator*(const Vector& vector, FloatingPoint scalar) { Vector copy(vector); - return copy *= number; + return copy *= scalar; } /** @relates Vector -@brief Multiply floating-point number with integral vector +@brief Multiply a floating-point scalar with an integral vector Same as @ref operator*(const Vector&, FloatingPoint). */ @@ -1003,12 +1003,12 @@ Vector #else typename std::enable_if::value && std::is_floating_point::value, Vector>::type #endif -operator*(FloatingPoint number, const Vector& vector) { - return vector*number; +operator*(FloatingPoint scalar, const Vector& vector) { + return vector*scalar; } /** @relates Vector -@brief Divide integral vector with floating-point number and assign +@brief Divide an integral vector with a floating-point scalar and assign Similar to @ref Vector::operator/=(T), except that the division is done in floating-point. The computation is done in-place. @@ -1019,15 +1019,15 @@ Vector& #else typename std::enable_if::value && std::is_floating_point::value, Vector&>::type #endif -operator/=(Vector& vector, FloatingPoint number) { +operator/=(Vector& vector, FloatingPoint scalar) { for(std::size_t i = 0; i != size; ++i) - vector[i] = Integral(vector[i]/number); + vector[i] = Integral(vector[i]/scalar); return vector; } /** @relates Vector -@brief Divide integral vector with floating-point number +@brief Divide an integral vector with a floating-point scalar Similar to @ref Vector::operator/(T) const, except that the division is done in floating-point. @@ -1038,13 +1038,13 @@ Vector #else typename std::enable_if::value && std::is_floating_point::value, Vector>::type #endif -operator/(const Vector& vector, FloatingPoint number) { +operator/(const Vector& vector, FloatingPoint scalar) { Vector copy(vector); - return copy /= number; + return copy /= scalar; } /** @relates Vector -@brief Multiply integral vector with floating-point vector component-wise and assign +@brief Multiply an integral vector with a floating-point vector component-wise and assign Similar to @ref Vector::operator*=(const Vector&), except that the multiplication is done in floating-point. The computation is done in-place. @@ -1063,7 +1063,7 @@ operator*=(Vector& a, const Vector& b) { } /** @relates Vector -@brief Multiply integral vector with floating-point vector component-wise +@brief Multiply an integral vector with a floating-point vector component-wise Similar to @ref Vector::operator*(const Vector&) const, except that the multiplication is done in floating-point. The result is always integral @@ -1082,7 +1082,7 @@ operator*(const Vector& a, const Vector& b) } /** @relates Vector -@brief Multiply floating-point vector with integral vector component-wise +@brief Multiply a floating-point vector with an integral vector component-wise Same as @ref operator*(const Vector&, const Vector&). */ @@ -1097,7 +1097,7 @@ operator*(const Vector& a, const Vector& b) } /** @relates Vector -@brief Divide integral vector with floating-point vector component-wise and assign +@brief Divide an integral vector with a floating-point vector component-wise and assign Similar to @ref Vector::operator/=(const Vector&), except that the division is done in floating-point. The computation is done in-place. @@ -1116,7 +1116,7 @@ operator/=(Vector& a, const Vector& b) { } /** @relates Vector -@brief Divide integral vector with floating-point vector component-wise +@brief Divide an integral vector with a floating-point vector component-wise Similar to @ref Vector::operator/(const Vector&) const, except that the division is done in floating-point. The result is always integral vector, diff --git a/src/Magnum/Math/Vector2.h b/src/Magnum/Math/Vector2.h index 7dc970c23..22dddcaa5 100644 --- a/src/Magnum/Math/Vector2.h +++ b/src/Magnum/Math/Vector2.h @@ -63,7 +63,7 @@ See @ref matrix-vector for brief introduction. template class Vector2: public Vector<2, T> { public: /** - * @brief Vector in direction of X axis (right) + * @brief Vector in a direction of X axis (right) * * Usable for translation in given axis, for example: * @@ -74,7 +74,7 @@ template class Vector2: public Vector<2, T> { constexpr static Vector2 xAxis(T length = T(1)) { return {length, T(0)}; } /** - * @brief Vector in direction of Y axis (up) + * @brief Vector in a direction of Y axis (up) * * See @ref xAxis() for more information. * @see @ref yScale(), @ref Matrix3::up() @@ -82,7 +82,7 @@ template class Vector2: public Vector<2, T> { constexpr static Vector2 yAxis(T length = T(1)) { return {T(0), length}; } /** - * @brief Scaling vector in direction of X axis (width) + * @brief Scaling vector in a direction of X axis (width) * * Usable for scaling along given direction, for example: * @@ -93,7 +93,7 @@ template class Vector2: public Vector<2, T> { constexpr static Vector2 xScale(T scale) { return {scale, T(1)}; } /** - * @brief Scaling vector in direction of Y axis (height) + * @brief Scaling vector in a direction of Y axis (height) * * See @ref xScale() for more information. * @see @ref yAxis() diff --git a/src/Magnum/Math/Vector3.h b/src/Magnum/Math/Vector3.h index f14734fdb..c6fe63338 100644 --- a/src/Magnum/Math/Vector3.h +++ b/src/Magnum/Math/Vector3.h @@ -67,7 +67,7 @@ See @ref matrix-vector for brief introduction. template class Vector3: public Vector<3, T> { public: /** - * @brief Vector in direction of X axis (right) + * @brief Vector in a direction of X axis (right) * * Usable for translation or rotation along given axis, for example: * @@ -79,7 +79,7 @@ template class Vector3: public Vector<3, T> { constexpr static Vector3 xAxis(T length = T(1)) { return {length, T(0), T(0)}; } /** - * @brief Vector in direction of Y axis (up) + * @brief Vector in a direction of Y axis (up) * * See @ref xAxis() for more information. * @see @ref yScale(), @ref Color3::green(), @ref Matrix4::up() @@ -87,7 +87,7 @@ template class Vector3: public Vector<3, T> { constexpr static Vector3 yAxis(T length = T(1)) { return {T(0), length, T(0)}; } /** - * @brief Vector in direction of Z axis (backward) + * @brief Vector in a direction of Z axis (backward) * * See @ref xAxis() for more information. * @see @ref zScale(), @ref Color3::blue(), @ref Matrix4::backward() @@ -95,7 +95,7 @@ template class Vector3: public Vector<3, T> { constexpr static Vector3 zAxis(T length = T(1)) { return {T(0), T(0), length}; } /** - * @brief Scaling vector in direction of X axis (width) + * @brief Scaling vector in a direction of X axis (width) * * Usable for scaling along given direction, for example: * @@ -106,7 +106,7 @@ template class Vector3: public Vector<3, T> { constexpr static Vector3 xScale(T scale) { return {scale, T(1), T(1)}; } /** - * @brief Scaling vector in direction of Y axis (height) + * @brief Scaling vector in a direction of Y axis (height) * * See @ref xScale() for more information. * @see @ref yAxis(), @ref Color3::magenta() @@ -114,7 +114,7 @@ template class Vector3: public Vector<3, T> { constexpr static Vector3 yScale(T scale) { return {T(1), scale, T(1)}; } /** - * @brief Scaling vector in direction of Z axis (depth) + * @brief Scaling vector in a direction of Z axis (depth) * * See @ref xScale() for more information. * @see @ref zAxis(), @ref Color3::yellow()