16 #ifndef MATHFU_INTERNAL_VECTOR_4_H_
17 #define MATHFU_INTERNAL_VECTOR_4_H_
28 static const int d = 4;
33 MATHFU_VECTOR_OPERATION(
data_[i] = v.data_[i]);
38 MATHFU_VECTOR_OPERATION(
data_[i] = static_cast<T>(v[i]));
41 explicit inline Vector(
const T& s) { MATHFU_VECTOR_OPERATION(
data_[i] = s); }
43 explicit inline Vector(
const T* a) {
44 MATHFU_VECTOR_OPERATION(
data_[i] = a[i]);
47 inline Vector(
const T& s1,
const T& s2,
const T& s3,
const T& s4) {
69 MATHFU_VECTOR_OPERATION(
data_[i] = vector.data[i]);
93 MATHFU_VECTOR_OPERATION(vector->data[i] =
data_[i]);
104 template <
typename CompatibleT>
106 return FromTypeHelper<T, d, CompatibleT>(compatible);
109 template <
typename CompatibleT>
111 return ToTypeHelper<T, d, CompatibleT>(v);
115 return DotProductHelper(v1, v2);
145 #include "mathfu/internal/disable_warnings_begin.h"
155 #include "mathfu/internal/disable_warnings_end.h"
179 #include "mathfu/internal/disable_warnings_begin.h"
190 #include "mathfu/internal/disable_warnings_end.h"
195 #endif // MATHFU_INTERNAL_VECTOR_4_H_
Definition: vector_3.h:24
T LengthHelper(const Vector< T, d > &v)
Calculate the length of a vector.
Definition: vector.h:787
T LengthSquared() const
Calculate the squared length of this vector.
Definition: vector.h:380
Vector of d elements with type T.
Definition: vector.h:63
Definition: vector_2.h:24
static Vector< T, d > Min(const Vector< T, d > &v1, const Vector< T, d > &v2)
Compare each component and returns min values.
Definition: vector.h:487
T & operator[](const int i)
Access an element of the vector.
Definition: vector.h:306
T Length() const
Calculate the length of this vector.
Definition: vector.h:385
#define MATHFU_DEFINE_CLASS_SIMD_AWARE_NEW_DELETE
Macro which defines the new and delete for MathFu classes.
Definition: utilities.h:600
Vector< T, d > NormalizedHelper(const Vector< T, d > &v)
Calculate the normalized version of a vector.
Definition: vector.h:807
static Vector< T, d > Max(const Vector< T, d > &v1, const Vector< T, d > &v2)
Compare each component and returns max values.
Definition: vector.h:477
MATHFU_DEFINE_CLASS_SIMD_AWARE_NEW_DELETE T data_[d]
Elements of the vector.
Definition: vector.h:495
Vector< T, d > MinHelper(const Vector< T, d > &v1, const Vector< T, d > &v2)
Compare each component and returns min values.
Definition: vector.h:855
T Normalize()
Normalize this vector in-place.
Definition: vector.h:390
VectorPacked(const Vector< T, 4 > &vector)
Definition: vector_4.h:167
static Vector< T, d > HadamardProduct(const Vector< T, d > &v1, const Vector< T, d > &v2)
Calculate the hadamard or componentwise product of two vectors.
Definition: vector.h:435
static CompatibleT ToType(const Vector< T, d > &v)
Load into any type that is some formulation of a length d array of type T.
Definition: vector.h:417
Vector< T, 2 > zw()
GLSL style 2 element accessor.
Definition: vector.h:356
T LengthSquaredHelper(const Vector< T, d > &v)
Calculate the squared length of a vector.
Definition: vector.h:778
Definition: vector_4.h:25
Vector< T, d > HadamardProductHelper(const Vector< T, d > &v1, const Vector< T, d > &v2)
Calculate the hadamard or componentwise product of two vectors.
Definition: vector.h:754
Vector< T, 2 > xy()
GLSL style 2 element accessor.
Definition: vector.h:338
T data[d]
Elements of the packed vector one per dimension.
Definition: vector.h:142
Vector< T, d > Normalized() const
Calculate the normalized version of this vector.
Definition: vector.h:395
static T DotProduct(const Vector< T, d > &v1, const Vector< T, d > &v2)
Calculate the dot product of two vectors.
Definition: vector.h:426
Definition: vector_4.h:159
VectorPacked()
Create an uninitialized VectorPacked.
Definition: vector_4.h:161
VectorPacked & operator=(const Vector< T, 4 > &vector)
Definition: vector_4.h:174
Vector< T, d > RandomInRangeHelper(const Vector< T, d > &min, const Vector< T, d > &max)
Generates a random vector.
Definition: vector.h:830
Packed N-dimensional vector.
Definition: vector.h:121
void Pack(VectorPacked< T, d > *const vector) const
Pack a Vector to a packed "d" element vector structure.
Definition: vector.h:373
Vector class and functions.
static Vector< T, d > RandomInRange(const Vector< T, d > &min, const Vector< T, d > &max)
Generates a random vector.
Definition: vector.h:467
T & operator()(const int i)
Access an element of the vector.
Definition: vector.h:293
static Vector< T, d > Lerp(const Vector< T, d > &v1, const Vector< T, d > &v2, const T percent)
Linearly interpolate two vectors.
Definition: vector.h:457
T NormalizeHelper(Vector< T, d > &v)
Normalize a vector in-place.
Definition: vector.h:796
Vector()
Create an uninitialized Vector.
Definition: vector.h:163
Vector< T, d > MaxHelper(const Vector< T, d > &v1, const Vector< T, d > &v2)
Compare each component and returns max values.
Definition: vector.h:843
Vector< T, 3 > xyz()
GLSL style 3 element accessor.
Definition: vector.h:319
static Vector< T, d > FromType(const CompatibleT &compatible)
Load from any type that is some formulation of a length d array of type T.
Definition: vector.h:405
Vector< T, d > LerpHelper(const Vector< T, d > &v1, const Vector< T, d > &v2, const T percent)
Linearly interpolate two vectors.
Definition: vector.h:818
T Scalar
Element type to enable reference by other classes.
Definition: vector.h:160