|
|
|
@ -26,7 +26,7 @@ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
/** @file
|
|
|
|
/** @file
|
|
|
|
* @brief Class Magnum::Math::Vector |
|
|
|
* @brief Class @ref Magnum::Math::Vector |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
#include <cmath> |
|
|
|
#include <cmath> |
|
|
|
@ -92,7 +92,9 @@ template<std::size_t size, class T> class Vector { |
|
|
|
* antiparallel. @f[ |
|
|
|
* antiparallel. @f[ |
|
|
|
* \boldsymbol a \cdot \boldsymbol b = \sum_{i=0}^{n-1} \boldsymbol a_i \boldsymbol b_i |
|
|
|
* \boldsymbol a \cdot \boldsymbol b = \sum_{i=0}^{n-1} \boldsymbol a_i \boldsymbol b_i |
|
|
|
* @f] |
|
|
|
* @f] |
|
|
|
* @see dot() const, operator-(), Vector2::perpendicular() |
|
|
|
* @see dot() const, @ref operator-(), |
|
|
|
|
|
|
|
* @ref Vector2::perpendicular() |
|
|
|
|
|
|
|
* @todoc Explicit reference when Doxygen can handle const |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
static T dot(const Vector<size, T>& a, const Vector<size, T>& b) { |
|
|
|
static T dot(const Vector<size, T>& a, const Vector<size, T>& b) { |
|
|
|
return (a*b).sum(); |
|
|
|
return (a*b).sum(); |
|
|
|
@ -104,7 +106,8 @@ template<std::size_t size, class T> class Vector { |
|
|
|
* Expects that both vectors are normalized. @f[ |
|
|
|
* Expects that both vectors are normalized. @f[ |
|
|
|
* \theta = acos \left( \frac{\boldsymbol a \cdot \boldsymbol b}{|\boldsymbol a| |\boldsymbol b|} \right) = acos (\boldsymbol a \cdot \boldsymbol b) |
|
|
|
* \theta = acos \left( \frac{\boldsymbol a \cdot \boldsymbol b}{|\boldsymbol a| |\boldsymbol b|} \right) = acos (\boldsymbol a \cdot \boldsymbol b) |
|
|
|
* @f] |
|
|
|
* @f] |
|
|
|
* @see isNormalized(), Quaternion::angle(), Complex::angle() |
|
|
|
* @see @ref isNormalized(), @ref Quaternion::angle(), |
|
|
|
|
|
|
|
* @ref Complex::angle() |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
static Rad<T> angle(const Vector<size, T>& normalizedA, const Vector<size, T>& normalizedB); |
|
|
|
static Rad<T> angle(const Vector<size, T>& normalizedA, const Vector<size, T>& normalizedB); |
|
|
|
|
|
|
|
|
|
|
|
@ -188,6 +191,7 @@ template<std::size_t size, class T> class Vector { |
|
|
|
* @return One-dimensional array of `size` length. |
|
|
|
* @return One-dimensional array of `size` length. |
|
|
|
* |
|
|
|
* |
|
|
|
* @see operator[]() |
|
|
|
* @see operator[]() |
|
|
|
|
|
|
|
* @todoc Make explicit reference when Doxygen can handle operators |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
T* data() { return _data; } |
|
|
|
T* data() { return _data; } |
|
|
|
constexpr const T* data() const { return _data; } /**< @overload */ |
|
|
|
constexpr const T* data() const { return _data; } /**< @overload */ |
|
|
|
@ -195,7 +199,7 @@ template<std::size_t size, class T> class Vector { |
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @brief Value at given position |
|
|
|
* @brief Value at given position |
|
|
|
* |
|
|
|
* |
|
|
|
* @see data() |
|
|
|
* @see @ref data() |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
T& operator[](std::size_t pos) { return _data[pos]; } |
|
|
|
T& operator[](std::size_t pos) { return _data[pos]; } |
|
|
|
constexpr T operator[](std::size_t pos) const { return _data[pos]; } /**< @overload */ |
|
|
|
constexpr T operator[](std::size_t pos) const { return _data[pos]; } /**< @overload */ |
|
|
|
@ -231,7 +235,7 @@ template<std::size_t size, class T> class Vector { |
|
|
|
* @f[ |
|
|
|
* @f[ |
|
|
|
* |\boldsymbol a \cdot \boldsymbol a - 0| < \epsilon^2 \cong \epsilon |
|
|
|
* |\boldsymbol a \cdot \boldsymbol a - 0| < \epsilon^2 \cong \epsilon |
|
|
|
* @f] |
|
|
|
* @f] |
|
|
|
* @see dot(), normalized() |
|
|
|
* @see @ref dot(), @ref normalized() |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
bool isZero() const { |
|
|
|
bool isZero() const { |
|
|
|
return Implementation::isZeroSquared(dot()); |
|
|
|
return Implementation::isZeroSquared(dot()); |
|
|
|
@ -243,7 +247,7 @@ template<std::size_t size, class T> class Vector { |
|
|
|
* The vector is normalized if it has unit length: @f[ |
|
|
|
* The vector is normalized if it has unit length: @f[ |
|
|
|
* |\boldsymbol a \cdot \boldsymbol a - 1| < 2 \epsilon + \epsilon^2 \cong 2 \epsilon |
|
|
|
* |\boldsymbol a \cdot \boldsymbol a - 1| < 2 \epsilon + \epsilon^2 \cong 2 \epsilon |
|
|
|
* @f] |
|
|
|
* @f] |
|
|
|
* @see dot(), normalized() |
|
|
|
* @see @ref dot(), @ref normalized() |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
bool isNormalized() const { |
|
|
|
bool isNormalized() const { |
|
|
|
return Implementation::isNormalizedSquared(dot()); |
|
|
|
return Implementation::isNormalizedSquared(dot()); |
|
|
|
@ -255,7 +259,7 @@ template<std::size_t size, class T> class Vector { |
|
|
|
* @f[ |
|
|
|
* @f[ |
|
|
|
* \boldsymbol b_i = -\boldsymbol a_i |
|
|
|
* \boldsymbol b_i = -\boldsymbol a_i |
|
|
|
* @f] |
|
|
|
* @f] |
|
|
|
* @see Vector2::perpendicular() |
|
|
|
* @see @ref Vector2::perpendicular() |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
Vector<size, T> operator-() const; |
|
|
|
Vector<size, T> operator-() const; |
|
|
|
|
|
|
|
|
|
|
|
@ -276,7 +280,8 @@ template<std::size_t size, class T> class Vector { |
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @brief Add vector |
|
|
|
* @brief Add vector |
|
|
|
* |
|
|
|
* |
|
|
|
* @see operator+=(), sum() |
|
|
|
* @see operator+=(), @ref sum() |
|
|
|
|
|
|
|
* @todoc Make explicit reference when Doxygen can handle operators |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
Vector<size, T> operator+(const Vector<size, T>& other) const { |
|
|
|
Vector<size, T> operator+(const Vector<size, T>& other) const { |
|
|
|
return Vector<size, T>(*this) += other; |
|
|
|
return Vector<size, T>(*this) += other; |
|
|
|
@ -299,7 +304,7 @@ template<std::size_t size, class T> class Vector { |
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @brief Subtract vector |
|
|
|
* @brief Subtract vector |
|
|
|
* |
|
|
|
* |
|
|
|
* @see operator-=() |
|
|
|
* @see @ref operator-=() |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
Vector<size, T> operator-(const Vector<size, T>& other) const { |
|
|
|
Vector<size, T> operator-(const Vector<size, T>& other) const { |
|
|
|
return Vector<size, T>(*this) -= other; |
|
|
|
return Vector<size, T>(*this) -= other; |
|
|
|
@ -313,6 +318,7 @@ template<std::size_t size, class T> class Vector { |
|
|
|
* @f] |
|
|
|
* @f] |
|
|
|
* @see operator*=(const Vector<size, T>&), |
|
|
|
* @see operator*=(const Vector<size, T>&), |
|
|
|
* operator*=(Vector<size, Integral>&, FloatingPoint) |
|
|
|
* operator*=(Vector<size, Integral>&, FloatingPoint) |
|
|
|
|
|
|
|
* @todoc Make explicit reference when Doxygen can handle operators |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
Vector<size, T>& operator*=(T number) { |
|
|
|
Vector<size, T>& operator*=(T number) { |
|
|
|
for(std::size_t i = 0; i != size; ++i) |
|
|
|
for(std::size_t i = 0; i != size; ++i) |
|
|
|
@ -327,6 +333,7 @@ template<std::size_t size, class T> class Vector { |
|
|
|
* @see operator*(const Vector<size, T>&) const, |
|
|
|
* @see operator*(const Vector<size, T>&) const, |
|
|
|
* operator*=(T), operator*(T, const Vector<size, T>&), |
|
|
|
* operator*=(T), operator*(T, const Vector<size, T>&), |
|
|
|
* operator*(const Vector<size, Integral>&, FloatingPoint) |
|
|
|
* operator*(const Vector<size, Integral>&, FloatingPoint) |
|
|
|
|
|
|
|
* @todoc Make explicit reference when Doxygen can handle operators |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
Vector<size, T> operator*(T number) const { |
|
|
|
Vector<size, T> operator*(T number) const { |
|
|
|
return Vector<size, T>(*this) *= number; |
|
|
|
return Vector<size, T>(*this) *= number; |
|
|
|
@ -340,6 +347,7 @@ template<std::size_t size, class T> class Vector { |
|
|
|
* @f] |
|
|
|
* @f] |
|
|
|
* @see operator/=(const Vector<size, T>&), |
|
|
|
* @see operator/=(const Vector<size, T>&), |
|
|
|
* operator/=(Vector<size, Integral>&, FloatingPoint) |
|
|
|
* operator/=(Vector<size, Integral>&, FloatingPoint) |
|
|
|
|
|
|
|
* @todoc Make explicit reference when Doxygen can handle operators |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
Vector<size, T>& operator/=(T number) { |
|
|
|
Vector<size, T>& operator/=(T number) { |
|
|
|
for(std::size_t i = 0; i != size; ++i) |
|
|
|
for(std::size_t i = 0; i != size; ++i) |
|
|
|
@ -354,6 +362,7 @@ template<std::size_t size, class T> class Vector { |
|
|
|
* @see operator/(const Vector<size, T>&) const, |
|
|
|
* @see operator/(const Vector<size, T>&) const, |
|
|
|
* operator/=(T), operator/(T, const Vector<size, T>&), |
|
|
|
* operator/=(T), operator/(T, const Vector<size, T>&), |
|
|
|
* operator/(const Vector<size, Integral>&, FloatingPoint) |
|
|
|
* operator/(const Vector<size, Integral>&, FloatingPoint) |
|
|
|
|
|
|
|
* @todoc Make explicit reference when Doxygen can handle operators |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
Vector<size, T> operator/(T number) const { |
|
|
|
Vector<size, T> operator/(T number) const { |
|
|
|
return Vector<size, T>(*this) /= number; |
|
|
|
return Vector<size, T>(*this) /= number; |
|
|
|
@ -367,6 +376,7 @@ template<std::size_t size, class T> class Vector { |
|
|
|
* @f] |
|
|
|
* @f] |
|
|
|
* @see operator*=(T), |
|
|
|
* @see operator*=(T), |
|
|
|
* operator*=(Vector<size, Integral>&, const Vector<size, FloatingPoint>&) |
|
|
|
* operator*=(Vector<size, Integral>&, const Vector<size, FloatingPoint>&) |
|
|
|
|
|
|
|
* @todoc Make explicit reference when Doxygen can handle operators |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
Vector<size, T>& operator*=(const Vector<size, T>& other) { |
|
|
|
Vector<size, T>& operator*=(const Vector<size, T>& other) { |
|
|
|
for(std::size_t i = 0; i != size; ++i) |
|
|
|
for(std::size_t i = 0; i != size; ++i) |
|
|
|
@ -381,6 +391,7 @@ template<std::size_t size, class T> class Vector { |
|
|
|
* @see operator*(T) const, operator*=(const Vector<size, T>&), |
|
|
|
* @see operator*(T) const, operator*=(const Vector<size, T>&), |
|
|
|
* operator*(const Vector<size, Integral>&, const Vector<size, FloatingPoint>&), |
|
|
|
* operator*(const Vector<size, Integral>&, const Vector<size, FloatingPoint>&), |
|
|
|
* @ref product() |
|
|
|
* @ref product() |
|
|
|
|
|
|
|
* @todoc Make explicit reference when Doxygen can handle operators |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
Vector<size, T> operator*(const Vector<size, T>& other) const { |
|
|
|
Vector<size, T> operator*(const Vector<size, T>& other) const { |
|
|
|
return Vector<size, T>(*this) *= other; |
|
|
|
return Vector<size, T>(*this) *= other; |
|
|
|
@ -394,6 +405,7 @@ template<std::size_t size, class T> class Vector { |
|
|
|
* @f] |
|
|
|
* @f] |
|
|
|
* @see operator/=(T), |
|
|
|
* @see operator/=(T), |
|
|
|
* operator/=(Vector<size, Integral>&, const Vector<size, FloatingPoint>&) |
|
|
|
* operator/=(Vector<size, Integral>&, const Vector<size, FloatingPoint>&) |
|
|
|
|
|
|
|
* @todoc Make explicit reference when Doxygen can handle operators |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
Vector<size, T>& operator/=(const Vector<size, T>& other) { |
|
|
|
Vector<size, T>& operator/=(const Vector<size, T>& other) { |
|
|
|
for(std::size_t i = 0; i != size; ++i) |
|
|
|
for(std::size_t i = 0; i != size; ++i) |
|
|
|
@ -407,6 +419,7 @@ template<std::size_t size, class T> class Vector { |
|
|
|
* |
|
|
|
* |
|
|
|
* @see operator/(T) const, operator/=(const Vector<size, T>&), |
|
|
|
* @see operator/(T) const, operator/=(const Vector<size, T>&), |
|
|
|
* operator/(const Vector<size, Integral>&, const Vector<size, FloatingPoint>&) |
|
|
|
* operator/(const Vector<size, Integral>&, const Vector<size, FloatingPoint>&) |
|
|
|
|
|
|
|
* @todoc Make explicit reference when Doxygen can handle operators |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
Vector<size, T> operator/(const Vector<size, T>& other) const { |
|
|
|
Vector<size, T> operator/(const Vector<size, T>& other) const { |
|
|
|
return Vector<size, T>(*this) /= other; |
|
|
|
return Vector<size, T>(*this) /= other; |
|
|
|
@ -415,22 +428,24 @@ template<std::size_t size, class T> class Vector { |
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @brief Dot product of the vector |
|
|
|
* @brief Dot product of the vector |
|
|
|
* |
|
|
|
* |
|
|
|
* Should be used instead of length() for comparing vector length with |
|
|
|
* Should be used instead of @ref length() for comparing vector length |
|
|
|
* other values, because it doesn't compute the square root. @f[ |
|
|
|
* with other values, because it doesn't compute the square root. @f[ |
|
|
|
* \boldsymbol a \cdot \boldsymbol a = \sum_{i=0}^{n-1} \boldsymbol a_i^2 |
|
|
|
* \boldsymbol a \cdot \boldsymbol a = \sum_{i=0}^{n-1} \boldsymbol a_i^2 |
|
|
|
* @f] |
|
|
|
* @f] |
|
|
|
* @see dot(const Vector<size, T>&, const Vector<size, T>&), isNormalized() |
|
|
|
* @see @ref dot(const Vector<size, T>&, const Vector<size, T>&), |
|
|
|
|
|
|
|
* @ref isNormalized() |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
T dot() const { return dot(*this, *this); } |
|
|
|
T dot() const { return dot(*this, *this); } |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @brief %Vector length |
|
|
|
* @brief %Vector length |
|
|
|
* |
|
|
|
* |
|
|
|
* See also dot() const which is faster for comparing length with other |
|
|
|
* See also @ref dot() const which is faster for comparing length with |
|
|
|
* values. @f[ |
|
|
|
* other values. @f[ |
|
|
|
* |\boldsymbol a| = \sqrt{\boldsymbol a \cdot \boldsymbol a} |
|
|
|
* |\boldsymbol a| = \sqrt{\boldsymbol a \cdot \boldsymbol a} |
|
|
|
* @f] |
|
|
|
* @f] |
|
|
|
* @see lengthInverted(), Math::sqrt(), normalized(), resized() |
|
|
|
* @see @ref lengthInverted(), @ref Math::sqrt(), @ref normalized(), |
|
|
|
|
|
|
|
* @ref resized() |
|
|
|
* @todo something like std::hypot() for possibly better precision? |
|
|
|
* @todo something like std::hypot() for possibly better precision? |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
T length() const { return std::sqrt(dot()); } |
|
|
|
T length() const { return std::sqrt(dot()); } |
|
|
|
@ -441,14 +456,15 @@ template<std::size_t size, class T> class Vector { |
|
|
|
* @f[ |
|
|
|
* @f[ |
|
|
|
* \frac{1}{|\boldsymbol a|} = \frac{1}{\sqrt{\boldsymbol a \cdot \boldsymbol a}} |
|
|
|
* \frac{1}{|\boldsymbol a|} = \frac{1}{\sqrt{\boldsymbol a \cdot \boldsymbol a}} |
|
|
|
* @f] |
|
|
|
* @f] |
|
|
|
* @see length(), Math::sqrtInverted(), normalized(), resized() |
|
|
|
* @see @ref length(), @ref Math::sqrtInverted(), @ref normalized(), |
|
|
|
|
|
|
|
* @ref resized() |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
T lengthInverted() const { return T(1)/length(); } |
|
|
|
T lengthInverted() const { return T(1)/length(); } |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @brief Normalized vector (of unit length) |
|
|
|
* @brief Normalized vector (of unit length) |
|
|
|
* |
|
|
|
* |
|
|
|
* @see isNormalized(), lengthInverted(), resized() |
|
|
|
* @see @ref isNormalized(), @ref lengthInverted(), @ref resized() |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
Vector<size, T> normalized() const { return *this*lengthInverted(); } |
|
|
|
Vector<size, T> normalized() const { return *this*lengthInverted(); } |
|
|
|
|
|
|
|
|
|
|
|
@ -456,12 +472,12 @@ template<std::size_t size, class T> class Vector { |
|
|
|
* @brief Resized vector |
|
|
|
* @brief Resized vector |
|
|
|
* |
|
|
|
* |
|
|
|
* Convenience equivalent to the following code. Due to operation order |
|
|
|
* Convenience equivalent to the following code. Due to operation order |
|
|
|
* this function is faster than the obvious way of sizing normalized() |
|
|
|
* this function is faster than the obvious way of sizing |
|
|
|
* vector. |
|
|
|
* @ref normalized() vector. |
|
|
|
* @code |
|
|
|
* @code |
|
|
|
* vec*(vec.lengthInverted()*length) // the brackets are important
|
|
|
|
* vec*(vec.lengthInverted()*length) // the brackets are important
|
|
|
|
* @endcode |
|
|
|
* @endcode |
|
|
|
* @see normalized() |
|
|
|
* @see @ref normalized() |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
Vector<size, T> resized(T length) const { |
|
|
|
Vector<size, T> resized(T length) const { |
|
|
|
return *this*(lengthInverted()*length); |
|
|
|
return *this*(lengthInverted()*length); |
|
|
|
@ -473,7 +489,7 @@ template<std::size_t size, class T> class Vector { |
|
|
|
* Returns vector projected onto @p line. @f[ |
|
|
|
* Returns vector projected onto @p line. @f[ |
|
|
|
* \boldsymbol a_1 = \frac{\boldsymbol a \cdot \boldsymbol b}{\boldsymbol b \cdot \boldsymbol b} \boldsymbol b |
|
|
|
* \boldsymbol a_1 = \frac{\boldsymbol a \cdot \boldsymbol b}{\boldsymbol b \cdot \boldsymbol b} \boldsymbol b |
|
|
|
* @f] |
|
|
|
* @f] |
|
|
|
* @see dot(), projectedOntoNormalized() |
|
|
|
* @see @ref dot(), @ref projectedOntoNormalized() |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
Vector<size, T> projected(const Vector<size, T>& line) const { |
|
|
|
Vector<size, T> projected(const Vector<size, T>& line) const { |
|
|
|
return line*dot(*this, line)/line.dot(); |
|
|
|
return line*dot(*this, line)/line.dot(); |
|
|
|
@ -482,8 +498,8 @@ template<std::size_t size, class T> class Vector { |
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @brief %Vector projected onto normalized line |
|
|
|
* @brief %Vector projected onto normalized line |
|
|
|
* |
|
|
|
* |
|
|
|
* Slightly faster alternative to projected(), expects @p line to be |
|
|
|
* Slightly faster alternative to @ref projected(), expects @p line to |
|
|
|
* normalized. @f[ |
|
|
|
* be normalized. @f[ |
|
|
|
* \boldsymbol a_1 = \frac{\boldsymbol a \cdot \boldsymbol b}{\boldsymbol b \cdot \boldsymbol b} \boldsymbol b = |
|
|
|
* \boldsymbol a_1 = \frac{\boldsymbol a \cdot \boldsymbol b}{\boldsymbol b \cdot \boldsymbol b} \boldsymbol b = |
|
|
|
* (\boldsymbol a \cdot \boldsymbol b) \boldsymbol b |
|
|
|
* (\boldsymbol a \cdot \boldsymbol b) \boldsymbol b |
|
|
|
* @f] |
|
|
|
* @f] |
|
|
|
@ -495,6 +511,7 @@ template<std::size_t size, class T> class Vector { |
|
|
|
* @brief Sum of values in the vector |
|
|
|
* @brief Sum of values in the vector |
|
|
|
* |
|
|
|
* |
|
|
|
* @see operator+() |
|
|
|
* @see operator+() |
|
|
|
|
|
|
|
* @todoc Make explicit reference when Doxygen can handle operators |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
T sum() const; |
|
|
|
T sum() const; |
|
|
|
|
|
|
|
|
|
|
|
@ -502,6 +519,7 @@ template<std::size_t size, class T> class Vector { |
|
|
|
* @brief Product of values in the vector |
|
|
|
* @brief Product of values in the vector |
|
|
|
* |
|
|
|
* |
|
|
|
* @see operator*(const Vector<size, T>&) const |
|
|
|
* @see operator*(const Vector<size, T>&) const |
|
|
|
|
|
|
|
* @todoc Make explicit reference when Doxygen can handle operators |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
T product() const; |
|
|
|
T product() const; |
|
|
|
|
|
|
|
|
|
|
|
@ -533,6 +551,7 @@ template<std::size_t size, class T> class Vector { |
|
|
|
@brief Multiply number with vector |
|
|
|
@brief Multiply number with vector |
|
|
|
|
|
|
|
|
|
|
|
Same as Vector::operator*(T) const. |
|
|
|
Same as Vector::operator*(T) const. |
|
|
|
|
|
|
|
@todoc Make explicit reference when Doxygen can handle operators |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
template<std::size_t size, class T> inline Vector<size, T> operator*( |
|
|
|
template<std::size_t size, class T> inline Vector<size, T> operator*( |
|
|
|
#ifdef DOXYGEN_GENERATING_OUTPUT |
|
|
|
#ifdef DOXYGEN_GENERATING_OUTPUT |
|
|
|
@ -552,6 +571,7 @@ template<std::size_t size, class T> inline Vector<size, T> operator*( |
|
|
|
\boldsymbol c_i = \frac b {\boldsymbol a_i} |
|
|
|
\boldsymbol c_i = \frac b {\boldsymbol a_i} |
|
|
|
@f] |
|
|
|
@f] |
|
|
|
@see Vector::operator/(T) const |
|
|
|
@see Vector::operator/(T) const |
|
|
|
|
|
|
|
@todoc Make explicit reference when Doxygen can handle operators |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
template<std::size_t size, class T> inline Vector<size, T> operator/( |
|
|
|
template<std::size_t size, class T> inline Vector<size, T> operator/( |
|
|
|
#ifdef DOXYGEN_GENERATING_OUTPUT |
|
|
|
#ifdef DOXYGEN_GENERATING_OUTPUT |
|
|
|
@ -842,6 +862,7 @@ operator>>(const Vector<size, Integral>& vector, |
|
|
|
|
|
|
|
|
|
|
|
Similar to Vector::operator*=(T), except that the multiplication is done in |
|
|
|
Similar to Vector::operator*=(T), except that the multiplication is done in |
|
|
|
floating-point. The computation is done in-place. |
|
|
|
floating-point. The computation is done in-place. |
|
|
|
|
|
|
|
@todoc Make explicit reference when Doxygen can handle operators |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
template<std::size_t size, class Integral, class FloatingPoint> inline |
|
|
|
template<std::size_t size, class Integral, class FloatingPoint> inline |
|
|
|
#ifdef DOXYGEN_GENERATING_OUTPUT |
|
|
|
#ifdef DOXYGEN_GENERATING_OUTPUT |
|
|
|
@ -861,6 +882,7 @@ operator*=(Vector<size, Integral>& vector, FloatingPoint number) { |
|
|
|
|
|
|
|
|
|
|
|
Similar to Vector::operator*(T) const, except that the multiplication is done |
|
|
|
Similar to Vector::operator*(T) const, except that the multiplication is done |
|
|
|
in floating-point. |
|
|
|
in floating-point. |
|
|
|
|
|
|
|
@todoc Make explicit reference when Doxygen can handle operators |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
template<std::size_t size, class Integral, class FloatingPoint> inline |
|
|
|
template<std::size_t size, class Integral, class FloatingPoint> inline |
|
|
|
#ifdef DOXYGEN_GENERATING_OUTPUT |
|
|
|
#ifdef DOXYGEN_GENERATING_OUTPUT |
|
|
|
@ -877,6 +899,7 @@ operator*(const Vector<size, Integral>& vector, FloatingPoint number) { |
|
|
|
@brief Multiply floating-point number with integral vector |
|
|
|
@brief Multiply floating-point number with integral vector |
|
|
|
|
|
|
|
|
|
|
|
Same as operator*(const Vector<size, Integral>&, FloatingPoint). |
|
|
|
Same as operator*(const Vector<size, Integral>&, FloatingPoint). |
|
|
|
|
|
|
|
@todoc Make explicit reference when Doxygen can handle operators |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
template<std::size_t size, class FloatingPoint, class Integral> inline |
|
|
|
template<std::size_t size, class FloatingPoint, class Integral> inline |
|
|
|
#ifdef DOXYGEN_GENERATING_OUTPUT |
|
|
|
#ifdef DOXYGEN_GENERATING_OUTPUT |
|
|
|
@ -893,6 +916,7 @@ operator*(FloatingPoint number, const Vector<size, Integral>& vector) { |
|
|
|
|
|
|
|
|
|
|
|
Similar to Vector::operator/=(T), except that the division is done in |
|
|
|
Similar to 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. |
|
|
|
|
|
|
|
@todoc Make explicit reference when Doxygen can handle operators |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
template<std::size_t size, class Integral, class FloatingPoint> inline |
|
|
|
template<std::size_t size, class Integral, class FloatingPoint> inline |
|
|
|
#ifdef DOXYGEN_GENERATING_OUTPUT |
|
|
|
#ifdef DOXYGEN_GENERATING_OUTPUT |
|
|
|
@ -912,6 +936,7 @@ operator/=(Vector<size, Integral>& vector, FloatingPoint number) { |
|
|
|
|
|
|
|
|
|
|
|
Similar to Vector::operator/(T) const, except that the division is done in |
|
|
|
Similar to Vector::operator/(T) const, except that the division is done in |
|
|
|
floating-point. |
|
|
|
floating-point. |
|
|
|
|
|
|
|
@todoc Make explicit reference when Doxygen can handle operators |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
template<std::size_t size, class Integral, class FloatingPoint> inline |
|
|
|
template<std::size_t size, class Integral, class FloatingPoint> inline |
|
|
|
#ifdef DOXYGEN_GENERATING_OUTPUT |
|
|
|
#ifdef DOXYGEN_GENERATING_OUTPUT |
|
|
|
@ -929,6 +954,7 @@ operator/(const Vector<size, Integral>& vector, FloatingPoint number) { |
|
|
|
|
|
|
|
|
|
|
|
Similar to Vector::operator*=(const Vector<size, T>&), except that the |
|
|
|
Similar to 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. |
|
|
|
|
|
|
|
@todoc Make explicit reference when Doxygen can handle operators |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
template<std::size_t size, class Integral, class FloatingPoint> inline |
|
|
|
template<std::size_t size, class Integral, class FloatingPoint> inline |
|
|
|
#ifdef DOXYGEN_GENERATING_OUTPUT |
|
|
|
#ifdef DOXYGEN_GENERATING_OUTPUT |
|
|
|
@ -946,10 +972,11 @@ 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 integral vector with floating-point vector component-wise |
|
|
|
|
|
|
|
|
|
|
|
Similar to Vector::operator*(const Vector<size, T>&) const, except that the |
|
|
|
Similar to Vector::operator*(const Vector<size, T>&) const, except that |
|
|
|
multiplication is done in floating-point. The result is always integral vector, |
|
|
|
the multiplication is done in floating-point. The result is always integral |
|
|
|
convert both arguments to the same floating-point type to have floating-point |
|
|
|
vector, convert both arguments to the same floating-point type to have |
|
|
|
result. |
|
|
|
floating-point result. |
|
|
|
|
|
|
|
@todoc Make explicit reference when Doxygen can handle operators |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
template<std::size_t size, class Integral, class FloatingPoint> inline |
|
|
|
template<std::size_t size, class Integral, class FloatingPoint> inline |
|
|
|
#ifdef DOXYGEN_GENERATING_OUTPUT |
|
|
|
#ifdef DOXYGEN_GENERATING_OUTPUT |
|
|
|
@ -966,6 +993,7 @@ operator*(const Vector<size, Integral>& a, const Vector<size, FloatingPoint>& b) |
|
|
|
@brief Multiply floating-point vector with integral vector component-wise |
|
|
|
@brief Multiply floating-point vector with integral vector component-wise |
|
|
|
|
|
|
|
|
|
|
|
Same as operator*(const Vector<size, Integral>&, const Vector<size, FloatingPoint>&). |
|
|
|
Same as operator*(const Vector<size, Integral>&, const Vector<size, FloatingPoint>&). |
|
|
|
|
|
|
|
@todoc Make explicit reference when Doxygen can handle operators |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
template<std::size_t size, class FloatingPoint, class Integral> inline |
|
|
|
template<std::size_t size, class FloatingPoint, class Integral> inline |
|
|
|
#ifdef DOXYGEN_GENERATING_OUTPUT |
|
|
|
#ifdef DOXYGEN_GENERATING_OUTPUT |
|
|
|
@ -982,6 +1010,7 @@ operator*(const Vector<size, FloatingPoint>& a, const Vector<size, Integral>& b) |
|
|
|
|
|
|
|
|
|
|
|
Similar to Vector::operator/=(const Vector<size, T>&), except that the division |
|
|
|
Similar to Vector::operator/=(const Vector<size, T>&), except that the division |
|
|
|
is done in floating-point. The computation is done in-place. |
|
|
|
is done in floating-point. The computation is done in-place. |
|
|
|
|
|
|
|
@todoc Make explicit reference when Doxygen can handle operators |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
template<std::size_t size, class Integral, class FloatingPoint> inline |
|
|
|
template<std::size_t size, class Integral, class FloatingPoint> inline |
|
|
|
#ifdef DOXYGEN_GENERATING_OUTPUT |
|
|
|
#ifdef DOXYGEN_GENERATING_OUTPUT |
|
|
|
@ -999,10 +1028,11 @@ 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 integral vector with floating-point vector component-wise |
|
|
|
|
|
|
|
|
|
|
|
Similar to Vector::operator/(const Vector<size, T>&) const, except that the |
|
|
|
Similar to Vector::operator/(const Vector<size, T>&) const, except that |
|
|
|
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, |
|
|
|
convert both arguments to the same floating-point type to have floating-point |
|
|
|
convert both arguments to the same floating-point type to have floating-point |
|
|
|
result. |
|
|
|
result. |
|
|
|
|
|
|
|
@todoc Make explicit reference when Doxygen can handle operators |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
template<std::size_t size, class Integral, class FloatingPoint> inline |
|
|
|
template<std::size_t size, class Integral, class FloatingPoint> inline |
|
|
|
#ifdef DOXYGEN_GENERATING_OUTPUT |
|
|
|
#ifdef DOXYGEN_GENERATING_OUTPUT |
|
|
|
|