30 #ifndef PXFOUNDATION_PXVEC3_H 31 #define PXFOUNDATION_PXVEC3_H 116 return reinterpret_cast<float*
>(
this)[index];
126 return reinterpret_cast<const float*
>(
this)[index];
134 return x == v.
x && y == v.
y && z == v.
z;
142 return x != v.
x || y != v.
y || z != v.
z;
150 return x == 0.0f && y == 0.0f && z == 0.0f;
166 const float unitTolerance = 1e-4f;
177 return x * x + y * y + z * z;
185 return PxSqrt(magnitudeSquared());
193 return PxVec3(-x, -y, -z);
201 return PxVec3(x + v.
x, y + v.
y, z + v.
z);
209 return PxVec3(x - v.
x, y - v.
y, z - v.
z);
217 return PxVec3(x * f, y * f, z * f);
226 return PxVec3(x * f, y * f, z * f);
278 return x * v.
x + y * v.
y + z * v.
z;
286 return PxVec3(y * v.
z - z * v.
y, z * v.
x - x * v.
z, x * v.
y - y * v.
x);
293 const float m = magnitudeSquared();
302 const float m = magnitude();
314 const float mag = magnitude();
327 const float mag = magnitude();
338 return PxVec3(x * a.
x, y * a.
y, z * a.
z);
386 return PxVec3(f * v.
x, f * v.
y, f * v.
z);
394 #endif // #ifndef PXFOUNDATION_PXVEC3_H Definition: GuContactBuffer.h:37
PX_CUDA_CALLABLE PX_FORCE_INLINE float normalizeSafe()
normalizes the vector in place. Does nothing if vector magnitude is under PX_NORMALIZATION_EPSILON. Returns vector magnitude if >= PX_NORMALIZATION_EPSILON and 0.0f otherwise.
Definition: PxVec3.h:312
PX_CUDA_CALLABLE PX_FORCE_INLINE float maxElement() const
returns MAX(x, y, z);
Definition: PxVec3.h:368
PX_CUDA_CALLABLE PX_FORCE_INLINE const float & operator[](unsigned int index) const
element access
Definition: PxVec3.h:122
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:156
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 getNormalized() const
Definition: PxVec3.h:291
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 operator*(float f) const
scalar post-multiplication
Definition: PxVec3.h:215
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 operator-(const PxVec3 &v) const
vector difference
Definition: PxVec3.h:207
PX_CUDA_CALLABLE PX_FORCE_INLINE float dot(const PxVec3 &v) const
returns the scalar product of this and other.
Definition: PxVec3.h:276
#define PX_FORCE_INLINE
Definition: PxPreprocessor.h:351
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 minimum(const PxVec3 &v) const
element-wise minimum
Definition: PxVec3.h:344
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3(const PxVec3 &v)
Copy ctor.
Definition: PxVec3.h:92
PxZERO
Definition: Px.h:76
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3(PxZERO r)
zero constructor.
Definition: PxVec3.h:62
#define PX_SHARED_ASSERT(exp)
Definition: PxSharedAssert.h:39
PX_CUDA_CALLABLE PX_FORCE_INLINE bool isFinite(float a)
platform-specific finiteness check (not INF or NAN)
Definition: PxUnixIntrinsics.h:127
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3(float nx, float ny, float nz)
Initializes from 3 scalar parameters.
Definition: PxVec3.h:85
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 & operator+=(const PxVec3 &v)
vector addition
Definition: PxVec3.h:232
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 operator+(const PxVec3 &v) const
vector addition
Definition: PxVec3.h:199
PX_CUDA_CALLABLE PX_FORCE_INLINE float PxSqrt(float a)
Square root.
Definition: PxMath.h:144
float y
Definition: PxVec3.h:381
PX_CUDA_CALLABLE PX_FORCE_INLINE float & operator[](unsigned int index)
element access
Definition: PxVec3.h:112
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:86
PX_CUDA_CALLABLE PX_FORCE_INLINE bool isNormalized() const
is normalized - used by API parameter validation
Definition: PxVec3.h:164
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 operator/(float f) const
scalar division
Definition: PxVec3.h:223
PX_CUDA_CALLABLE PX_FORCE_INLINE float minElement() const
returns MIN(x, y, z);
Definition: PxVec3.h:352
PX_CUDA_CALLABLE PX_FORCE_INLINE bool isZero() const
tests for exact zero vector
Definition: PxVec3.h:148
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 & operator-=(const PxVec3 &v)
vector difference
Definition: PxVec3.h:243
PX_CUDA_CALLABLE PX_FORCE_INLINE float PxRecipSqrt(float a)
reciprocal square root.
Definition: PxMath.h:156
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 & operator=(const PxVec3 &p)
Assignment operator.
Definition: PxVec3.h:101
PX_CUDA_CALLABLE PX_FORCE_INLINE float magnitude() const
returns the magnitude
Definition: PxVec3.h:183
PX_CUDA_CALLABLE PX_FORCE_INLINE float PxAbs(float a)
abs returns the absolute value of its argument.
Definition: PxMath.h:107
PX_CUDA_CALLABLE PX_FORCE_INLINE float normalize()
normalizes the vector in place
Definition: PxVec3.h:300
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:70
PX_CUDA_CALLABLE PX_FORCE_INLINE float magnitudeSquared() const
returns the squared magnitude
Definition: PxVec3.h:175
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 cross(const PxVec3 &v) const
cross product
Definition: PxVec3.h:284
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 & operator/=(float f)
scalar division
Definition: PxVec3.h:264
PX_CUDA_CALLABLE PX_INLINE void PX_UNUSED(T const &)
Definition: PxPreprocessor.h:466
PX_CUDA_CALLABLE PX_FORCE_INLINE float normalizeFast()
normalizes the vector in place. Asserts if vector magnitude is under PX_NORMALIZATION_EPSILON. returns vector magnitude.
Definition: PxVec3.h:325
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 abs() const
returns absolute values of components;
Definition: PxVec3.h:376
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:292
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3(float a)
Assigns scalar parameter to all elements.
Definition: PxVec3.h:74
PX_CUDA_CALLABLE PX_FORCE_INLINE bool operator==(const PxVec3 &v) const
returns true if the two vectors are exactly equal.
Definition: PxVec3.h:132
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 maximum(const PxVec3 &v) const
element-wise maximum
Definition: PxVec3.h:360
static PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 operator*(float f, const PxVec3 &v)
Definition: PxVec3.h:384
PX_CUDA_CALLABLE PX_FORCE_INLINE bool operator!=(const PxVec3 &v) const
returns true if the two vectors are not exactly equal.
Definition: PxVec3.h:140
#define PX_NORMALIZATION_EPSILON
Definition: PxSimpleTypes.h:95
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3()
default constructor leaves data uninitialized.
Definition: PxVec3.h:55
float z
Definition: PxVec3.h:381
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 & operator*=(float f)
scalar multiplication
Definition: PxVec3.h:254
#define PX_INLINE
Definition: PxPreprocessor.h:336
#define PX_CUDA_CALLABLE
Definition: PxPreprocessor.h:460
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 multiply(const PxVec3 &a) const
a[i] * b[i], for all i.
Definition: PxVec3.h:336
3 Element vector class.
Definition: PxVec3.h:49
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 operator-() const
negation
Definition: PxVec3.h:191
float x
Definition: PxVec3.h:381