VectorN
The VectorN type provides a highly optimized and flexible container for arbitrary vector mathematics. It supports efficient storage, manipulation, and arithmetic operations, and is designed for performance-critical applications such as graphics, physics, and simulation.
VectorN has the same alignment as its underlying type.
It is possible to specify a vector size smaller than the underlying storage for optimization purposes.
SIMD types can be used as template parameters for structure of array (SOA) calculations.
#include <math/TellusimNumerical.h>
Variables
Type | Name | Description |
---|---|---|
Type | v[N] | Array access. |
Constructors
VectorN()
VectorN(const VectorN &vector)
explicit VectorN(uint32_t size)
explicit VectorN(const Type &value, uint32_t size = N)
explicit VectorN(const Type *vector, uint32_t size = N)
explicit VectorN(const InitializerList<Type> &list)
explicit VectorN(const VectorN<CType, N> &vector)
Methods
Update vector data.
void set(const Type &value, uint32_t size = N)
void set(const Type *vector, uint32_t size = N)
void set(const VectorN &vector)
void set(const InitializerList<Type> &list)
void get(Type *vector, uint32_t size = N)
Vector to scalar operators.
VectorN &operator*=(const Type &value)
VectorN &operator/=(const Type &value)
VectorN &operator+=(const Type &value)
VectorN &operator-=(const Type &value)
Vector to vector operators.
VectorN &operator=(const VectorN &vector)
VectorN &operator*=(const VectorN &vector)
VectorN &operator/=(const VectorN &vector)
VectorN &operator+=(const VectorN &vector)
VectorN &operator-=(const VectorN &vector)
Vector data.
const Type &operator[](uint32_t index) const
Type &operator[](uint32_t index)
Operators
Unary operators.
VectorN operator-(const VectorN &v)
Scalar to vector operators.
VectorN operator*(const Type &v0, const VectorN &v1)
VectorN operator/(const Type &v0, const VectorN &v1)
VectorN operator+(const Type &v0, const VectorN &v1)
VectorN operator-(const Type &v0, const VectorN &v1)
Vector to scalar operators.
VectorN operator*(const VectorN &v0, const Type &v1)
VectorN operator/(const VectorN &v0, const Type &v1)
VectorN operator+(const VectorN &v0, const Type &v1)
VectorN operator-(const VectorN &v0, const Type &v1)
Vector to vector operators.
VectorN operator*(const VectorN &v0, const VectorN &v1)
VectorN operator/(const VectorN &v0, const VectorN &v1)
VectorN operator+(const VectorN &v0, const VectorN &v1)
VectorN operator-(const VectorN &v0, const VectorN &v1)
Matrix to vector multiplication.
VectorN<Type, M> operator*(const MatrixNxM<Type, N, M> &m, const VectorN<Type, N> &v)
Vector to matrix multiplication.
VectorN<Type, N> operator*(const VectorN<Type, M> &v, const MatrixNxM<Type, N, M> &m)
Comparison operators.
bool operator==(const VectorN &v0, const VectorN &v1)
bool operator!=(const VectorN &v0, const VectorN &v1)
bool compare(const VectorN &v0, const VectorN &v1, const Type &a)
bool compare(const VectorN &v0, const VectorN &v1, const Type &a, const Type &r)
Functions
Min/max functions.
VectorN min(const VectorN &v0, const VectorN &v1)
VectorN max(const VectorN &v0, const VectorN &v1)
Range functions.
VectorN clamp(const VectorN &v, const Type &v0, const Type &v1)
VectorN clamp(const VectorN &v, const VectorN &v0, const VectorN &v1)
Math functions.
VectorN rcp(const VectorN &v)
VectorN sqrt(const VectorN &v)
VectorN rsqrt(const VectorN &v)
Vector functions
Type dot(const VectorN &v0, const VectorN &v1)
Type cross(const VectorN<Type, 2> &v0, const VectorN<Type, 2> &v1)
VectorN cross(const VectorN &v0, const VectorN &v1)
Type length2(const VectorN &v)
Type length(const VectorN &v)
VectorN normalize(const VectorN &v)
VectorN lerp(const VectorN &v0, const VectorN &v1, const Type &k)