35#include "foundation/PxMath.h"
36#include "foundation/PxVec3.h"
85 PX_CUDA_CALLABLE
PX_INLINE PxVec4T(Type nx, Type ny, Type nz, Type nw) : x(nx), y(ny), z(nz), w(nw)
104 explicit PX_CUDA_CALLABLE
PX_INLINE PxVec4T(
const Type v[]) : x(v[0]), y(v[1]), z(v[2]), w(v[3])
134 PX_ASSERT(index <= 3);
135 return reinterpret_cast<Type*
>(
this)[index];
143 PX_ASSERT(index <= 3);
144 return reinterpret_cast<const Type*
>(
this)[index];
152 return x == v.x && y == v.y && z == v.z && w == v.w;
160 return x != v.x || y != v.y || z != v.z || w != v.w;
168 return x == Type(0) && y == Type(0) && z == Type(0) && w == Type(0);
184 const Type unitTolerance = Type(1e-4);
195 return x * x + y * y + z * z + w * w;
211 return PxVec4T(-x, -y, -z, -w);
219 return PxVec4T(x + v.x, y + v.y, z + v.z, w + v.w);
227 return PxVec4T(x - v.x, y - v.y, z - v.z, w - v.w);
235 return PxVec4T(x * f, y * f, z * f, w * f);
244 return PxVec4T(x * f, y * f, z * f, w * f);
300 return x * v.x + y * v.y + z * v.z + w * v.w;
326 return PxVec4T(x * a.x, y * a.y, z * a.z, w * a.w);
354PX_CUDA_CALLABLE
static PX_INLINE PxVec4T<Type> operator*(Type f,
const PxVec4T<Type>& v)
356 return PxVec4T<Type>(f * v.x, f * v.y, f * v.z, f * v.w);
359typedef PxVec4T<float> PxVec4;
360typedef PxVec4T<double> PxVec4d;
3 Element vector class.
Definition PxVec3.h:50
PX_CUDA_CALLABLE PX_INLINE PxVec4T & operator/=(Type f)
scalar division
Definition PxVec4.h:285
PX_CUDA_CALLABLE PX_INLINE PxVec4T(Type nx, Type ny, Type nz, Type nw)
Initializes from 3 scalar parameters.
Definition PxVec4.h:85
PX_CUDA_CALLABLE PX_INLINE PxVec4T multiply(const PxVec4T &a) const
a[i] * b[i], for all i.
Definition PxVec4.h:324
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec4T(PxZERO)
zero constructor.
Definition PxVec4.h:62
PX_CUDA_CALLABLE PX_INLINE Type dot(const PxVec4T &v) const
returns the scalar product of this and other.
Definition PxVec4.h:298
PX_CUDA_CALLABLE PX_INLINE PxVec4T operator+(const PxVec4T &v) const
vector addition
Definition PxVec4.h:217
PX_CUDA_CALLABLE PX_INLINE Type magnitudeSquared() const
returns the squared magnitude
Definition PxVec4.h:193
PX_CUDA_CALLABLE PX_INLINE PxVec4T & operator=(const PxVec4T &p)
Assignment operator.
Definition PxVec4.h:120
PX_CUDA_CALLABLE PX_INLINE PxVec4T(Type a)
Assigns scalar parameter to all elements.
Definition PxVec4.h:73
PX_CUDA_CALLABLE PX_INLINE PxVec4T & operator*=(Type f)
scalar multiplication
Definition PxVec4.h:274
PX_CUDA_CALLABLE PX_INLINE Type magnitude() const
returns the magnitude
Definition PxVec4.h:201
PX_CUDA_CALLABLE PX_INLINE bool operator!=(const PxVec4T &v) const
returns true if the two vectors are not exactly equal.
Definition PxVec4.h:158
PX_CUDA_CALLABLE PX_INLINE PxVec4T(const Type v[])
Initializes from an array of scalar parameters.
Definition PxVec4.h:104
PX_CUDA_CALLABLE PX_INLINE PxVec4T maximum(const PxVec4T &v) const
element-wise maximum
Definition PxVec4.h:340
PX_CUDA_CALLABLE PX_INLINE bool operator==(const PxVec4T &v) const
returns true if the two vectors are exactly equal.
Definition PxVec4.h:150
PX_CUDA_CALLABLE PX_INLINE bool isFinite() const
returns true if all 3 elems of the vector are finite (not NAN or INF, etc.)
Definition PxVec4.h:174
PX_CUDA_CALLABLE PX_INLINE Type & operator[](unsigned int index)
element access
Definition PxVec4.h:132
PX_CUDA_CALLABLE PX_INLINE PxVec4T minimum(const PxVec4T &v) const
element-wise minimum
Definition PxVec4.h:332
PX_CUDA_CALLABLE PX_INLINE PxVec4T operator-(const PxVec4T &v) const
vector difference
Definition PxVec4.h:225
PX_CUDA_CALLABLE PX_INLINE Type normalize()
normalizes the vector in place
Definition PxVec4.h:313
PX_CUDA_CALLABLE PX_INLINE PxVec4T(const PxVec4T &v)
Copy ctor.
Definition PxVec4.h:111
PX_CUDA_CALLABLE PX_INLINE PxVec4T()
default constructor leaves data uninitialized.
Definition PxVec4.h:55
PX_CUDA_CALLABLE PX_INLINE PxVec4T getNormalized() const
Definition PxVec4.h:304
PX_CUDA_CALLABLE PX_INLINE PxVec4T & operator-=(const PxVec4T &v)
vector difference
Definition PxVec4.h:262
PX_CUDA_CALLABLE PX_INLINE bool isZero() const
tests for exact zero vector
Definition PxVec4.h:166
PX_CUDA_CALLABLE PX_INLINE PxVec4T(const PxVec3T< Type > &v, Type nw)
Initializes from 3 scalar parameters.
Definition PxVec4.h:95
PX_CUDA_CALLABLE PX_INLINE PxVec4T operator-() const
negation
Definition PxVec4.h:209
PX_CUDA_CALLABLE PX_INLINE PxVec4T & operator+=(const PxVec4T &v)
vector addition
Definition PxVec4.h:250
PX_CUDA_CALLABLE PX_INLINE PxVec4T operator/(Type f) const
scalar division
Definition PxVec4.h:241
PX_CUDA_CALLABLE PX_INLINE PxVec4T operator*(Type f) const
scalar post-multiplication
Definition PxVec4.h:233
PX_CUDA_CALLABLE PX_INLINE bool isNormalized() const
is normalized - used by API parameter validation
Definition PxVec4.h:182
PX_CUDA_CALLABLE PX_INLINE const Type & operator[](unsigned int index) const
element access
Definition PxVec4.h:141
#define PX_FORCE_INLINE
Definition PxPreprocessor.h:335
#define PX_INLINE
Definition PxPreprocessor.h:320
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
PX_CUDA_CALLABLE PX_FORCE_INLINE float PxAbs(float a)
abs returns the absolute value of its argument.
Definition PxMath.h:109
PX_CUDA_CALLABLE PX_FORCE_INLINE float PxRecipSqrt(float a)
reciprocal square root.
Definition PxMath.h:158
PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxIsFinite(float f)
returns true if the passed number is a finite floating point number as opposed to INF,...
Definition PxMath.h:326
PX_CUDA_CALLABLE PX_FORCE_INLINE float PxSqrt(float a)
Square root.
Definition PxMath.h:146
PX_CUDA_CALLABLE PX_FORCE_INLINE T PxMax(T a, T b)
The return value is the greater of the two specified values.
Definition PxMath.h:72
PX_CUDA_CALLABLE PX_FORCE_INLINE T PxMin(T a, T b)
The return value is the lesser of the two specified values.
Definition PxMath.h:88