Public Member Functions | |
| constexpr | Vector ()=default |
| Construct an uninitialized vector. | |
| constexpr | Vector (T scalar) |
| Construct a vector filled with a scalar value. | |
| constexpr | Vector (const std::array< T, Rows > &data) |
| Construct vector from supplied data. | |
| const T & | operator[] (size_t i) const |
| Index to an element in the vector. | |
| T & | operator[] (size_t i) |
| Index to an element in the vector. | |
| constexpr Vector< T, Rows > | operator- () const |
| Negate a Vector by negating both all of its coordinates. | |
| constexpr Vector | operator+ (const Vector &other) const |
| Calculate the sum of this vector and other element-wise. | |
| constexpr Vector | operator+ (T scalar) const |
| Calculate the sum of this vector and scalar element-wise. | |
| constexpr Vector | operator- (const Vector &other) const |
| Calculate the difference of this vector and other element-wise. | |
| constexpr Vector | operator- (T scalar) const |
| Calculate the difference of this vector and scalar element-wise. | |
| constexpr Vector | operator* (const Vector &other) const |
| Calculate the product of this vector and other element-wise. | |
| constexpr Vector | operator* (T scalar) const |
| Calculate the product of this vector and scalar element-wise. | |
| constexpr Vector | operator/ (const Vector &other) const |
| Calculate the quotient of this vector and other element-wise. | |
| constexpr Vector | operator/ (T scalar) const |
| Calculate the quotient of this vector and scalar element-wise. | |
| Vector & | operator+= (const Vector &other) |
| Add other element-wise to this vector. | |
| Vector & | operator+= (T scalar) |
| Add scalar element-wise to this vector. | |
| Vector & | operator-= (const Vector &other) |
| Subtract other element-wise from this vector. | |
| Vector & | operator-= (T scalar) |
| Subtract scalar element-wise from this vector. | |
| Vector & | operator*= (const Vector &other) |
| Multiply this vector by other element-wise. | |
| Vector & | operator*= (T scalar) |
| Multiply this vector by scalar element-wise. | |
| Vector & | operator/= (const Vector &other) |
| Divide this vector by other element-wise. | |
| Vector & | operator/= (T scalar) |
| Divide this vector by scalar element-wise. | |
| constexpr Vector | min (const Vector &other) const |
| Calculate the minimum of this vector and other element-wise. | |
| constexpr Vector | min (T scalar) const |
| Calculate the minimum of this vector and scalar element-wise. | |
| constexpr Vector | max (const Vector &other) const |
| Calculate the maximum of this vector and other element-wise. | |
| constexpr Vector | max (T scalar) const |
| Calculate the maximum of this vector and scalar element-wise. | |
| constexpr T | dot (const Vector< T, Rows > &other) const |
| Compute the dot product. | |
| constexpr const T & | x () const |
| Convenience function to access the first element of the vector. | |
| constexpr const T & | y () const |
| Convenience function to access the second element of the vector. | |
| constexpr const T & | z () const |
| Convenience function to access the third element of the vector. | |
| constexpr T & | x () |
| Convenience function to access the first element of the vector. | |
| constexpr T & | y () |
| Convenience function to access the second element of the vector. | |
| constexpr T & | z () |
| Convenience function to access the third element of the vector. | |
| constexpr const T & | r () const |
| Convenience function to access the first element of the vector. | |
| constexpr const T & | g () const |
| Convenience function to access the second element of the vector. | |
| constexpr const T & | b () const |
| Convenience function to access the third element of the vector. | |
| constexpr T & | r () |
| Convenience function to access the first element of the vector. | |
| constexpr T & | g () |
| Convenience function to access the second element of the vector. | |
| constexpr T & | b () |
| Convenience function to access the third element of the vector. | |
| constexpr double | length2 () const |
| Get the squared length of the vector. | |
| constexpr double | length () const |
| Get the length of the vector. | |
| template<typename R = T> | |
| constexpr R | sum () const |
| Calculate the sum of all the vector elements. | |
Vector class.
| T | Type of numerical values to be stored in the vector |
| Rows | Number of dimension of the vector (= number of elements) |
|
inlineexplicitconstexpr |
Construct a vector filled with a scalar value.
| [in] | scalar | The scalar value |
|
inlineconstexpr |
Construct vector from supplied data.
| data | Data from which to construct a vector |
The size of data must be equal to the dimension size Rows of the vector.
|
inlineconstexpr |
Convenience function to access the third element of the vector.
|
inlineconstexpr |
Convenience function to access the third element of the vector.
|
inlineconstexpr |
Compute the dot product.
| [in] | other | The other vector |
|
inlineconstexpr |
Convenience function to access the second element of the vector.
|
inlineconstexpr |
Convenience function to access the second element of the vector.
|
inlineconstexpr |
Get the length of the vector.
|
inlineconstexpr |
Get the squared length of the vector.
|
inlineconstexpr |
Calculate the maximum of this vector and other element-wise.
| [in] | other | The other vector |
|
inlineconstexpr |
Calculate the maximum of this vector and scalar element-wise.
| [in] | scalar | The scalar |
|
inlineconstexpr |
Calculate the minimum of this vector and other element-wise.
| [in] | other | The other vector |
|
inlineconstexpr |
Calculate the minimum of this vector and scalar element-wise.
| [in] | scalar | The scalar |
|
inlineconstexpr |
Calculate the product of this vector and other element-wise.
| [in] | other | The other vector |
|
inlineconstexpr |
Calculate the product of this vector and scalar element-wise.
| [in] | scalar | The scalar |
|
inline |
Multiply this vector by other element-wise.
| [in] | other | The other vector |
|
inline |
Multiply this vector by scalar element-wise.
| [in] | scalar | The scalar |
|
inlineconstexpr |
Calculate the sum of this vector and other element-wise.
| [in] | other | The other vector |
|
inlineconstexpr |
Calculate the sum of this vector and scalar element-wise.
| [in] | scalar | The scalar |
|
inline |
Add other element-wise to this vector.
| [in] | other | The other vector |
|
inline |
Add scalar element-wise to this vector.
| [in] | scalar | The scalar |
|
inlineconstexpr |
Negate a Vector by negating both all of its coordinates.
|
inlineconstexpr |
Calculate the difference of this vector and other element-wise.
| [in] | other | The other vector |
|
inlineconstexpr |
Calculate the difference of this vector and scalar element-wise.
| [in] | scalar | The scalar |
|
inline |
Subtract other element-wise from this vector.
| [in] | other | The other vector |
|
inline |
Subtract scalar element-wise from this vector.
| [in] | scalar | The scalar |
|
inlineconstexpr |
Calculate the quotient of this vector and other element-wise.
| [in] | other | The other vector |
|
inlineconstexpr |
Calculate the quotient of this vector and scalar element-wise.
| [in] | scalar | The scalar |
|
inline |
Divide this vector by other element-wise.
| [in] | other | The other vector |
|
inline |
Divide this vector by scalar element-wise.
| [in] | scalar | The scalar |
|
inline |
Index to an element in the vector.
| i | Index of element to retrieve |
|
inline |
Index to an element in the vector.
| i | Index of element to retrieve |
|
inlineconstexpr |
Convenience function to access the first element of the vector.
|
inlineconstexpr |
Convenience function to access the first element of the vector.
|
inlineconstexpr |
Calculate the sum of all the vector elements.
| R | The type of the sum |
The type R of the sum defaults to the type T of the elements, but can be set explicitly to use a different type in case the type T would risk overflowing.
|
inlineconstexpr |
Convenience function to access the first element of the vector.
|
inlineconstexpr |
Convenience function to access the first element of the vector.
|
inlineconstexpr |
Convenience function to access the second element of the vector.
|
inlineconstexpr |
Convenience function to access the second element of the vector.
|
inlineconstexpr |
Convenience function to access the third element of the vector.
|
inlineconstexpr |
Convenience function to access the third element of the vector.