|
DirectZ
|
#include <math.hpp>
Public Types | |
| using | Base = vec<T, N> |
Public Member Functions | |
| template<typename... Args> | |
| color_vec (Args &&... args) | |
| template<typename OT, size_t ON> | |
| color_vec (const vec< OT, ON > &other) | |
| color_vec ()=default | |
| color_vec (const color_vec &)=default | |
| color_vec & | operator= (const color_vec &)=default |
| color_vec (color_vec &&) noexcept=default | |
| color_vec & | operator= (color_vec &&) noexcept=default |
| vec & | operator= (const vec &other) |
| Assignment operator for component-wise copy. | |
| template<typename O> | |
| vec & | operator+= (const O &other) |
| Compound addition-assignment operator. | |
| template<typename O> | |
| vec & | operator-= (const O &other) |
| Compound subtraction-assignment operator. | |
| template<typename O> | |
| vec & | operator*= (const O &other) |
| Compound multiplication-assignment operator. | |
| template<typename O> | |
| vec & | operator/= (const O &other) |
| Compound division-assignment operator. | |
| template<typename O> | |
| vec | operator+ (const O &other) const |
| Addition operator returning a new vector. | |
| template<typename O> | |
| vec | operator- (const O &other) const |
| Subtraction operator returning a new vector. | |
| vec | operator- () const |
| Unary negation operator. | |
| template<typename O> | |
| vec | operator* (const O &other) const |
| Multiplication operator returning a new vector. | |
| template<typename O> | |
| vec | operator/ (const O &other) const |
| Division operator returning a new vector. | |
| T & | operator[] (size_t i) |
| Index operator for non-const access to vector components. | |
| const T & | operator[] (size_t i) const |
| Index operator for const access to vector components. | |
| T | length () const |
| Computes the Euclidean length (magnitude) of the vector. | |
| vec | normalize () const |
| Returns a normalized (unit length) copy of the vector. | |
| Public Member Functions inherited from dz::vec< T, N > | |
| template<typename... Args> | |
| vec (Args... args) | |
| Variadic constructor to initialize vector components. | |
| template<typename OT, size_t ON> | |
| vec (const vec< OT, ON > &other) | |
| Copy constructor to convert from vectors of different types and/or sizes. | |
| vec & | operator= (const vec &other) |
| Assignment operator for component-wise copy. | |
| T & | operator[] (size_t i) |
| Index operator for non-const access to vector components. | |
| const T & | operator[] (size_t i) const |
| Index operator for const access to vector components. | |
| template<typename O> | |
| vec & | operator*= (const O &other) |
| Compound multiplication-assignment operator. | |
| template<typename O> | |
| vec & | operator/= (const O &other) |
| Compound division-assignment operator. | |
| template<typename O> | |
| vec & | operator+= (const O &other) |
| Compound addition-assignment operator. | |
| template<typename O> | |
| vec & | operator-= (const O &other) |
| Compound subtraction-assignment operator. | |
| template<typename O> | |
| vec | operator* (const O &other) const |
| Multiplication operator returning a new vector. | |
| template<typename O> | |
| vec | operator/ (const O &other) const |
| Division operator returning a new vector. | |
| template<typename O> | |
| vec | operator+ (const O &other) const |
| Addition operator returning a new vector. | |
| template<typename O> | |
| vec | operator- (const O &other) const |
| Subtraction operator returning a new vector. | |
| vec | operator- () const |
| Unary negation operator. | |
| T | length () const |
| Computes the Euclidean length (magnitude) of the vector. | |
| vec | normalize () const |
| Returns a normalized (unit length) copy of the vector. | |
Public Attributes | |
| T | data [N] |
| Underlying array storing vector components. | |
| Public Attributes inherited from dz::vec< T, N > | |
| T | data [N] |
| Underlying array storing vector components. | |
|
inline |
|
inline |
|
default |
|
default |
|
defaultnoexcept |
Computes the Euclidean length (magnitude) of the vector.
Calculates the square root of the sum of squares of all components.
Returns a normalized (unit length) copy of the vector.
Divides all components by the vector length.
|
inline |
Multiplication operator returning a new vector.
Supports multiplication by a scalar or component-wise multiplication by another vector.
| O | Operand type (scalar T or vec<T, N>). |
| other | The scalar or vector to multiply by. |
|
inline |
Compound multiplication-assignment operator.
Supports multiplication by a scalar or component-wise multiplication by another vector. Throws std::runtime_error if the operand type is unsupported.
| O | Operand type (scalar T or vec<T, N>). |
| other | The scalar or vector to multiply by. |
| std::runtime_error | if unsupported operand type is used. |
|
inline |
Addition operator returning a new vector.
Supports addition by a scalar or component-wise addition by another vector.
| O | Operand type (scalar T or vec<T, N>). |
| other | The scalar or vector to add. |
|
inline |
Compound addition-assignment operator.
Supports addition by a scalar or component-wise addition by another vector. Throws std::runtime_error if the operand type is unsupported.
| O | Operand type (scalar T or vec<T, N>). |
| other | The scalar or vector to add. |
| std::runtime_error | if unsupported operand type is used. |
Unary negation operator.
Returns a new vector with all components negated.
|
inline |
Subtraction operator returning a new vector.
Supports subtraction by a scalar or component-wise subtraction by another vector.
| O | Operand type (scalar T or vec<T, N>). |
| other | The scalar or vector to subtract. |
|
inline |
Compound subtraction-assignment operator.
Supports subtraction by a scalar or component-wise subtraction by another vector. Throws std::runtime_error if the operand type is unsupported.
| O | Operand type (scalar T or vec<T, N>). |
| other | The scalar or vector to subtract. |
| std::runtime_error | if unsupported operand type is used. |
|
inline |
Division operator returning a new vector.
Supports division by a scalar or component-wise division by another vector.
| O | Operand type (scalar T or vec<T, N>). |
| other | The scalar or vector to divide by. |
|
inline |
Compound division-assignment operator.
Supports division by a scalar or component-wise division by another vector. Throws std::runtime_error if the operand type is unsupported.
| O | Operand type (scalar T or vec<T, N>). |
| other | The scalar or vector to divide by. |
| std::runtime_error | if unsupported operand type is used. |
|
defaultnoexcept |
|
default |
Assignment operator for component-wise copy.
Copies all components from the other vector using memcpy for efficiency.
| other | The vector to copy from. |
Index operator for non-const access to vector components.
No bounds checking is performed.
| i | The component index to access. |
Index operator for const access to vector components.
No bounds checking is performed.
| i | The component index to access. |
Underlying array storing vector components.