36#include "foundation/PxMath.h"
114 PX_ASSERT(index <= 2);
115 return reinterpret_cast<Type*
>(
this)[index];
123 PX_ASSERT(index <= 2);
124 return reinterpret_cast<const Type*
>(
this)[index];
132 return x == v.x && y == v.y && z == v.z;
140 return x != v.x || y != v.y || z != v.z;
148 return x == Type(0.0) && y == Type(0.0) && z == Type(0.0);
164 const float unitTolerance = Type(1e-4);
175 return x * x + y * y + z * z;
199 return PxVec3T(x + v.x, y + v.y, z + v.z);
207 return PxVec3T(x - v.x, y - v.y, z - v.z);
215 return PxVec3T(x * f, y * f, z * f);
224 return PxVec3T(x * f, y * f, z * f);
276 return x * v.x + y * v.y + z * v.z;
284 return PxVec3T(y * v.z - z * v.y, z * v.x - x * v.z, x * v.y - y * v.x);
312 if(mag < PX_NORMALIZATION_EPSILON)
314 *
this *= Type(1.0) / mag;
325 PX_ASSERT(mag >= PX_NORMALIZATION_EPSILON);
326 *
this *= Type(1.0) / mag;
335 return PxVec3T(x * a.x, y * a.y, z * a.z);
382PX_CUDA_CALLABLE
static PX_FORCE_INLINE PxVec3T<Type> operator*(Type f,
const PxVec3T<Type>& v)
384 return PxVec3T<Type>(f * v.x, f * v.y, f * v.z);
387typedef PxVec3T<float> PxVec3;
388typedef PxVec3T<double> PxVec3d;
416typedef PxVec3Padded PxVec3p;
A padded version of PxVec3, to safely load its data using SIMD.
Definition PxVec3.h:392
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3Padded & operator=(const PxVec3Padded &p)
Assignment operator. To fix this: error: definition of implicit copy assignment operator for 'PxVec3P...
Definition PxVec3.h:404
3 Element vector class.
Definition PxVec3.h:50
PX_CUDA_CALLABLE PX_FORCE_INLINE Type magnitude() const
returns the magnitude
Definition PxVec3.h:181
PX_CUDA_CALLABLE PX_FORCE_INLINE Type normalizeSafe()
normalizes the vector in place. Does nothing if vector magnitude is under PX_NORMALIZATION_EPSILON....
Definition PxVec3.h:309
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T & operator+=(const PxVec3T &v)
vector addition
Definition PxVec3.h:230
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T minimum(const PxVec3T &v) const
element-wise minimum
Definition PxVec3.h:341
PX_CUDA_CALLABLE PX_FORCE_INLINE Type normalizeFast()
normalizes the vector in place. Asserts if vector magnitude is under PX_NORMALIZATION_EPSILON....
Definition PxVec3.h:322
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T maximum(const PxVec3T &v) const
element-wise maximum
Definition PxVec3.h:357
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 PxVec3.h:154
PX_CUDA_CALLABLE PX_FORCE_INLINE Type dot(const PxVec3T &v) const
returns the scalar product of this and other.
Definition PxVec3.h:274
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T & operator/=(Type f)
scalar division
Definition PxVec3.h:262
PX_CUDA_CALLABLE PX_FORCE_INLINE const Type & operator[](unsigned int index) const
element access
Definition PxVec3.h:121
PX_CUDA_CALLABLE PX_FORCE_INLINE bool operator!=(const PxVec3T &v) const
returns true if the two vectors are not exactly equal.
Definition PxVec3.h:138
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T(PxZERO)
zero constructor.
Definition PxVec3.h:63
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T getNormalized() const
Definition PxVec3.h:288
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T multiply(const PxVec3T &a) const
a[i] * b[i], for all i.
Definition PxVec3.h:333
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T operator+(const PxVec3T &v) const
vector addition
Definition PxVec3.h:197
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T operator*(Type f) const
scalar post-multiplication
Definition PxVec3.h:213
PX_CUDA_CALLABLE PX_FORCE_INLINE Type & operator[](unsigned int index)
element access
Definition PxVec3.h:112
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T(Type a)
Assigns scalar parameter to all elements.
Definition PxVec3.h:74
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T()
default constructor leaves data uninitialized.
Definition PxVec3.h:56
PX_CUDA_CALLABLE PX_FORCE_INLINE bool isZero() const
tests for exact zero vector
Definition PxVec3.h:146
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T operator/(Type f) const
scalar division
Definition PxVec3.h:221
PX_CUDA_CALLABLE PX_FORCE_INLINE bool operator==(const PxVec3T &v) const
returns true if the two vectors are exactly equal.
Definition PxVec3.h:130
PX_CUDA_CALLABLE PX_FORCE_INLINE bool isNormalized() const
is normalized - used by API parameter validation
Definition PxVec3.h:162
PX_CUDA_CALLABLE PX_FORCE_INLINE Type minElement() const
returns MIN(x, y, z);
Definition PxVec3.h:349
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T operator-(const PxVec3T &v) const
vector difference
Definition PxVec3.h:205
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T & operator=(const PxVec3T &p)
Assignment operator.
Definition PxVec3.h:101
PX_CUDA_CALLABLE PX_FORCE_INLINE Type magnitudeSquared() const
returns the squared magnitude
Definition PxVec3.h:173
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T(Type nx, Type ny, Type nz)
Initializes from 3 scalar parameters.
Definition PxVec3.h:85
PX_CUDA_CALLABLE PX_FORCE_INLINE Type maxElement() const
returns MAX(x, y, z);
Definition PxVec3.h:365
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T abs() const
returns absolute values of components;
Definition PxVec3.h:373
PX_CUDA_CALLABLE PX_FORCE_INLINE Type normalize()
normalizes the vector in place
Definition PxVec3.h:297
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T cross(const PxVec3T &v) const
cross product
Definition PxVec3.h:282
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T(const PxVec3T &v)
Copy ctor.
Definition PxVec3.h:92
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T operator-() const
negation
Definition PxVec3.h:189
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T & operator-=(const PxVec3T &v)
vector difference
Definition PxVec3.h:241
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T & operator*=(Type f)
scalar multiplication
Definition PxVec3.h:252
3 Element vector class.
Definition PxVec3.h:50
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3()
default constructor leaves data uninitialized.
Definition PxVec3.h:55
#define PX_FORCE_INLINE
Definition PxPreprocessor.h:335
#define PX_COMPILE_TIME_ASSERT(exp)
Definition PxPreprocessor.h:428
#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