![]() |
Raven Engine v0.1
|
Vector types and operations. More...
Classes | |
| struct | Crux::Vector< T, 2 > |
| 2-dimensional vector. More... | |
| struct | Crux::Vector< T, 3 > |
| 3-dimensional vector. More... | |
| struct | Crux::Vector< T, 4 > |
| 4-dimensional vector. More... | |
| struct | Crux::Vector< T, N > |
| General N-dimensional fixed-size vector container. More... | |
Typedefs | |
| using | Crux::ivec3 = Vector<int, 3> |
| 2D integer vector | |
| using | Crux::ivec4 = Vector<int, 4> |
| 3D integer vector | |
| using | Crux::uvec2 = Vector<unsigned, 2> |
| 4D integer vector | |
| using | Crux::uvec3 = Vector<unsigned, 3> |
| 2D unsigned vector | |
| using | Crux::uvec4 = Vector<unsigned, 4> |
| 3D unsigned vector | |
| using | Crux::vec2 = Vector<float, 2> |
| 4D unsigned vector | |
| using | Crux::vec3 = Vector<float, 3> |
| 2D float vector | |
| using | Crux::vec4 = Vector<float, 4> |
| 3D float vector | |
| using | Crux::dvec2 = Vector<double, 2> |
| 4D float vector | |
| using | Crux::dvec3 = Vector<double, 3> |
| 2D double vector | |
| using | Crux::dvec4 = Vector<double, 4> |
| 3D double vector | |
Functions | |
| template<typename T, size_t N> | |
| constexpr Vector< T, N > | Crux::operator+ (const Vector< T, N > &a, const Vector< T, N > &b) |
| Component-wise addition of two vectors. | |
| template<typename T, size_t N> | |
| constexpr Vector< T, N > | Crux::operator- (const Vector< T, N > &a, const Vector< T, N > &b) |
| Component-wise subtraction of two vectors. | |
| template<typename T, size_t N> | |
| constexpr Vector< T, N > | Crux::operator* (const Vector< T, N > &a, const T &scalar) |
| Scalar multiplication (vector * scalar). | |
| template<typename T, size_t N> | |
| constexpr Vector< T, N > | Crux::operator* (const T &scalar, const Vector< T, N > &a) |
| Scalar multiplication (scalar * vector). | |
| template<typename T, size_t N> | |
| constexpr Vector< T, N > | Crux::operator/ (const Vector< T, N > &a, const T &scalar) |
| Scalar division of a vector. | |
| template<typename T, size_t N> | |
| constexpr Vector< T, N > & | Crux::operator+= (Vector< T, N > &a, const Vector< T, N > &b) |
| Compound addition assignment (vector += vector). | |
| template<typename T, size_t N> | |
| constexpr Vector< T, N > & | Crux::operator-= (Vector< T, N > &a, const Vector< T, N > &b) |
| Compound subtraction assignment (vector -= vector). | |
| template<typename T, size_t N> | |
| constexpr Vector< T, N > & | Crux::operator*= (Vector< T, N > &a, const T &scalar) |
| Compound scalar multiplication assignment (vector *= scalar). | |
| template<typename T, size_t N> | |
| constexpr Vector< T, N > & | Crux::operator/= (Vector< T, N > &a, const T &scalar) |
| Compound scalar division assignment (vector /= scalar). | |
| template<typename T, size_t N> | |
| constexpr T | Crux::Dot (const Vector< T, N > &a, const Vector< T, N > &b) |
| Dot product of two vectors. | |
| template<typename T> | |
| constexpr Vector< T, 3 > | Crux::Cross (const Vector< T, 3 > &a, const Vector< T, 3 > &b) |
| Cross product for 3D vectors. | |
| template<typename T, size_t N> | |
| constexpr T | Crux::LengthSq (const Vector< T, N > &a) |
| Squared length (magnitude) of a vector. | |
| template<typename T, size_t N> | |
| T | Crux::Length (const Vector< T, N > &a) |
| Length (magnitude) of a vector. | |
| template<typename T, size_t N> | |
| Vector< T, N > | Crux::Normalize (const Vector< T, N > &a) |
| Normalizes a vector to unit length. | |
| template<typename T, size_t N> | |
| constexpr Vector< T, N > | Crux::Project (const Vector< T, N > &a, const Vector< T, N > &b) |
| Projects vector a onto vector b. | |
| template<typename T, size_t N> | |
| constexpr Vector< T, N > | Crux::Reflect (const Vector< T, N > &a, const Vector< T, N > &normal) |
| Reflects vector a around the given normal. | |
| template<typename T, size_t N> | |
| constexpr Vector< T, N > | Crux::MinComponent (const Vector< T, N > &a, const Vector< T, N > &b) |
| Element-wise minimum of two vectors. | |
| template<typename T, size_t N> | |
| constexpr Vector< T, N > | Crux::MaxComponent (const Vector< T, N > &a, const Vector< T, N > &b) |
| Element-wise maximum of two vectors. | |
| template<typename T, size_t N> | |
| constexpr Vector< T, N > | Crux::Abs (const Vector< T, N > &a) |
| Element-wise absolute value of a vector. | |
| template<typename T, size_t N> | |
| constexpr bool | Crux::operator== (const Vector< T, N > &a, const Vector< T, N > &b) |
| Approximate equality comparison with tolerance. | |
| template<typename T, size_t N> | |
| constexpr bool | Crux::operator!= (const Vector< T, N > &a, const Vector< T, N > &b) |
| Inequality comparison. | |
| template<typename T, size_t N> | |
| T | Crux::AngleBetween (const Vector< T, N > &a, const Vector< T, N > &b) |
| Angle between two vectors in radians. | |
| template<typename T, size_t N> | |
| constexpr Vector< T, N > | Crux::Lerp (const Vector< T, N > &a, const Vector< T, N > &b, T t) |
| Linear interpolation between two vectors. | |
Vector types and operations.
Contains all functionality related to vector math and operations on vector types.
| using Crux::dvec2 = Vector<double, 2> |
4D float vector
| using Crux::dvec3 = Vector<double, 3> |
2D double vector
| using Crux::dvec4 = Vector<double, 4> |
3D double vector
| using Crux::ivec3 = Vector<int, 3> |
2D integer vector
| using Crux::ivec4 = Vector<int, 4> |
3D integer vector
| using Crux::uvec2 = Vector<unsigned, 2> |
4D integer vector
| using Crux::uvec3 = Vector<unsigned, 3> |
2D unsigned vector
| using Crux::uvec4 = Vector<unsigned, 4> |
3D unsigned vector
| using Crux::vec2 = Vector<float, 2> |
4D unsigned vector
| using Crux::vec3 = Vector<float, 3> |
2D float vector
| using Crux::vec4 = Vector<float, 4> |
3D float vector
Element-wise absolute value of a vector.
Returns a new vector where each component is the absolute value of the corresponding component of the input vector.
| a | Input vector. |
|
inline |
Angle between two vectors in radians.
Computes the angle between two vectors using the dot product formula.
| a | First vector. |
| b | Second vector. |
|
constexpr |
Cross product for 3D vectors.
Computes the cross product of two 3D vectors, resulting in a vector orthogonal to both.
| a | First vector. |
| b | Second vector. |
|
constexpr |
Dot product of two vectors.
Computes the dot product (scalar product) of two vectors, which is the sum of the products of their corresponding components.
| a | First vector. |
| b | Second vector. |
|
inline |
Length (magnitude) of a vector.
| a | Input vector. |
|
constexpr |
Squared length (magnitude) of a vector.
Computes the squared length without taking the square root, which is more efficient.
| a | Input vector. |
|
constexpr |
Linear interpolation between two vectors.
Performs linear interpolation between two vectors based on a factor t.
| a | First vector. |
| b | Second vector. |
| t | Interpolation factor (0.0 to 1.0). |
|
constexpr |
Element-wise maximum of two vectors.
Returns a vector where each component is the maximum of the corresponding components of the input vectors.
| a | First vector. |
| b | Second vector. |
|
constexpr |
Element-wise minimum of two vectors.
Returns a vector where each component is the minimum of the corresponding components of a and b.
| a | First vector. |
| b | Second vector. |
Normalizes a vector to unit length.
Normalization scales the vector to have a length of 1, preserving its direction.
| a | Input vector to normalize. |
|
constexpr |
Inequality comparison.
|
constexpr |
Scalar multiplication (scalar * vector).
Multiplies each component of the vector by the scalar value.
| scalar | Scalar value to multiply by. |
| a | Input vector. |
|
constexpr |
Scalar multiplication (vector * scalar).
Multiplies each component of the vector by the scalar value.
| a | Input vector. |
| scalar | Scalar value to multiply by. |
|
constexpr |
Compound scalar multiplication assignment (vector *= scalar).
Multiplies each component of the vector by the scalar.
| a | Vector to be multiplied. |
| scalar | Scalar value to multiply by. |
|
constexpr |
Component-wise addition of two vectors.
Adds corresponding components of two vectors of the same size.
| a | First vector. |
| b | Second vector. |
|
constexpr |
Component-wise subtraction of two vectors.
Subtracts corresponding components of vector b from vector a.
| a | First vector. |
| b | Second vector. |
|
constexpr |
Scalar division of a vector.
Divides each component of the vector by the scalar value.
| a | Input vector. |
| scalar | Scalar value to divide by. |
|
constexpr |
Compound scalar division assignment (vector /= scalar).
Divides each component of the vector by the scalar.
| a | Vector to be divided. |
| scalar | Scalar value to divide by. |
|
constexpr |
Approximate equality comparison with tolerance.
|
constexpr |
Projects vector a onto vector b.
Projects vector a onto vector b, returning the component of a that lies in the direction of b.
| a | Input vector to project. |
| b | Vector onto which a is projected. |
|
constexpr |
Reflects vector a around the given normal.
Reflects vector a across the plane defined by the normal vector.
| a | Input vector to reflect. |
| normal | Normal vector defining the reflection plane. |