Browse Source

Math: doc++

Fixing Engrish while doing the Python bindings.
pull/228/head
Vladimír Vondruš 7 years ago
parent
commit
4b4b8efc1b
  1. 12
      src/Magnum/Math/BoolVector.h
  2. 14
      src/Magnum/Math/Matrix.h
  3. 23
      src/Magnum/Math/Matrix3.h
  4. 49
      src/Magnum/Math/Matrix4.h
  5. 62
      src/Magnum/Math/Quaternion.h
  6. 68
      src/Magnum/Math/RectangularMatrix.h
  7. 20
      src/Magnum/Math/Unit.h
  8. 132
      src/Magnum/Math/Vector.h
  9. 8
      src/Magnum/Math/Vector2.h
  10. 12
      src/Magnum/Math/Vector3.h

12
src/Magnum/Math/BoolVector.h

@ -108,14 +108,14 @@ template<std::size_t size> class BoolVector {
*/ */
constexpr /*implicit*/ BoolVector() noexcept: _data{} {} constexpr /*implicit*/ BoolVector() noexcept: _data{} {}
/** @brief Construct zero-filled boolean vector */ /** @brief Construct a zero-filled boolean vector */
constexpr explicit BoolVector(ZeroInitT) noexcept: _data{} {} constexpr explicit BoolVector(ZeroInitT) noexcept: _data{} {}
/** @brief Construct without initializing the contents */ /** @brief Construct without initializing the contents */
explicit BoolVector(NoInitT) noexcept {} 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 first Value for first 8bit segment
* @param next Values for next Bbit segments * @param next Values for next Bbit segments
*/ */
@ -125,20 +125,20 @@ template<std::size_t size> class BoolVector {
template<class ...T, class U = typename std::enable_if<sizeof...(T)+1 == DataSize, bool>::type> constexpr /*implicit*/ BoolVector(UnsignedByte first, T... next) noexcept: _data{first, UnsignedByte(next)...} {} template<class ...T, class U = typename std::enable_if<sizeof...(T)+1 == DataSize, bool>::type> constexpr /*implicit*/ BoolVector(UnsignedByte first, T... next) noexcept: _data{first, UnsignedByte(next)...} {}
#endif #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 #ifdef DOXYGEN_GENERATING_OUTPUT
explicit BoolVector(T value) noexcept; explicit BoolVector(T value) noexcept;
#else #else
template<class T, class U = typename std::enable_if<std::is_same<bool, T>::value && size != 1, bool>::type> constexpr explicit BoolVector(T value) noexcept: BoolVector(typename Implementation::GenerateSequence<DataSize>::Type(), value ? FullSegmentMask : 0) {} template<class T, class U = typename std::enable_if<std::is_same<bool, T>::value && size != 1, bool>::type> constexpr explicit BoolVector(T value) noexcept: BoolVector(typename Implementation::GenerateSequence<DataSize>::Type(), value ? FullSegmentMask : 0) {}
#endif #endif
/** @brief Construct boolean vector from external representation */ /** @brief Construct a boolean vector from external representation */
template<class U, class V = decltype(Implementation::BoolVectorConverter<size, U>::from(std::declval<U>()))> constexpr explicit BoolVector(const U& other) noexcept: BoolVector{Implementation::BoolVectorConverter<size, U>::from(other)} {} template<class U, class V = decltype(Implementation::BoolVectorConverter<size, U>::from(std::declval<U>()))> constexpr explicit BoolVector(const U& other) noexcept: BoolVector{Implementation::BoolVectorConverter<size, U>::from(other)} {}
/** @brief Copy constructor */ /** @brief Copy constructor */
constexpr /*implicit*/ BoolVector(const BoolVector<size>&) noexcept = default; constexpr /*implicit*/ BoolVector(const BoolVector<size>&) noexcept = default;
/** @brief Convert boolean vector to external representation */ /** @brief Convert a boolean vector to external representation */
template<class U, class V = decltype(Implementation::BoolVectorConverter<size, U>::to(std::declval<BoolVector<size>>()))> constexpr explicit operator U() const { template<class U, class V = decltype(Implementation::BoolVectorConverter<size, U>::to(std::declval<BoolVector<size>>()))> constexpr explicit operator U() const {
return Implementation::BoolVectorConverter<size, U>::to(*this); return Implementation::BoolVectorConverter<size, U>::to(*this);
} }
@ -157,7 +157,7 @@ template<std::size_t size> class BoolVector {
return (_data[i/8] >> i%8) & 0x01; return (_data[i/8] >> i%8) & 0x01;
} }
/** @brief Set bit at given position */ /** @brief Set a bit at given position */
BoolVector<size>& set(std::size_t i, bool value) { BoolVector<size>& set(std::size_t i, bool value) {
value ? _data[i/8] |= (1 << i%8) : value ? _data[i/8] |= (1 << i%8) :
_data[i/8] &= ~(1 << i%8); _data[i/8] &= ~(1 << i%8);

14
src/Magnum/Math/Matrix.h

@ -70,10 +70,10 @@ template<std::size_t size, class T> class Matrix: public RectangularMatrix<size,
constexpr /*implicit*/ Matrix() noexcept: RectangularMatrix<size, size, T>{typename Implementation::GenerateSequence<size>::Type(), Vector<size, T>(T(1))} {} constexpr /*implicit*/ Matrix() noexcept: RectangularMatrix<size, size, T>{typename Implementation::GenerateSequence<size>::Type(), Vector<size, T>(T(1))} {}
/** /**
* @brief Identity constructor * @brief Construct an identity matrix
* *
* Creates an identity matrix. @p value allows you to specify value on * The @p value allows you to specify a value on diagonal.
* diagonal. * @see @ref fromDiagonal()
*/ */
constexpr explicit Matrix(IdentityInitT, T value = T(1)) noexcept: RectangularMatrix<size, size, T>{typename Implementation::GenerateSequence<size>::Type(), Vector<size, T>(value)} {} constexpr explicit Matrix(IdentityInitT, T value = T(1)) noexcept: RectangularMatrix<size, size, T>{typename Implementation::GenerateSequence<size>::Type(), Vector<size, T>(value)} {}
@ -83,14 +83,14 @@ template<std::size_t size, class T> class Matrix: public RectangularMatrix<size,
/** @copydoc RectangularMatrix::RectangularMatrix(NoInitT) */ /** @copydoc RectangularMatrix::RectangularMatrix(NoInitT) */
constexpr explicit Matrix(NoInitT) noexcept: RectangularMatrix<size, size, T>{NoInit} {} constexpr explicit Matrix(NoInitT) noexcept: RectangularMatrix<size, size, T>{NoInit} {}
/** @brief Construct matrix from column vectors */ /** @brief Construct from column vectors */
template<class ...U> constexpr /*implicit*/ Matrix(const Vector<size, T>& first, const U&... next) noexcept: RectangularMatrix<size, size, T>(first, next...) {} template<class ...U> constexpr /*implicit*/ Matrix(const Vector<size, T>& first, const U&... next) noexcept: RectangularMatrix<size, size, T>(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<size, size, T>{typename Implementation::GenerateSequence<size>::Type(), value} {} constexpr explicit Matrix(T value) noexcept: RectangularMatrix<size, size, T>{typename Implementation::GenerateSequence<size>::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 * Performs only default casting on the values, no rounding or
* anything else. Example usage: * anything else. Example usage:
@ -103,7 +103,7 @@ template<std::size_t size, class T> class Matrix: public RectangularMatrix<size,
template<class U, class V = decltype(Implementation::RectangularMatrixConverter<size, size, T, U>::from(std::declval<U>()))> constexpr explicit Matrix(const U& other): RectangularMatrix<size, size, T>(Implementation::RectangularMatrixConverter<size, size, T, U>::from(other)) {} template<class U, class V = decltype(Implementation::RectangularMatrixConverter<size, size, T, U>::from(std::declval<U>()))> constexpr explicit Matrix(const U& other): RectangularMatrix<size, size, T>(Implementation::RectangularMatrixConverter<size, size, 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 different size
* *
* If the other matrix is larger, takes only the first @cpp size @ce * 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 * columns and rows from it; if the other matrix is smaller, it's

23
src/Magnum/Math/Matrix3.h

@ -203,10 +203,9 @@ template<class T> class Matrix3: public Matrix3x3<T> {
constexpr /*implicit*/ Matrix3() noexcept: Matrix3x3<T>{IdentityInit, T(1)} {} constexpr /*implicit*/ Matrix3() noexcept: Matrix3x3<T>{IdentityInit, T(1)} {}
/** /**
* @brief Identity constructor * @brief Construct an identity matrix
* *
* Creates an identity matrix. @p value allows you to specify value on * The @p value allows you to specify value on diagonal.
* diagonal.
*/ */
constexpr explicit Matrix3(IdentityInitT, T value = T{1}) noexcept: Matrix3x3<T>{IdentityInit, value} {} constexpr explicit Matrix3(IdentityInitT, T value = T{1}) noexcept: Matrix3x3<T>{IdentityInit, value} {}
@ -216,20 +215,20 @@ template<class T> class Matrix3: public Matrix3x3<T> {
/** @copydoc Matrix::Matrix(NoInitT) */ /** @copydoc Matrix::Matrix(NoInitT) */
constexpr explicit Matrix3(NoInitT) noexcept: Matrix3x3<T>{NoInit} {} constexpr explicit Matrix3(NoInitT) noexcept: Matrix3x3<T>{NoInit} {}
/** @brief Construct matrix from column vectors */ /** @brief Construct from column vectors */
constexpr /*implicit*/ Matrix3(const Vector3<T>& first, const Vector3<T>& second, const Vector3<T>& third) noexcept: Matrix3x3<T>(first, second, third) {} constexpr /*implicit*/ Matrix3(const Vector3<T>& first, const Vector3<T>& second, const Vector3<T>& third) noexcept: Matrix3x3<T>(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<T>{value} {} constexpr explicit Matrix3(T value) noexcept: Matrix3x3<T>{value} {}
/** @copydoc Matrix::Matrix(const RectangularMatrix<size, size, U>&) */ /** @copydoc Matrix::Matrix(const RectangularMatrix<size, size, U>&) */
template<class U> constexpr explicit Matrix3(const RectangularMatrix<3, 3, U>& other) noexcept: Matrix3x3<T>(other) {} template<class U> constexpr explicit Matrix3(const RectangularMatrix<3, 3, U>& other) noexcept: Matrix3x3<T>(other) {}
/** @brief Construct matrix from external representation */ /** @brief Construct from external representation */
template<class U, class V = decltype(Implementation::RectangularMatrixConverter<3, 3, T, U>::from(std::declval<U>()))> constexpr explicit Matrix3(const U& other) noexcept: Matrix3x3<T>(Implementation::RectangularMatrixConverter<3, 3, T, U>::from(other)) {} template<class U, class V = decltype(Implementation::RectangularMatrixConverter<3, 3, T, U>::from(std::declval<U>()))> constexpr explicit Matrix3(const U& other) noexcept: Matrix3x3<T>(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 * 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 * columns and rows from it; if the other matrix is smaller, it's
@ -241,7 +240,7 @@ template<class T> class Matrix3: public Matrix3x3<T> {
constexpr /*implicit*/ Matrix3(const RectangularMatrix<3, 3, T>& other) noexcept: Matrix3x3<T>(other) {} constexpr /*implicit*/ Matrix3(const RectangularMatrix<3, 3, T>& other) noexcept: Matrix3x3<T>(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. * Rigid transformation consists only of rotation and translation (i.e.
* no scaling or projection). * no scaling or projection).
@ -279,7 +278,7 @@ template<class T> class Matrix3: public Matrix3x3<T> {
} }
/** /**
* @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 * Normalized upper-left 2x2 part of the matrix. Assuming the following
* matrix, with the upper-left 2x2 part represented by column vectors * matrix, with the upper-left 2x2 part represented by column vectors
@ -429,7 +428,7 @@ template<class T> class Matrix3: public Matrix3x3<T> {
} }
/** /**
* @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 * Length of vectors in upper-left 2x2 part of the matrix. Use the
* faster alternative @ref scalingSquared() where possible. Assuming * faster alternative @ref scalingSquared() where possible. Assuming
@ -603,7 +602,7 @@ template<class T> class Matrix3: public Matrix3x3<T> {
Matrix3<T> invertedRigid() const; Matrix3<T> 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 * Unlike in @ref transformPoint(), translation is not involved in the
* transformation. @f[ * transformation. @f[
@ -618,7 +617,7 @@ template<class T> class Matrix3: public Matrix3x3<T> {
} }
/** /**
* @brief Transform 2D point with the matrix * @brief Transform a 2D point with the matrix
* *
* Unlike in @ref transformVector(), translation is also involved in * Unlike in @ref transformVector(), translation is also involved in
* the transformation. @f[ * the transformation. @f[

49
src/Magnum/Math/Matrix4.h

@ -120,7 +120,7 @@ template<class T> class Matrix4: public Matrix4x4<T> {
static Matrix4<T> rotation(Rad<T> angle, const Vector3<T>& normalizedAxis); static Matrix4<T> rotation(Rad<T> angle, const Vector3<T>& normalizedAxis);
/** /**
* @brief 3D rotation matrix around X axis * @brief 3D rotation matrix around the X axis
* @param angle Rotation angle (counterclockwise) * @param angle Rotation angle (counterclockwise)
* *
* Faster than calling @cpp Matrix4::rotation(angle, Vector3::xAxis()) @ce. @f[ * Faster than calling @cpp Matrix4::rotation(angle, Vector3::xAxis()) @ce. @f[
@ -138,7 +138,7 @@ template<class T> class Matrix4: public Matrix4x4<T> {
static Matrix4<T> rotationX(Rad<T> angle); static Matrix4<T> rotationX(Rad<T> angle);
/** /**
* @brief 3D rotation matrix around Y axis * @brief 3D rotation matrix around the Y axis
* @param angle Rotation angle (counterclockwise) * @param angle Rotation angle (counterclockwise)
* *
* Faster than calling @cpp Matrix4::rotation(angle, Vector3::yAxis()) @ce. @f[ * Faster than calling @cpp Matrix4::rotation(angle, Vector3::yAxis()) @ce. @f[
@ -156,7 +156,7 @@ template<class T> class Matrix4: public Matrix4x4<T> {
static Matrix4<T> rotationY(Rad<T> angle); static Matrix4<T> rotationY(Rad<T> angle);
/** /**
* @brief 3D rotation matrix around Z axis * @brief 3D rotation matrix around the Z axis
* @param angle Rotation angle (counterclockwise) * @param angle Rotation angle (counterclockwise)
* *
* Faster than calling @cpp Matrix4::rotation(angle, Vector3::zAxis()) @ce. @f[ * Faster than calling @cpp Matrix4::rotation(angle, Vector3::zAxis()) @ce. @f[
@ -188,9 +188,9 @@ template<class T> class Matrix4: public Matrix4x4<T> {
static Matrix4<T> reflection(const Vector3<T>& normal); static Matrix4<T> reflection(const Vector3<T>& normal);
/** /**
* @brief 3D shearing matrix along XY plane * @brief 3D shearing matrix along the XY plane
* @param amountX Amount of shearing along X axis * @param amountX Amount of shearing along the X axis
* @param amountY Amount of shearing along Y axis * @param amountY Amount of shearing along the Y axis
* *
* Z axis remains unchanged. @f[ * Z axis remains unchanged. @f[
* \boldsymbol{A} = \begin{pmatrix} * \boldsymbol{A} = \begin{pmatrix}
@ -211,9 +211,9 @@ template<class T> class Matrix4: public Matrix4x4<T> {
} }
/** /**
* @brief 3D shearing matrix along XZ plane * @brief 3D shearing matrix along the XZ plane
* @param amountX Amount of shearing along X axis * @param amountX Amount of shearing along the X axis
* @param amountZ Amount of shearing along Z axis * @param amountZ Amount of shearing along the Z axis
* *
* Y axis remains unchanged. @f[ * Y axis remains unchanged. @f[
* \boldsymbol{A} = \begin{pmatrix} * \boldsymbol{A} = \begin{pmatrix}
@ -234,9 +234,9 @@ template<class T> class Matrix4: public Matrix4x4<T> {
} }
/** /**
* @brief 3D shearing matrix along YZ plane * @brief 3D shearing matrix along the YZ plane
* @param amountY Amount of shearing along Y axis * @param amountY Amount of shearing along the Y axis
* @param amountZ Amount of shearing along Z axis * @param amountZ Amount of shearing along the Z axis
* *
* X axis remains unchanged. @f[ * X axis remains unchanged. @f[
* \boldsymbol{A} = \begin{pmatrix} * \boldsymbol{A} = \begin{pmatrix}
@ -365,7 +365,7 @@ template<class T> class Matrix4: public Matrix4x4<T> {
static Matrix4<T> lookAt(const Vector3<T>& eye, const Vector3<T>& target, const Vector3<T>& up); static Matrix4<T> lookAt(const Vector3<T>& eye, const Vector3<T>& target, const Vector3<T>& 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 * @param rotationScaling Rotation/scaling part (upper-left 3x3
* matrix) * matrix)
* @param translation Translation part (first three elements of * @param translation Translation part (first three elements of
@ -388,10 +388,9 @@ template<class T> class Matrix4: public Matrix4x4<T> {
constexpr /*implicit*/ Matrix4() noexcept: Matrix4x4<T>{IdentityInit, T(1)} {} constexpr /*implicit*/ Matrix4() noexcept: Matrix4x4<T>{IdentityInit, T(1)} {}
/** /**
* @brief Identity constructor * @brief Construct an identity matrix
* *
* Creates an identity matrix. @p value allows you to specify value on * The @p value allows you to specify value on diagonal.
* diagonal.
*/ */
constexpr explicit Matrix4(IdentityInitT, T value = T{1}) noexcept: Matrix4x4<T>{IdentityInit, value} {} constexpr explicit Matrix4(IdentityInitT, T value = T{1}) noexcept: Matrix4x4<T>{IdentityInit, value} {}
@ -401,20 +400,20 @@ template<class T> class Matrix4: public Matrix4x4<T> {
/** @copydoc Matrix::Matrix(NoInitT) */ /** @copydoc Matrix::Matrix(NoInitT) */
constexpr explicit Matrix4(NoInitT) noexcept: Matrix4x4<T>{NoInit} {} constexpr explicit Matrix4(NoInitT) noexcept: Matrix4x4<T>{NoInit} {}
/** @brief Construct matrix from column vectors */ /** @brief Construct from column vectors */
constexpr /*implicit*/ Matrix4(const Vector4<T>& first, const Vector4<T>& second, const Vector4<T>& third, const Vector4<T>& fourth) noexcept: Matrix4x4<T>(first, second, third, fourth) {} constexpr /*implicit*/ Matrix4(const Vector4<T>& first, const Vector4<T>& second, const Vector4<T>& third, const Vector4<T>& fourth) noexcept: Matrix4x4<T>(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<T>{value} {} constexpr explicit Matrix4(T value) noexcept: Matrix4x4<T>{value} {}
/** @copydoc Matrix::Matrix(const RectangularMatrix<size, size, U>&) */ /** @copydoc Matrix::Matrix(const RectangularMatrix<size, size, U>&) */
template<class U> constexpr explicit Matrix4(const RectangularMatrix<4, 4, U>& other) noexcept: Matrix4x4<T>(other) {} template<class U> constexpr explicit Matrix4(const RectangularMatrix<4, 4, U>& other) noexcept: Matrix4x4<T>(other) {}
/** @brief Construct matrix from external representation */ /** @brief Construct from external representation */
template<class U, class V = decltype(Implementation::RectangularMatrixConverter<4, 4, T, U>::from(std::declval<U>()))> constexpr explicit Matrix4(const U& other): Matrix4x4<T>(Implementation::RectangularMatrixConverter<4, 4, T, U>::from(other)) {} template<class U, class V = decltype(Implementation::RectangularMatrixConverter<4, 4, T, U>::from(std::declval<U>()))> constexpr explicit Matrix4(const U& other): Matrix4x4<T>(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 * 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 * columns and rows from it; if the other matrix is smaller, it's
@ -426,7 +425,7 @@ template<class T> class Matrix4: public Matrix4x4<T> {
constexpr /*implicit*/ Matrix4(const RectangularMatrix<4, 4, T>& other) noexcept: Matrix4x4<T>(other) {} constexpr /*implicit*/ Matrix4(const RectangularMatrix<4, 4, T>& other) noexcept: Matrix4x4<T>(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. * Rigid transformation consists only of rotation and translation (i.e.
* no scaling or projection). * no scaling or projection).
@ -467,7 +466,7 @@ template<class T> class Matrix4: public Matrix4x4<T> {
} }
/** /**
* @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 * Normalized upper-left 3x3 part of the matrix. Assuming the following
* matrix, with the upper-left 3x3 part represented by column vectors * matrix, with the upper-left 3x3 part represented by column vectors
@ -634,7 +633,7 @@ template<class T> class Matrix4: public Matrix4x4<T> {
} }
/** /**
* @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 * Length of vectors in upper-left 3x3 part of the matrix. Use the
* faster alternative @ref scalingSquared() where possible. Assuming * faster alternative @ref scalingSquared() where possible. Assuming
@ -838,7 +837,7 @@ template<class T> class Matrix4: public Matrix4x4<T> {
Matrix4<T> invertedRigid() const; Matrix4<T> 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 * Unlike in @ref transformVector(), translation is not involved in the
* transformation. @f[ * transformation. @f[
@ -853,7 +852,7 @@ template<class T> class Matrix4: public Matrix4x4<T> {
} }
/** /**
* @brief Transform 3D point with the matrix * @brief Transform a 3D point with the matrix
* *
* Unlike in @ref transformVector(), translation is also involved in * Unlike in @ref transformVector(), translation is also involved in
* the transformation. @f[ * the transformation. @f[

62
src/Magnum/Math/Quaternion.h

@ -259,7 +259,7 @@ template<class T> class Quaternion {
static Quaternion<T> rotation(Rad<T> angle, const Vector3<T>& normalizedAxis); static Quaternion<T> rotation(Rad<T> angle, const Vector3<T>& 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). * Expects that the matrix is orthogonal (i.e. pure rotation).
* @see @ref toMatrix(), @ref DualComplex::fromMatrix(), * @see @ref toMatrix(), @ref DualComplex::fromMatrix(),
@ -275,7 +275,7 @@ template<class T> class Quaternion {
constexpr /*implicit*/ Quaternion() noexcept: _scalar{T(1)} {} constexpr /*implicit*/ Quaternion() noexcept: _scalar{T(1)} {}
/** /**
* @brief Identity constructor * @brief Construct an identity quaternion
* *
* Creates unit quaternion. @f[ * Creates unit quaternion. @f[
* q = [\boldsymbol 0, 1] * q = [\boldsymbol 0, 1]
@ -283,14 +283,14 @@ template<class T> class Quaternion {
*/ */
constexpr explicit Quaternion(IdentityInitT) noexcept: _scalar{T(1)} {} 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}} {} constexpr explicit Quaternion(ZeroInitT) noexcept: _vector{ZeroInit}, _scalar{T{0}} {}
/** @brief Construct without initializing the contents */ /** @brief Construct without initializing the contents */
explicit Quaternion(NoInitT) noexcept: _vector{NoInit} {} explicit Quaternion(NoInitT) noexcept: _vector{NoInit} {}
/** /**
* @brief Construct quaternion from vector and scalar * @brief Construct from a vector and a scalar
* *
* @f[ * @f[
* q = [\boldsymbol v, s] * q = [\boldsymbol v, s]
@ -299,7 +299,7 @@ template<class T> class Quaternion {
constexpr /*implicit*/ Quaternion(const Vector3<T>& vector, T scalar) noexcept: _vector(vector), _scalar(scalar) {} constexpr /*implicit*/ Quaternion(const Vector3<T>& 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[ * To be used in transformations later. @f[
* q = [\boldsymbol v, 0] * q = [\boldsymbol v, 0]
@ -309,7 +309,7 @@ template<class T> class Quaternion {
constexpr explicit Quaternion(const Vector3<T>& vector) noexcept: _vector(vector), _scalar(T(0)) {} constexpr explicit Quaternion(const Vector3<T>& 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 * Performs only default casting on the values, no rounding or anything
* else. * else.
@ -369,7 +369,7 @@ template<class T> class Quaternion {
constexpr T scalar() const { return _scalar; } /**< @overload */ 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[ * Expects that the quaternion is normalized. @f[
* \theta = 2 \cdot \arccos(q_S) * \theta = 2 \cdot \arccos(q_S)
@ -379,7 +379,7 @@ template<class T> class Quaternion {
Rad<T> angle() const; Rad<T> 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 * Expects that the quaternion is normalized. Returns either unit-length
* vector for valid rotation quaternion or NaN vector for * vector for valid rotation quaternion or NaN vector for
@ -391,7 +391,7 @@ template<class T> class Quaternion {
Vector3<T> axis() const; Vector3<T> axis() const;
/** /**
* @brief Convert quaternion to rotation matrix * @brief Convert to a rotation matrix
* *
* @see @ref fromMatrix(), @ref DualQuaternion::toMatrix(), * @see @ref fromMatrix(), @ref DualQuaternion::toMatrix(),
* @ref Matrix4::from(const Matrix3x3<T>&, const Vector3<T>&) * @ref Matrix4::from(const Matrix3x3<T>&, const Vector3<T>&)
@ -399,7 +399,16 @@ template<class T> class Quaternion {
Matrix3x3<T> toMatrix() const; Matrix3x3<T> toMatrix() const;
/** /**
* @brief Add and assign quaternion * @brief Negated quaternion
*
* @f[
* -q = [-\boldsymbol q_V, -q_S]
* @f]
*/
Quaternion<T> operator-() const { return {-_vector, -_scalar}; }
/**
* @brief Add and assign a quaternion
* *
* The computation is done in-place. @f[ * The computation is done in-place. @f[
* p + q = [\boldsymbol p_V + \boldsymbol q_V, p_S + q_S] * p + q = [\boldsymbol p_V + \boldsymbol q_V, p_S + q_S]
@ -412,7 +421,7 @@ template<class T> class Quaternion {
} }
/** /**
* @brief Add quaternion * @brief Add a quaternion
* *
* @see @ref operator+=() * @see @ref operator+=()
*/ */
@ -421,16 +430,7 @@ template<class T> class Quaternion {
} }
/** /**
* @brief Negated quaternion * @brief Subtract and assign a quaternion
*
* @f[
* -q = [-\boldsymbol q_V, -q_S]
* @f]
*/
Quaternion<T> operator-() const { return {-_vector, -_scalar}; }
/**
* @brief Subtract and assign quaternion
* *
* The computation is done in-place. @f[ * The computation is done in-place. @f[
* p - q = [\boldsymbol p_V - \boldsymbol q_V, p_S - q_S] * p - q = [\boldsymbol p_V - \boldsymbol q_V, p_S - q_S]
@ -443,7 +443,7 @@ template<class T> class Quaternion {
} }
/** /**
* @brief Subtract quaternion * @brief Subtract a quaternion
* *
* @see @ref operator-=() * @see @ref operator-=()
*/ */
@ -452,7 +452,7 @@ template<class T> class Quaternion {
} }
/** /**
* @brief Multiply with scalar and assign * @brief Multiply with a scalar and assign
* *
* The computation is done in-place. @f[ * The computation is done in-place. @f[
* q \cdot a = [\boldsymbol q_V \cdot a, q_S \cdot a] * q \cdot a = [\boldsymbol q_V \cdot a, q_S \cdot a]
@ -465,7 +465,7 @@ template<class T> class Quaternion {
} }
/** /**
* @brief Multiply with scalar * @brief Multiply with a scalar
* *
* @see @ref operator*=(T) * @see @ref operator*=(T)
*/ */
@ -474,7 +474,7 @@ template<class T> class Quaternion {
} }
/** /**
* @brief Divide with scalar and assign * @brief Divide with a scalar and assign
* *
* The computation is done in-place. @f[ * The computation is done in-place. @f[
* \frac q a = [\frac {\boldsymbol q_V} a, \frac {q_S} a] * \frac q a = [\frac {\boldsymbol q_V} a, \frac {q_S} a]
@ -487,7 +487,7 @@ template<class T> class Quaternion {
} }
/** /**
* @brief Divide with scalar * @brief Divide with a scalar
* *
* @see @ref operator/=(T) * @see @ref operator/=(T)
*/ */
@ -496,7 +496,7 @@ template<class T> class Quaternion {
} }
/** /**
* @brief Multiply with quaternion * @brief Multiply with a quaternion
* *
* @f[ * @f[
* p q = [p_S \boldsymbol q_V + q_S \boldsymbol p_V + \boldsymbol p_V \times \boldsymbol q_V, * 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 T> class Quaternion {
Quaternion<T> invertedNormalized() const; Quaternion<T> invertedNormalized() const;
/** /**
* @brief Rotate vector with quaternion * @brief Rotate a vector with a quaternion
* *
* See @ref transformVectorNormalized(), which is faster for normalized * See @ref transformVectorNormalized(), which is faster for normalized
* quaternions. @f[ * quaternions. @f[
@ -583,7 +583,7 @@ template<class T> class Quaternion {
} }
/** /**
* @brief Rotate vector with normalized quaternion * @brief Rotate a vector with a normalized quaternion
* *
* Faster alternative to @ref transformVector(), expects that the * Faster alternative to @ref transformVector(), expects that the
* quaternion is normalized. Done using the following equation: @f[ * quaternion is normalized. Done using the following equation: @f[
@ -619,7 +619,7 @@ template<class T> class Quaternion {
}; };
/** @relates Quaternion /** @relates Quaternion
@brief Multiply scalar with quaternion @brief Multiply a scalar with a quaternion
Same as @ref Quaternion::operator*(T) const. Same as @ref Quaternion::operator*(T) const.
*/ */
@ -628,7 +628,7 @@ template<class T> inline Quaternion<T> operator*(T scalar, const Quaternion<T>&
} }
/** @relates Quaternion /** @relates Quaternion
@brief Divide quaternion with number and invert @brief Divide a quaternion with a scalar and invert
@f[ @f[
\frac a q = [\frac a {\boldsymbol q_V}, \frac a {q_S}] \frac a q = [\frac a {\boldsymbol q_V}, \frac a {q_S}]

68
src/Magnum/Math/RectangularMatrix.h

@ -72,7 +72,7 @@ template<std::size_t cols, std::size_t rows, class T> class RectangularMatrix {
}; };
/** /**
* @brief Matrix from array * @brief Matrix from an array
* @return Reference to the data as if it was matrix, thus doesn't * @return Reference to the data as if it was matrix, thus doesn't
* perform any copying. * perform any copying.
* *
@ -88,7 +88,7 @@ template<std::size_t cols, std::size_t rows, class T> 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 * Rolls the vector into matrix, i.e. first `rows` elements of the
* vector will make first column of resulting matrix. * vector will make first column of resulting matrix.
@ -99,7 +99,7 @@ template<std::size_t cols, std::size_t rows, class T> class RectangularMatrix {
} }
/** /**
* @brief Construct diagonal matrix * @brief Construct a diagonal matrix
* *
* @see @ref diagonal() * @see @ref diagonal()
*/ */
@ -114,18 +114,18 @@ template<std::size_t cols, std::size_t rows, class T> class RectangularMatrix {
*/ */
constexpr /*implicit*/ RectangularMatrix() noexcept: RectangularMatrix<cols, rows, T>{typename Implementation::GenerateSequence<cols>::Type{}, ZeroInit} {} constexpr /*implicit*/ RectangularMatrix() noexcept: RectangularMatrix<cols, rows, T>{typename Implementation::GenerateSequence<cols>::Type{}, ZeroInit} {}
/** @brief Construct zero-filled matrix */ /** @brief Construct a zero-filled matrix */
constexpr explicit RectangularMatrix(ZeroInitT) noexcept: RectangularMatrix<cols, rows, T>{typename Implementation::GenerateSequence<cols>::Type{}, ZeroInit} {} constexpr explicit RectangularMatrix(ZeroInitT) noexcept: RectangularMatrix<cols, rows, T>{typename Implementation::GenerateSequence<cols>::Type{}, ZeroInit} {}
/** @brief Construct matrix without initializing the contents */ /** @brief Construct without initializing the contents */
explicit RectangularMatrix(NoInitT) noexcept: RectangularMatrix<cols, rows, T>{typename Implementation::GenerateSequence<cols>::Type{}, NoInit} {} explicit RectangularMatrix(NoInitT) noexcept: RectangularMatrix<cols, rows, T>{typename Implementation::GenerateSequence<cols>::Type{}, NoInit} {}
/** @brief Construct matrix from column vectors */ /** @brief Construct from column vectors */
template<class ...U> constexpr /*implicit*/ RectangularMatrix(const Vector<rows, T>& first, const U&... next) noexcept: _data{first, next...} { template<class ...U> constexpr /*implicit*/ RectangularMatrix(const Vector<rows, T>& first, const U&... next) noexcept: _data{first, next...} {
static_assert(sizeof...(next)+1 == cols, "Improper number of arguments passed to RectangularMatrix constructor"); 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<cols>::Type(), value} {} constexpr explicit RectangularMatrix(T value) noexcept: RectangularMatrix{typename Implementation::GenerateSequence<cols>::Type(), value} {}
/** /**
@ -160,7 +160,7 @@ template<std::size_t cols, std::size_t rows, class T> class RectangularMatrix {
constexpr const T* data() const { return _data[0].data(); } /**< @overload */ 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[](), * Particular elements can be accessed using @ref Vector::operator[](),
* e.g.: * e.g.:
@ -174,7 +174,7 @@ template<std::size_t cols, std::size_t rows, class T> class RectangularMatrix {
constexpr const Vector<rows, T>& operator[](std::size_t col) const { return _data[col]; } /**< @overload */ constexpr const Vector<rows, T>& 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 * Consider using @ref transposed() when accessing rows frequently, as
* this is slower than accessing columns due to the way the matrix is * this is slower than accessing columns due to the way the matrix is
@ -257,7 +257,7 @@ template<std::size_t cols, std::size_t rows, class T> class RectangularMatrix {
RectangularMatrix<cols, rows, T> operator-() const; RectangularMatrix<cols, rows, T> operator-() const;
/** /**
* @brief Add and assign matrix * @brief Add and assign a matrix
* *
* The computation is done column-wise in-place. @f[ * The computation is done column-wise in-place. @f[
* \boldsymbol A_j = \boldsymbol A_j + \boldsymbol B_j * \boldsymbol A_j = \boldsymbol A_j + \boldsymbol B_j
@ -271,7 +271,7 @@ template<std::size_t cols, std::size_t rows, class T> class RectangularMatrix {
} }
/** /**
* @brief Add matrix * @brief Add a matrix
* *
* @see @ref operator+=() * @see @ref operator+=()
*/ */
@ -280,7 +280,7 @@ template<std::size_t cols, std::size_t rows, class T> class RectangularMatrix {
} }
/** /**
* @brief Subtract and assign matrix * @brief Subtract and assign a matrix
* *
* The computation is done column-wise in-place. @f[ * The computation is done column-wise in-place. @f[
* \boldsymbol A_j = \boldsymbol A_j - \boldsymbol B_j * \boldsymbol A_j = \boldsymbol A_j - \boldsymbol B_j
@ -294,7 +294,7 @@ template<std::size_t cols, std::size_t rows, class T> class RectangularMatrix {
} }
/** /**
* @brief Subtract matrix * @brief Subtract a matrix
* *
* @see @ref operator-=() * @see @ref operator-=()
*/ */
@ -303,54 +303,54 @@ template<std::size_t cols, std::size_t rows, class T> 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[ * The computation is done column-wise in-place. @f[
* \boldsymbol A_j = a \boldsymbol A_j * \boldsymbol A_j = a \boldsymbol A_j
* @f] * @f]
*/ */
RectangularMatrix<cols, rows, T>& operator*=(T number) { RectangularMatrix<cols, rows, T>& operator*=(T scalar) {
for(std::size_t i = 0; i != cols; ++i) for(std::size_t i = 0; i != cols; ++i)
_data[i] *= number; _data[i] *= scalar;
return *this; return *this;
} }
/** /**
* @brief Multiply matrix with number * @brief Multiply with a scalar
* *
* @see @ref operator*=(T), @ref operator*(T, const RectangularMatrix<cols, rows, T>&) * @see @ref operator*=(T), @ref operator*(T, const RectangularMatrix<cols, rows, T>&)
*/ */
RectangularMatrix<cols, rows, T> operator*(T number) const { RectangularMatrix<cols, rows, T> operator*(T scalar) const {
return RectangularMatrix<cols, rows, T>(*this) *= number; return RectangularMatrix<cols, rows, T>(*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[ * The computation is done column-wise in-place. @f[
* \boldsymbol A_j = \frac{\boldsymbol A_j} a * \boldsymbol A_j = \frac{\boldsymbol A_j} a
* @f] * @f]
*/ */
RectangularMatrix<cols, rows, T>& operator/=(T number) { RectangularMatrix<cols, rows, T>& operator/=(T scalar) {
for(std::size_t i = 0; i != cols; ++i) for(std::size_t i = 0; i != cols; ++i)
_data[i] /= number; _data[i] /= scalar;
return *this; return *this;
} }
/** /**
* @brief Divide matrix with number * @brief Divide with a scalar
* *
* @see @ref operator/=(T), * @see @ref operator/=(T),
* @ref operator/(T, const RectangularMatrix<cols, rows, T>&) * @ref operator/(T, const RectangularMatrix<cols, rows, T>&)
*/ */
RectangularMatrix<cols, rows, T> operator/(T number) const { RectangularMatrix<cols, rows, T> operator/(T scalar) const {
return RectangularMatrix<cols, rows, T>(*this) /= number; return RectangularMatrix<cols, rows, T>(*this) /= scalar;
} }
/** /**
* @brief Multiply matrix * @brief Multiply a matrix
* *
* @f[ * @f[
* (\boldsymbol {AB})_{ji} = \sum_{k=0}^{m-1} \boldsymbol A_{ki} \boldsymbol B_{jk} * (\boldsymbol {AB})_{ji} = \sum_{k=0}^{m-1} \boldsymbol A_{ki} \boldsymbol B_{jk}
@ -360,7 +360,7 @@ template<std::size_t cols, std::size_t rows, class T> class RectangularMatrix {
template<std::size_t size> RectangularMatrix<size, rows, T> operator*(const RectangularMatrix<size, cols, T>& other) const; template<std::size_t size> RectangularMatrix<size, rows, T> operator*(const RectangularMatrix<size, cols, T>& other) const;
/** /**
* @brief Multiply vector * @brief Multiply a vector
* *
* Internally the same as multiplying with one-column matrix, but * Internally the same as multiplying with one-column matrix, but
* returns vector. @f[ * returns vector. @f[
@ -527,7 +527,7 @@ template<class T> using Matrix4x3 = RectangularMatrix<4, 3, T>;
#endif #endif
/** @relates RectangularMatrix /** @relates RectangularMatrix
@brief Multiply number with matrix @brief Multiply a scalar with a matrix
Same as @ref RectangularMatrix::operator*(T) const. Same as @ref RectangularMatrix::operator*(T) const.
*/ */
@ -537,13 +537,13 @@ template<std::size_t cols, std::size_t rows, class T> inline RectangularMatrix<c
#else #else
typename std::common_type<T>::type typename std::common_type<T>::type
#endif #endif
number, const RectangularMatrix<cols, rows, T>& matrix) scalar, const RectangularMatrix<cols, rows, T>& matrix)
{ {
return matrix*number; return matrix*scalar;
} }
/** @relates RectangularMatrix /** @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[ The computation is done column-wise. @f[
\boldsymbol B_j = \frac a {\boldsymbol A_j} \boldsymbol B_j = \frac a {\boldsymbol A_j}
@ -556,18 +556,18 @@ template<std::size_t cols, std::size_t rows, class T> inline RectangularMatrix<c
#else #else
typename std::common_type<T>::type typename std::common_type<T>::type
#endif #endif
number, const RectangularMatrix<cols, rows, T>& matrix) scalar, const RectangularMatrix<cols, rows, T>& matrix)
{ {
RectangularMatrix<cols, rows, T> out{NoInit}; RectangularMatrix<cols, rows, T> out{NoInit};
for(std::size_t i = 0; i != cols; ++i) for(std::size_t i = 0; i != cols; ++i)
out[i] = number/matrix[i]; out[i] = scalar/matrix[i];
return out; return out;
} }
/** @relates RectangularMatrix /** @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[ Internally the same as multiplying one-column matrix with one-row matrix. @f[
(\boldsymbol {aA})_{ji} = \boldsymbol a_i \boldsymbol A_j (\boldsymbol {aA})_{ji} = \boldsymbol a_i \boldsymbol A_j

20
src/Magnum/Math/Unit.h

@ -53,13 +53,13 @@ template<template<class> class Derived, class T> class Unit {
*/ */
constexpr /*implicit*/ Unit() noexcept: _value(T(0)) {} constexpr /*implicit*/ Unit() noexcept: _value(T(0)) {}
/** @brief Construct zero value */ /** @brief Construct a zero value */
constexpr explicit Unit(ZeroInitT) noexcept: _value(T(0)) {} constexpr explicit Unit(ZeroInitT) noexcept: _value(T(0)) {}
/** @brief Construct without initializing the contents */ /** @brief Construct without initializing the contents */
explicit Unit(NoInitT) noexcept {} 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) {} constexpr explicit Unit(T value) noexcept: _value(value) {}
/** @brief Construct from another underlying type */ /** @brief Construct from another underlying type */
@ -106,46 +106,46 @@ template<template<class> class Derived, class T> class Unit {
return Unit<Derived, T>(-_value); return Unit<Derived, T>(-_value);
} }
/** @brief Add and assign value */ /** @brief Add and assign a value */
Unit<Derived, T>& operator+=(Unit<Derived, T> other) { Unit<Derived, T>& operator+=(Unit<Derived, T> other) {
_value += other._value; _value += other._value;
return *this; return *this;
} }
/** @brief Add value */ /** @brief Add a value */
constexpr Unit<Derived, T> operator+(Unit<Derived, T> other) const { constexpr Unit<Derived, T> operator+(Unit<Derived, T> other) const {
return Unit<Derived, T>(_value + other._value); return Unit<Derived, T>(_value + other._value);
} }
/** @brief Subtract and assign value */ /** @brief Subtract and assign a value */
Unit<Derived, T>& operator-=(Unit<Derived, T> other) { Unit<Derived, T>& operator-=(Unit<Derived, T> other) {
_value -= other._value; _value -= other._value;
return *this; return *this;
} }
/** @brief Subtract value */ /** @brief Subtract a value */
constexpr Unit<Derived, T> operator-(Unit<Derived, T> other) const { constexpr Unit<Derived, T> operator-(Unit<Derived, T> other) const {
return Unit<Derived, T>(_value - other._value); return Unit<Derived, T>(_value - other._value);
} }
/** @brief Multiply with number and assign */ /** @brief Multiply with a number and assign */
Unit<Derived, T>& operator*=(T number) { Unit<Derived, T>& operator*=(T number) {
_value *= number; _value *= number;
return *this; return *this;
} }
/** @brief Multiply with number */ /** @brief Multiply with a number */
constexpr Unit<Derived, T> operator*(T number) const { constexpr Unit<Derived, T> operator*(T number) const {
return Unit<Derived, T>(_value*number); return Unit<Derived, T>(_value*number);
} }
/** @brief Divide with number and assign */ /** @brief Divide with a number and assign */
Unit<Derived, T>& operator/=(T number) { Unit<Derived, T>& operator/=(T number) {
_value /= number; _value /= number;
return *this; return *this;
} }
/** @brief Divide with number */ /** @brief Divide with a number */
constexpr Unit<Derived, T> operator/(T number) const { constexpr Unit<Derived, T> operator/(T number) const {
return Unit<Derived, T>(_value/number); return Unit<Derived, T>(_value/number);
} }

132
src/Magnum/Math/Vector.h

@ -136,7 +136,7 @@ template<std::size_t size, class T> class Vector {
}; };
/** /**
* @brief Vector from array * @brief Vector from an array
* @return Reference to the data as if it was Vector, thus doesn't * @return Reference to the data as if it was Vector, thus doesn't
* perform any copying. * perform any copying.
* *
@ -178,17 +178,17 @@ template<std::size_t size, class T> class Vector {
*/ */
constexpr explicit Vector(ZeroInitT) noexcept: _data{} {} 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 {} explicit Vector(NoInitT) noexcept {}
/** @brief Construct vector from components */ /** @brief Construct a vector from components */
#ifdef DOXYGEN_GENERATING_OUTPUT #ifdef DOXYGEN_GENERATING_OUTPUT
template<class ...U> constexpr /*implicit*/ Vector(T first, U... next) noexcept; template<class ...U> constexpr /*implicit*/ Vector(T first, U... next) noexcept;
#else #else
template<class ...U, class V = typename std::enable_if<sizeof...(U)+1 == size, T>::type> constexpr /*implicit*/ Vector(T first, U... next) noexcept: _data{first, next...} {} template<class ...U, class V = typename std::enable_if<sizeof...(U)+1 == size, T>::type> constexpr /*implicit*/ Vector(T first, U... next) noexcept: _data{first, next...} {}
#endif #endif
/** @brief Construct vector with one value for all components */ /** @brief Construct a vector with one value for all components */
#ifdef DOXYGEN_GENERATING_OUTPUT #ifdef DOXYGEN_GENERATING_OUTPUT
constexpr explicit Vector(T value) noexcept; constexpr explicit Vector(T value) noexcept;
#else #else
@ -196,7 +196,7 @@ template<std::size_t size, class T> class Vector {
#endif #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 * Performs only default casting on the values, no rounding or
* anything else. Example usage: * anything else. Example usage:
@ -205,13 +205,13 @@ template<std::size_t size, class T> class Vector {
*/ */
template<class U> constexpr explicit Vector(const Vector<size, U>& other) noexcept: Vector(typename Implementation::GenerateSequence<size>::Type(), other) {} template<class U> constexpr explicit Vector(const Vector<size, U>& other) noexcept: Vector(typename Implementation::GenerateSequence<size>::Type(), other) {}
/** @brief Construct vector from external representation */ /** @brief Construct a vector from external representation */
template<class U, class V = decltype(Implementation::VectorConverter<size, T, U>::from(std::declval<U>()))> constexpr explicit Vector(const U& other) noexcept: Vector(Implementation::VectorConverter<size, T, U>::from(other)) {} template<class U, class V = decltype(Implementation::VectorConverter<size, T, U>::from(std::declval<U>()))> constexpr explicit Vector(const U& other) noexcept: Vector(Implementation::VectorConverter<size, T, U>::from(other)) {}
/** @brief Copy constructor */ /** @brief Copy constructor */
constexpr /*implicit*/ Vector(const Vector<size, T>&) noexcept = default; constexpr /*implicit*/ Vector(const Vector<size, T>&) noexcept = default;
/** @brief Convert vector to external representation */ /** @brief Convert a vector to external representation */
template<class U, class V = decltype(Implementation::VectorConverter<size, T, U>::to(std::declval<Vector<size, T>>()))> constexpr explicit operator U() const { template<class U, class V = decltype(Implementation::VectorConverter<size, T, U>::to(std::declval<Vector<size, T>>()))> constexpr explicit operator U() const {
return Implementation::VectorConverter<size, T, U>::to(*this); return Implementation::VectorConverter<size, T, U>::to(*this);
} }
@ -247,28 +247,28 @@ template<std::size_t size, class T> class Vector {
} }
/** /**
* @brief Component-wise less than * @brief Component-wise less than comparison
* *
* @m_keyword{lessThan(),GLSL lessThan(),} * @m_keyword{lessThan(),GLSL lessThan(),}
*/ */
BoolVector<size> operator<(const Vector<size, T>& other) const; BoolVector<size> operator<(const Vector<size, T>& other) const;
/** /**
* @brief Component-wise less than or equal * @brief Component-wise less than or equal comparison
* *
* @m_keyword{lessThanEqual(),GLSL lessThanEqual(),} * @m_keyword{lessThanEqual(),GLSL lessThanEqual(),}
*/ */
BoolVector<size> operator<=(const Vector<size, T>& other) const; BoolVector<size> operator<=(const Vector<size, T>& other) const;
/** /**
* @brief Component-wise greater than or equal * @brief Component-wise greater than or equal comparison
* *
* @m_keyword{greaterThanEqual(),GLSL greaterThanEqual(),} * @m_keyword{greaterThanEqual(),GLSL greaterThanEqual(),}
*/ */
BoolVector<size> operator>=(const Vector<size, T>& other) const; BoolVector<size> operator>=(const Vector<size, T>& other) const;
/** /**
* @brief Component-wise greater than * @brief Component-wise greater than comparison
* *
* @m_keyword{greaterThan(),GLSL greaterThan(),} * @m_keyword{greaterThan(),GLSL greaterThan(),}
*/ */
@ -309,7 +309,7 @@ template<std::size_t size, class T> class Vector {
Vector<size, T> operator-() const; Vector<size, T> operator-() const;
/** /**
* @brief Add and assign vector * @brief Add and assign a vector
* *
* The computation is done in-place. @f[ * The computation is done in-place. @f[
* \boldsymbol a_i = \boldsymbol a_i + \boldsymbol b_i * \boldsymbol a_i = \boldsymbol a_i + \boldsymbol b_i
@ -323,7 +323,7 @@ template<std::size_t size, class T> class Vector {
} }
/** /**
* @brief Add vector * @brief Add a vector
* *
* @see @ref operator+=(), @ref sum() * @see @ref operator+=(), @ref sum()
*/ */
@ -332,7 +332,7 @@ template<std::size_t size, class T> class Vector {
} }
/** /**
* @brief Subtract and assign vector * @brief Subtract and assign a vector
* *
* The computation is done in-place. @f[ * The computation is done in-place. @f[
* \boldsymbol a_i = \boldsymbol a_i - \boldsymbol b_i * \boldsymbol a_i = \boldsymbol a_i - \boldsymbol b_i
@ -346,7 +346,7 @@ template<std::size_t size, class T> class Vector {
} }
/** /**
* @brief Subtract vector * @brief Subtract a vector
* *
* @see @ref operator-=() * @see @ref operator-=()
*/ */
@ -355,7 +355,7 @@ template<std::size_t size, class T> class Vector {
} }
/** /**
* @brief Multiply vector with number and assign * @brief Multiply with a scalar and assign
* *
* The computation is done in-place. @f[ * The computation is done in-place. @f[
* \boldsymbol a_i = b \boldsymbol a_i * \boldsymbol a_i = b \boldsymbol a_i
@ -363,26 +363,26 @@ template<std::size_t size, class T> class Vector {
* @see @ref operator*=(const Vector<size, T>&), * @see @ref operator*=(const Vector<size, T>&),
* @ref operator*=(Vector<size, Integral>&, FloatingPoint) * @ref operator*=(Vector<size, Integral>&, FloatingPoint)
*/ */
Vector<size, T>& operator*=(T number) { Vector<size, T>& operator*=(T scalar) {
for(std::size_t i = 0; i != size; ++i) for(std::size_t i = 0; i != size; ++i)
_data[i] *= number; _data[i] *= scalar;
return *this; return *this;
} }
/** /**
* @brief Multiply vector with number * @brief Multiply with a scalar
* *
* @see @ref operator*(const Vector<size, T>&) const, * @see @ref operator*(const Vector<size, T>&) const,
* @ref operator*=(T), @ref operator*(T, const Vector<size, T>&), * @ref operator*=(T), @ref operator*(T, const Vector<size, T>&),
* @ref operator*(const Vector<size, Integral>&, FloatingPoint) * @ref operator*(const Vector<size, Integral>&, FloatingPoint)
*/ */
Vector<size, T> operator*(T number) const { Vector<size, T> operator*(T scalar) const {
return Vector<size, T>(*this) *= number; return Vector<size, T>(*this) *= scalar;
} }
/** /**
* @brief Divide vector with number and assign * @brief Divide with a scalar and assign
* *
* The computation is done in-place. @f[ * The computation is done in-place. @f[
* \boldsymbol a_i = \frac{\boldsymbol a_i} b * \boldsymbol a_i = \frac{\boldsymbol a_i} b
@ -390,26 +390,26 @@ template<std::size_t size, class T> class Vector {
* @see @ref operator/=(const Vector<size, T>&), * @see @ref operator/=(const Vector<size, T>&),
* @ref operator/=(Vector<size, Integral>&, FloatingPoint) * @ref operator/=(Vector<size, Integral>&, FloatingPoint)
*/ */
Vector<size, T>& operator/=(T number) { Vector<size, T>& operator/=(T scalar) {
for(std::size_t i = 0; i != size; ++i) for(std::size_t i = 0; i != size; ++i)
_data[i] /= number; _data[i] /= scalar;
return *this; return *this;
} }
/** /**
* @brief Divide vector with number * @brief Divide with a scalar
* *
* @see @ref operator/(const Vector<size, T>&) const, * @see @ref operator/(const Vector<size, T>&) const,
* @ref operator/=(T), @ref operator/(T, const Vector<size, T>&), * @ref operator/=(T), @ref operator/(T, const Vector<size, T>&),
* @ref operator/(const Vector<size, Integral>&, FloatingPoint) * @ref operator/(const Vector<size, Integral>&, FloatingPoint)
*/ */
Vector<size, T> operator/(T number) const { Vector<size, T> operator/(T scalar) const {
return Vector<size, T>(*this) /= number; return Vector<size, T>(*this) /= scalar;
} }
/** /**
* @brief Multiply vector component-wise and assign * @brief Multiply a vector component-wise and assign
* *
* The computation is done in-place. @f[ * The computation is done in-place. @f[
* \boldsymbol a_i = \boldsymbol a_i \boldsymbol b_i * \boldsymbol a_i = \boldsymbol a_i \boldsymbol b_i
@ -425,7 +425,7 @@ template<std::size_t size, class T> class Vector {
} }
/** /**
* @brief Multiply vector component-wise * @brief Multiply a vector component-wise
* *
* @see @ref operator*(T) const, @ref operator*=(const Vector<size, T>&), * @see @ref operator*(T) const, @ref operator*=(const Vector<size, T>&),
* @ref operator*(const Vector<size, Integral>&, const Vector<size, FloatingPoint>&), * @ref operator*(const Vector<size, Integral>&, const Vector<size, FloatingPoint>&),
@ -436,7 +436,7 @@ template<std::size_t size, class T> class Vector {
} }
/** /**
* @brief Divide vector component-wise and assign * @brief Divide a vector component-wise and assign
* *
* The computation is done in-place. @f[ * The computation is done in-place. @f[
* \boldsymbol a_i = \frac{\boldsymbol a_i}{\boldsymbol b_i} * \boldsymbol a_i = \frac{\boldsymbol a_i}{\boldsymbol b_i}
@ -452,7 +452,7 @@ template<std::size_t size, class T> class Vector {
} }
/** /**
* @brief Divide vector component-wise * @brief Divide a vector component-wise
* *
* @see @ref operator/(T) const, @ref operator/=(const Vector<size, T>&), * @see @ref operator/(T) const, @ref operator/=(const Vector<size, T>&),
* @ref operator/(const Vector<size, Integral>&, const Vector<size, FloatingPoint>&) * @ref operator/(const Vector<size, Integral>&, const Vector<size, FloatingPoint>&)
@ -537,7 +537,7 @@ template<std::size_t size, class T> class Vector {
} }
/** /**
* @brief Vector projected onto line * @brief Vector projected onto a line
* *
* Returns a vector projected onto @p line. Enabled only for * Returns a vector projected onto @p line. Enabled only for
* floating-point types. @f[ * floating-point types. @f[
@ -555,7 +555,7 @@ template<std::size_t size, class T> 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 * Slightly faster alternative to @ref projected(), expects @p line to
* be normalized. Enabled only for floating-point types. @f[ * be normalized. Enabled only for floating-point types. @f[
@ -649,7 +649,7 @@ template<std::size_t size, class T> class Vector {
}; };
/** @relates Vector /** @relates Vector
@brief Multiply number with vector @brief Multiply a scalar with a vector
Same as @ref Vector::operator*(T) const. Same as @ref Vector::operator*(T) const.
*/ */
@ -659,13 +659,13 @@ template<std::size_t size, class T> inline Vector<size, T> operator*(
#else #else
typename std::common_type<T>::type typename std::common_type<T>::type
#endif #endif
number, const Vector<size, T>& vector) scalar, const Vector<size, T>& vector)
{ {
return vector*number; return vector*scalar;
} }
/** @relates Vector /** @relates Vector
@brief Divide vector with number and invert @brief Divide a vector with a scalar and invert
@f[ @f[
\boldsymbol c_i = \frac b {\boldsymbol a_i} \boldsymbol c_i = \frac b {\boldsymbol a_i}
@ -678,18 +678,18 @@ template<std::size_t size, class T> inline Vector<size, T> operator/(
#else #else
typename std::common_type<T>::type typename std::common_type<T>::type
#endif #endif
number, const Vector<size, T>& vector) scalar, const Vector<size, T>& vector)
{ {
Vector<size, T> out; Vector<size, T> out;
for(std::size_t i = 0; i != size; ++i) for(std::size_t i = 0; i != size; ++i)
out[i] = number/vector[i]; out[i] = scalar/vector[i];
return out; return out;
} }
/** @relates Vector /** @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. The computation is done in-place.
*/ */
@ -707,7 +707,7 @@ operator%=(Vector<size, Integral>& a, Integral b) {
} }
/** @relates Vector /** @relates Vector
@brief Modulo of integral vector @brief Modulo of an integral vector
*/ */
template<std::size_t size, class Integral> inline template<std::size_t size, class Integral> inline
#ifdef DOXYGEN_GENERATING_OUTPUT #ifdef DOXYGEN_GENERATING_OUTPUT
@ -753,7 +753,7 @@ operator%(const Vector<size, Integral>& a, const Vector<size, Integral>& b) {
} }
/** @relates Vector /** @relates Vector
@brief Bitwise NOT of integral vector @brief Bitwise NOT of an integral vector
*/ */
template<std::size_t size, class Integral> inline template<std::size_t size, class Integral> inline
#ifdef DOXYGEN_GENERATING_OUTPUT #ifdef DOXYGEN_GENERATING_OUTPUT
@ -867,7 +867,7 @@ operator^(const Vector<size, Integral>& a, const Vector<size, Integral>& b) {
} }
/** @relates Vector /** @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. The computation is done in-place.
*/ */
@ -892,7 +892,7 @@ operator<<=(Vector<size, Integral>& vector,
} }
/** @relates Vector /** @relates Vector
@brief Bitwise left shift of integral vector @brief Bitwise left shift of an integral vector
*/ */
template<std::size_t size, class Integral> inline template<std::size_t size, class Integral> inline
#ifdef DOXYGEN_GENERATING_OUTPUT #ifdef DOXYGEN_GENERATING_OUTPUT
@ -913,7 +913,7 @@ operator<<(const Vector<size, Integral>& vector,
} }
/** @relates 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. The computation is done in-place.
*/ */
@ -937,7 +937,7 @@ operator>>=(Vector<size, Integral>& vector,
} }
/** @relates Vector /** @relates Vector
@brief Bitwise left shift of integral vector @brief Bitwise left shift of an integral vector
*/ */
template<std::size_t size, class Integral> inline template<std::size_t size, class Integral> inline
#ifdef DOXYGEN_GENERATING_OUTPUT #ifdef DOXYGEN_GENERATING_OUTPUT
@ -957,7 +957,7 @@ operator>>(const Vector<size, Integral>& vector,
} }
/** @relates 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 Similar to @ref Vector::operator*=(T), except that the multiplication is done
in floating-point. The computation is done in-place. in floating-point. The computation is done in-place.
@ -968,15 +968,15 @@ Vector<size, Integral>&
#else #else
typename std::enable_if<std::is_integral<Integral>::value && std::is_floating_point<FloatingPoint>::value, Vector<size, Integral>&>::type typename std::enable_if<std::is_integral<Integral>::value && std::is_floating_point<FloatingPoint>::value, Vector<size, Integral>&>::type
#endif #endif
operator*=(Vector<size, Integral>& vector, FloatingPoint number) { operator*=(Vector<size, Integral>& vector, FloatingPoint scalar) {
for(std::size_t i = 0; i != size; ++i) for(std::size_t i = 0; i != size; ++i)
vector[i] = Integral(vector[i]*number); vector[i] = Integral(vector[i]*scalar);
return vector; return vector;
} }
/** @relates 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 Similar to @ref Vector::operator*(T) const, except that the multiplication is
done in floating-point. done in floating-point.
@ -987,13 +987,13 @@ Vector<size, Integral>
#else #else
typename std::enable_if<std::is_integral<Integral>::value && std::is_floating_point<FloatingPoint>::value, Vector<size, Integral>>::type typename std::enable_if<std::is_integral<Integral>::value && std::is_floating_point<FloatingPoint>::value, Vector<size, Integral>>::type
#endif #endif
operator*(const Vector<size, Integral>& vector, FloatingPoint number) { operator*(const Vector<size, Integral>& vector, FloatingPoint scalar) {
Vector<size, Integral> copy(vector); Vector<size, Integral> copy(vector);
return copy *= number; return copy *= scalar;
} }
/** @relates Vector /** @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<size, Integral>&, FloatingPoint). Same as @ref operator*(const Vector<size, Integral>&, FloatingPoint).
*/ */
@ -1003,12 +1003,12 @@ Vector<size, Integral>
#else #else
typename std::enable_if<std::is_integral<Integral>::value && std::is_floating_point<FloatingPoint>::value, Vector<size, Integral>>::type typename std::enable_if<std::is_integral<Integral>::value && std::is_floating_point<FloatingPoint>::value, Vector<size, Integral>>::type
#endif #endif
operator*(FloatingPoint number, const Vector<size, Integral>& vector) { operator*(FloatingPoint scalar, const Vector<size, Integral>& vector) {
return vector*number; return vector*scalar;
} }
/** @relates Vector /** @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 Similar to @ref Vector::operator/=(T), except that the division is done in
floating-point. The computation is done in-place. floating-point. The computation is done in-place.
@ -1019,15 +1019,15 @@ Vector<size, Integral>&
#else #else
typename std::enable_if<std::is_integral<Integral>::value && std::is_floating_point<FloatingPoint>::value, Vector<size, Integral>&>::type typename std::enable_if<std::is_integral<Integral>::value && std::is_floating_point<FloatingPoint>::value, Vector<size, Integral>&>::type
#endif #endif
operator/=(Vector<size, Integral>& vector, FloatingPoint number) { operator/=(Vector<size, Integral>& vector, FloatingPoint scalar) {
for(std::size_t i = 0; i != size; ++i) for(std::size_t i = 0; i != size; ++i)
vector[i] = Integral(vector[i]/number); vector[i] = Integral(vector[i]/scalar);
return vector; return vector;
} }
/** @relates 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 Similar to @ref Vector::operator/(T) const, except that the division is done in
floating-point. floating-point.
@ -1038,13 +1038,13 @@ Vector<size, Integral>
#else #else
typename std::enable_if<std::is_integral<Integral>::value && std::is_floating_point<FloatingPoint>::value, Vector<size, Integral>>::type typename std::enable_if<std::is_integral<Integral>::value && std::is_floating_point<FloatingPoint>::value, Vector<size, Integral>>::type
#endif #endif
operator/(const Vector<size, Integral>& vector, FloatingPoint number) { operator/(const Vector<size, Integral>& vector, FloatingPoint scalar) {
Vector<size, Integral> copy(vector); Vector<size, Integral> copy(vector);
return copy /= number; return copy /= scalar;
} }
/** @relates Vector /** @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<size, T>&), except that the Similar to @ref Vector::operator*=(const Vector<size, T>&), except that the
multiplication is done in floating-point. The computation is done in-place. multiplication is done in floating-point. The computation is done in-place.
@ -1063,7 +1063,7 @@ operator*=(Vector<size, Integral>& a, const Vector<size, FloatingPoint>& b) {
} }
/** @relates Vector /** @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<size, T>&) const, except that Similar to @ref Vector::operator*(const Vector<size, T>&) const, except that
the multiplication is done in floating-point. The result is always integral the multiplication is done in floating-point. The result is always integral
@ -1082,7 +1082,7 @@ operator*(const Vector<size, Integral>& a, const Vector<size, FloatingPoint>& b)
} }
/** @relates Vector /** @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<size, Integral>&, const Vector<size, FloatingPoint>&). Same as @ref operator*(const Vector<size, Integral>&, const Vector<size, FloatingPoint>&).
*/ */
@ -1097,7 +1097,7 @@ operator*(const Vector<size, FloatingPoint>& a, const Vector<size, Integral>& b)
} }
/** @relates Vector /** @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<size, T>&), except that the Similar to @ref Vector::operator/=(const Vector<size, T>&), except that the
division is done in floating-point. The computation is done in-place. division is done in floating-point. The computation is done in-place.
@ -1116,7 +1116,7 @@ operator/=(Vector<size, Integral>& a, const Vector<size, FloatingPoint>& b) {
} }
/** @relates Vector /** @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<size, T>&) const, except that Similar to @ref Vector::operator/(const Vector<size, T>&) const, except that
the division is done in floating-point. The result is always integral vector, the division is done in floating-point. The result is always integral vector,

8
src/Magnum/Math/Vector2.h

@ -63,7 +63,7 @@ See @ref matrix-vector for brief introduction.
template<class T> class Vector2: public Vector<2, T> { template<class T> class Vector2: public Vector<2, T> {
public: 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: * Usable for translation in given axis, for example:
* *
@ -74,7 +74,7 @@ template<class T> class Vector2: public Vector<2, T> {
constexpr static Vector2<T> xAxis(T length = T(1)) { return {length, T(0)}; } constexpr static Vector2<T> 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 xAxis() for more information.
* @see @ref yScale(), @ref Matrix3::up() * @see @ref yScale(), @ref Matrix3::up()
@ -82,7 +82,7 @@ template<class T> class Vector2: public Vector<2, T> {
constexpr static Vector2<T> yAxis(T length = T(1)) { return {T(0), length}; } constexpr static Vector2<T> 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: * Usable for scaling along given direction, for example:
* *
@ -93,7 +93,7 @@ template<class T> class Vector2: public Vector<2, T> {
constexpr static Vector2<T> xScale(T scale) { return {scale, T(1)}; } constexpr static Vector2<T> 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 xScale() for more information.
* @see @ref yAxis() * @see @ref yAxis()

12
src/Magnum/Math/Vector3.h

@ -67,7 +67,7 @@ See @ref matrix-vector for brief introduction.
template<class T> class Vector3: public Vector<3, T> { template<class T> class Vector3: public Vector<3, T> {
public: 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: * Usable for translation or rotation along given axis, for example:
* *
@ -79,7 +79,7 @@ template<class T> class Vector3: public Vector<3, T> {
constexpr static Vector3<T> xAxis(T length = T(1)) { return {length, T(0), T(0)}; } constexpr static Vector3<T> 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 xAxis() for more information.
* @see @ref yScale(), @ref Color3::green(), @ref Matrix4::up() * @see @ref yScale(), @ref Color3::green(), @ref Matrix4::up()
@ -87,7 +87,7 @@ template<class T> class Vector3: public Vector<3, T> {
constexpr static Vector3<T> yAxis(T length = T(1)) { return {T(0), length, T(0)}; } constexpr static Vector3<T> 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 xAxis() for more information.
* @see @ref zScale(), @ref Color3::blue(), @ref Matrix4::backward() * @see @ref zScale(), @ref Color3::blue(), @ref Matrix4::backward()
@ -95,7 +95,7 @@ template<class T> class Vector3: public Vector<3, T> {
constexpr static Vector3<T> zAxis(T length = T(1)) { return {T(0), T(0), length}; } constexpr static Vector3<T> 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: * Usable for scaling along given direction, for example:
* *
@ -106,7 +106,7 @@ template<class T> class Vector3: public Vector<3, T> {
constexpr static Vector3<T> xScale(T scale) { return {scale, T(1), T(1)}; } constexpr static Vector3<T> 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 xScale() for more information.
* @see @ref yAxis(), @ref Color3::magenta() * @see @ref yAxis(), @ref Color3::magenta()
@ -114,7 +114,7 @@ template<class T> class Vector3: public Vector<3, T> {
constexpr static Vector3<T> yScale(T scale) { return {T(1), scale, T(1)}; } constexpr static Vector3<T> 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 xScale() for more information.
* @see @ref zAxis(), @ref Color3::yellow() * @see @ref zAxis(), @ref Color3::yellow()

Loading…
Cancel
Save