16 #ifndef MATHFU_INTERNAL_VECTOR_3_H_
17 #define MATHFU_INTERNAL_VECTOR_3_H_
27 static const int d = 3;
32 MATHFU_VECTOR_OPERATION(
data_[i] = v.data_[i]);
37 MATHFU_VECTOR_OPERATION(
data_[i] = static_cast<T>(v[i]));
40 explicit inline Vector(
const T& s) { MATHFU_VECTOR_OPERATION(
data_[i] = s); }
42 explicit inline Vector(
const T* a) {
43 MATHFU_VECTOR_OPERATION(
data_[i] = a[i]);
46 inline Vector(
const T& s1,
const T& s2,
const T& s3) {
59 MATHFU_VECTOR_OPERATION(
data_[i] = vector.data[i]);
79 MATHFU_VECTOR_OPERATION(vector->data[i] =
data_[i]);
90 template <
typename CompatibleT>
92 return FromTypeHelper<T, d, CompatibleT>(compatible);
95 template <
typename CompatibleT>
97 return ToTypeHelper<T, d, CompatibleT>(v);
101 return DotProductHelper(v1, v2);
136 #include "mathfu/internal/disable_warnings_begin.h"
145 #include "mathfu/internal/disable_warnings_end.h"
169 #include "mathfu/internal/disable_warnings_begin.h"
179 #include "mathfu/internal/disable_warnings_end.h"
184 #endif // MATHFU_INTERNAL_VECTOR_3_H_
Definition: vector_3.h:24
T LengthHelper(const Vector< T, d > &v)
Calculate the length of a vector.
Definition: vector.h:787
VectorPacked & operator=(const Vector< T, 3 > &vector)
Definition: vector_3.h:164
T LengthSquared() const
Calculate the squared length of this vector.
Definition: vector.h:380
Definition: vector_3.h:149
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
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, 3 > CrossProductHelper(const Vector< T, 3 > &v1, const Vector< T, 3 > &v2)
Calculate the cross product of two vectors.
Definition: vector.h:766
T LengthSquaredHelper(const Vector< T, d > &v)
Calculate the squared length of a vector.
Definition: vector.h:778
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
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
VectorPacked(const Vector< T, 3 > &vector)
Definition: vector_3.h:157
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
static Vector< T, 3 > CrossProduct(const Vector< T, 3 > &v1, const Vector< T, 3 > &v2)
Calculate the cross product of two vectors.
Definition: vector.h:446
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
VectorPacked()
Create an uninitialized VectorPacked.
Definition: vector_3.h:151
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