pbpt
|
Public Member Functions | |
constexpr | Normal (const Vector< T, N > &vec) |
Public Member Functions inherited from pbpt::math::Vector< T, N > | |
constexpr | Vector () noexcept=default |
Default constructor. Initializes all components to zero. | |
template<std::convertible_to< T >... Args> requires (sizeof...(Args) == N) | |
constexpr | Vector (Args &&... args) noexcept |
Constructs a vector from a list of individual components. | |
constexpr T & | x () noexcept |
Accesses the first component (x-axis). | |
constexpr T & | y () noexcept |
Accesses the second component (y-axis). | |
constexpr T & | z () noexcept |
Accesses the third component (z-axis). | |
constexpr T & | w () noexcept |
Accesses the fourth component (w-axis). | |
constexpr const T & | x () const noexcept |
Const access to the first component (x-axis). | |
constexpr const T & | y () const noexcept |
Const access to the second component (y-axis). | |
constexpr const T & | z () const noexcept |
Const access to the third component (z-axis). | |
constexpr const T & | w () const noexcept |
Const access to the fourth component (w-axis). | |
constexpr int | dims () const noexcept |
Returns the number of dimensions of the vector. | |
constexpr const T & | operator[] (int index) const |
Provides const access to the vector's components by index. | |
constexpr T & | operator[] (int index) |
Provides mutable access to the vector's components by index. | |
constexpr const T & | at (int index) const |
Provides const access to the vector's components by index. | |
constexpr Vector | operator- () const noexcept |
Negates the vector. | |
constexpr Vector & | operator+= (const Vector &rhs) noexcept |
Adds another vector to this one component-wise. | |
constexpr Vector & | operator-= (const Vector &rhs) noexcept |
Subtracts another vector from this one component-wise. | |
constexpr Vector & | operator*= (const T &rhs) noexcept |
Multiplies this vector by a scalar. | |
constexpr bool | operator== (const Vector &rhs) const noexcept |
operator== ,compare two vector component by component | |
constexpr bool | operator!= (const Vector &rhs) const noexcept |
operator!= | |
constexpr bool | is_normalized () const |
Check if the vector is normalized. | |
constexpr bool | is_zero () const |
Check if all components of the vector are zero. | |
constexpr bool | has_nan () const |
Check if any component of the vector is NaN (Not a Number). | |
template<std::convertible_to< T > U> | |
constexpr Vector | operator/= (const U &value) const noexcept |
Divides this vector by a scalar. | |
constexpr T | length_squared () const noexcept |
Calculates the squared length (magnitude) of the vector. | |
constexpr T | length () const |
Calculates the length (Euclidean norm) of the vector. | |
constexpr Vector | normalized () const |
Returns a new vector that is a normalized version of this one. | |
constexpr Vector & | normalize () |
Normalizes this vector in-place, making its length 1. | |
constexpr T | dot (const Vector &rhs) const noexcept |
Calculates the dot product of this vector and another. | |
constexpr Vector | cross (const Vector &rhs) const noexcept |
Calculates the cross product of this vector and another. | |
constexpr T | product () const noexcept |
void | apply (const std::function< void(T &, int)> &func) |
Applies a function to each element of the vector. | |
constexpr Vector | operator+ (const Vector< T, N > &rhs) const noexcept |
Adds two vectors component-wise. | |
constexpr Vector | operator- (const Vector< T, N > &rhs) const noexcept |
Subtracts one vector from another component-wise. | |
template<std::convertible_to< T > U> | |
constexpr Vector | operator* (U value) const noexcept |
Multiplies a vector by a scalar. | |
constexpr Vector | operator* (const Vector< T, N > &rhs) const noexcept |
Multiplies two vectors component-wise (Hadamard product). | |
template<std::convertible_to< T > U> | |
constexpr Vector | operator/ (U rhs) const |
Divides a vector by a scalar. | |
constexpr int | max_dim () const |
Returns the dimension with the maximum value. | |
constexpr T | max () const |
Returns the maximum value in the vector. | |
constexpr int | min_dim () const |
Returns the dimension with the minimum value. | |
constexpr T | min () const |
Returns the minimum value in the vector. | |
template<typename ... Args> requires (sizeof...(Args) == N) | |
constexpr Vector | permuted (Args ...args) const |
Returns a new vector with the specified dimensions permuted. | |
template<typename ... Args> requires (sizeof...(Args) == N) | |
constexpr Vector & | permute (Args ...args) |
Permutes the dimensions of the vector. |
Additional Inherited Members | |
Static Public Member Functions inherited from pbpt::math::Vector< T, N > | |
static constexpr Vector | filled (T value) noexcept |
Creates a vector with all components set to a single scalar value. | |
static constexpr Vector | zeros () noexcept |
Creates a vector with all components set to zero. | |
static constexpr Vector | ones () noexcept |
Creates a vector with all components set to one. |