Vector representing a point in four-dimensional space. More...
#include <ptems/vector.hpp>
Public Types | |
| using | ConjugateType = BasicVector< typename std::conditional_t< is_complex_v< V >, V, std::complex< V > >, 4 > |
| The type of the conjugate of the vector. More... | |
Public Member Functions | |
| constexpr | BasicVector () |
| Construct a zero vector. More... | |
| constexpr | BasicVector (V value) |
| Construct a vector with all components equal to the specified value. More... | |
| constexpr | BasicVector (V x, V y, V z, V t) |
| Construct a vector for the specified point. More... | |
| template<typename U > | |
| constexpr | BasicVector (const BasicVector< U, 4 > rhs) |
| Construct a vector by copying the specified vector. More... | |
| template<typename U > | |
| constexpr BasicVector & | operator= (const BasicVector< U, 4 > rhs) |
| Copy the specified vector to this. More... | |
| constexpr BasicVector & | operator= (V rhs) |
| Set all components tof vector equal to a constants. More... | |
| BasicVector< V, 3 > | XYZ () const |
| Swizzle function to get 3D vector containing x, y & z components. More... | |
| BasicVector< V, 3 > | XYT () const |
| Swizzle function to get 3D vector containing x, y & t components. More... | |
| BasicVector< V, 3 > | XZT () const |
| Swizzle function to get 3D vector containing x, z & t components. More... | |
| BasicVector< V, 3 > | YZT () const |
| Swizzle function to get 3D vector containing y, z & t components. More... | |
| BasicVector< V, 2 > | XY () const |
| Swizzle function to get 2D vector containing x & y components. More... | |
| BasicVector< V, 2 > | XZ () const |
| Swizzle function to get 2D vector containing x & z components. More... | |
| BasicVector< V, 2 > | XT () const |
| Swizzle function to get 2D vector containing x & t components. More... | |
| BasicVector< V, 2 > | YZ () const |
| Swizzle function to get 2D vector containing y & z components. More... | |
| BasicVector< V, 2 > | YT () const |
| Swizzle function to get 2D vector containing y & t components. More... | |
| BasicVector< V, 2 > | ZT () const |
| Swizzle function to get 2D vector containing z & t components. More... | |
| template<typename U > | |
| constexpr BasicVector & | operator+= (const BasicVector< U, 4 > &rhs) |
| Adds another 4D vector to this vector. More... | |
| constexpr BasicVector & | operator+= (V rhs) |
| Adds a scalar to this vector. More... | |
| template<typename U > | |
| constexpr BasicVector & | operator-= (const BasicVector< U, 4 > &rhs) |
| Subtracts another 4D vector to this vector. More... | |
| constexpr BasicVector & | operator-= (V rhs) |
| Subtracts a scalar from this vector. More... | |
| template<typename U > | |
| constexpr BasicVector & | operator/= (U rhs) |
| Divides all components of this vector by a constant. More... | |
| template<typename U > | |
| constexpr BasicVector & | operator/= (const BasicVector< U, 4 > &rhs) |
| Performs elementwise division of all components of this vector by the other vector. More... | |
| template<typename U > | |
| constexpr BasicVector & | operator*= (U rhs) |
| Multiplies all components of this vector by a constant. More... | |
| template<typename U > | |
| constexpr BasicVector & | operator*= (const BasicVector< U, 4 > &rhs) |
| Performs elementwise multiplication of all components of this vector by the other vector. More... | |
| constexpr BasicVector | operator- () const |
| Returns the negated vector. More... | |
| template<typename U > | |
| constexpr std::common_type_t< V, U > | Dot (const BasicVector< U, 4 > &rhs) const |
| Computes the dot product of this vector with the specified vector. More... | |
| constexpr BasicVector & | Normalise () |
| Normalises the current vector. More... | |
| constexpr BasicVector | Normalised () const |
| Gets a new vector which is the normalised version of this vector. More... | |
| constexpr V | operator[] (std::size_t i) const |
| Gets a component of the vector by index. More... | |
| constexpr V & | operator[] (std::size_t i) |
| Gets a mutable reference to the component of the vector by index. More... | |
| constexpr remove_complex_t< V > | Length () const |
| Computes the length of the vector. More... | |
| constexpr remove_complex_t< V > | LengthSquared () const |
| Gets the square of the length of the vector. More... | |
| ConjugateType | Conjugate () const |
| Computes the complex conjugate of the vector. More... | |
| BasicVector & | ConjugateOverwrite () const |
| Overwrites the vector with its complex conjugate. More... | |
| std::size_t | size () const |
| Gets the number of elements in the vector. More... | |
Public Attributes | |
| V | X |
| The x-component of the vector. More... | |
| V | Y |
| The y-component of the vector. More... | |
| V | Z |
| The z-component of the vector. More... | |
| V | T |
| The 4th (t)-component of the vector. More... | |
Vector representing a point in four-dimensional space.
| using ptems::BasicVector< V, 4 >::ConjugateType = BasicVector<typename std::conditional_t<is_complex_v<V>, V, std::complex<V> >,4> |
The type of the conjugate of the vector.
Will either be the same type if T is complex, otherwise a vector of std::complex<T>.
|
inlineconstexpr |
Construct a zero vector.
|
inlineexplicitconstexpr |
Construct a vector with all components equal to the specified value.
| value | Value to fill in each component of the vector |
|
inlineconstexpr |
Construct a vector for the specified point.
| x | The x-component of the vector |
| y | The y-component of the vector |
| z | The z-component of the vector |
| t | The 4th component (t) of the vector |
|
inlineconstexpr |
Construct a vector by copying the specified vector.
| U | Type of the vector to copy |
| rhs | Vector to copy |
|
inline |
Computes the complex conjugate of the vector.
|
inline |
Overwrites the vector with its complex conjugate.
|
inlineconstexpr |
Computes the dot product of this vector with the specified vector.
| U | Type of the components of the vector to dot product with |
| rhs | Vector to dot product with this vector |
|
inlineconstexpr |
Computes the length of the vector.
|
inlineconstexpr |
Gets the square of the length of the vector.
|
inlineconstexpr |
Normalises the current vector.
|
inlineconstexpr |
Gets a new vector which is the normalised version of this vector.
|
inlineconstexpr |
Performs elementwise multiplication of all components of this vector by the other vector.
| U | Type of the components of the vector to multiply by |
| rhs | Vector to multiply by elementwise |
|
inlineconstexpr |
Multiplies all components of this vector by a constant.
| U | Type of right hand side |
| rhs | Constant to multiple vector by |
|
inlineconstexpr |
Adds another 4D vector to this vector.
| U | Type of the components of the vector to add |
| rhs | Vector to add |
|
inlineconstexpr |
Adds a scalar to this vector.
| rhs | Scalar value to add |
|
inlineconstexpr |
Returns the negated vector.
| rhs | Vector to negate |
|
inlineconstexpr |
Subtracts another 4D vector to this vector.
| U | Type of the components of the vector to subtract |
| rhs | Vector to subtract |
|
inlineconstexpr |
Subtracts a scalar from this vector.
| rhs | Scalar value to subtract |
|
inlineconstexpr |
Performs elementwise division of all components of this vector by the other vector.
| U | Type of the components of the vector to divide by |
| rhs | Vector to divide by elementwise |
|
inlineconstexpr |
Divides all components of this vector by a constant.
| U | Type of right hand side |
| rhs | Constant to divide vector by |
|
inlineconstexpr |
Copy the specified vector to this.
| U | Type of the vector to copy |
| rhs | Vector to copy |
|
inlineconstexpr |
Set all components tof vector equal to a constants.
| rhs | Scalar to set vector to |
|
inlineconstexpr |
Gets a mutable reference to the component of the vector by index.
| i | The index of the component of the vector to get (must be 0, 1, 2, or 3). |
| std::out_of_range | If i is not 0, 1, 2, or 3. |
|
inlineconstexpr |
Gets a component of the vector by index.
| i | The index of the component of the vector to get (must be 0, 1, 2, or 3). |
| std::out_of_range | If i is not 0, 1, 2, or 3. |
|
inline |
Gets the number of elements in the vector.
|
inline |
Swizzle function to get 2D vector containing x & t components.
|
inline |
Swizzle function to get 2D vector containing x & y components.
|
inline |
Swizzle function to get 3D vector containing x, y & t components.
|
inline |
Swizzle function to get 3D vector containing x, y & z components.
|
inline |
Swizzle function to get 2D vector containing x & z components.
|
inline |
Swizzle function to get 3D vector containing x, z & t components.
|
inline |
Swizzle function to get 2D vector containing y & t components.
|
inline |
Swizzle function to get 2D vector containing y & z components.
|
inline |
Swizzle function to get 3D vector containing y, z & t components.
|
inline |
Swizzle function to get 2D vector containing z & t components.
| V ptems::BasicVector< V, 4 >::T |
The 4th (t)-component of the vector.
| V ptems::BasicVector< V, 4 >::X |
The x-component of the vector.
| V ptems::BasicVector< V, 4 >::Y |
The y-component of the vector.
| V ptems::BasicVector< V, 4 >::Z |
The z-component of the vector.