30 #ifndef PXFOUNDATION_PXVEC2_H 31 #define PXFOUNDATION_PXVEC2_H 114 return reinterpret_cast<float*
>(
this)[index];
124 return reinterpret_cast<const float*
>(
this)[index];
132 return x == v.
x && y == v.
y;
140 return x != v.
x || y != v.
y;
148 return x == 0.0f && y == 0.0f;
164 const float unitTolerance = 1e-4f;
175 return x * x + y * y;
183 return PxSqrt(magnitudeSquared());
215 return PxVec2(x * f, y * f);
224 return PxVec2(x * f, y * f);
272 return x * v.
x + y * v.
y;
279 const float m = magnitudeSquared();
288 const float m = magnitude();
347 #endif // #ifndef PXFOUNDATION_PXVEC2_H Definition: GuContactBuffer.h:37
PX_CUDA_CALLABLE PX_FORCE_INLINE float minElement() const
returns MIN(x, y);
Definition: PxVec2.h:313
PX_CUDA_CALLABLE PX_INLINE bool isFinite() const
returns true if all 2 elems of the vector are finite (not NAN or INF, etc.)
Definition: PxVec2.h:154
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2 getNormalized() const
Definition: PxVec2.h:277
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2 & operator/=(float f)
scalar division
Definition: PxVec2.h:259
PX_CUDA_CALLABLE PX_FORCE_INLINE float magnitude() const
returns the magnitude
Definition: PxVec2.h:181
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2 operator/(float f) const
scalar division
Definition: PxVec2.h:221
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2 minimum(const PxVec2 &v) const
element-wise minimum
Definition: PxVec2.h:305
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2 & operator=(const PxVec2 &p)
Assignment operator.
Definition: PxVec2.h:100
PX_CUDA_CALLABLE PX_FORCE_INLINE bool operator!=(const PxVec2 &v) const
returns true if the two vectors are not exactly equal.
Definition: PxVec2.h:138
#define PX_FORCE_INLINE
Definition: PxPreprocessor.h:364
PX_CUDA_CALLABLE PX_FORCE_INLINE bool isZero() const
tests for exact zero vector
Definition: PxVec2.h:146
PX_CUDA_CALLABLE PX_FORCE_INLINE float maxElement() const
returns MAX(x, y);
Definition: PxVec2.h:329
PxZERO
Definition: Px.h:76
PX_CUDA_CALLABLE PX_FORCE_INLINE bool isNormalized() const
is normalized - used by API parameter validation
Definition: PxVec2.h:162
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2(float nx, float ny)
Initializes from 2 scalar parameters.
Definition: PxVec2.h:84
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2 multiply(const PxVec2 &a) const
a[i] * b[i], for all i.
Definition: PxVec2.h:297
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 bool operator==(const PxVec2 &v) const
returns true if the two vectors are exactly equal.
Definition: PxVec2.h:130
static PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2 operator*(float f, const PxVec2 &v)
Definition: PxVec2.h:337
PX_CUDA_CALLABLE PX_FORCE_INLINE float & operator[](int index)
element access
Definition: PxVec2.h:110
PX_CUDA_CALLABLE PX_FORCE_INLINE float PxSqrt(float a)
Square root.
Definition: PxMath.h:144
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2()
default constructor leaves data uninitialized.
Definition: PxVec2.h:55
float y
Definition: PxVec2.h:334
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2 & operator+=(const PxVec2 &v)
vector addition
Definition: PxVec2.h:230
PX_CUDA_CALLABLE PX_FORCE_INLINE float dot(const PxVec2 &v) const
returns the scalar product of this and other.
Definition: PxVec2.h:270
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 PxVec2 & operator*=(float f)
scalar multiplication
Definition: PxVec2.h:250
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2 operator-() const
negation
Definition: PxVec2.h:189
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2(PxZERO r)
zero constructor.
Definition: PxVec2.h:62
PX_CUDA_CALLABLE PX_FORCE_INLINE float PxRecipSqrt(float a)
reciprocal square root.
Definition: PxMath.h:156
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2(float a)
Assigns scalar parameter to all elements.
Definition: PxVec2.h:74
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2 operator*(float f) const
scalar post-multiplication
Definition: PxVec2.h:213
float x
Definition: PxVec2.h:334
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 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 PxVec2 operator+(const PxVec2 &v) const
vector addition
Definition: PxVec2.h:197
PX_CUDA_CALLABLE PX_INLINE void PX_UNUSED(T const &)
Definition: PxPreprocessor.h:479
2 Element vector class.
Definition: PxVec2.h:49
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 PxVec2 & operator-=(const PxVec2 &v)
vector difference
Definition: PxVec2.h:240
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2(const PxVec2 &v)
Copy ctor.
Definition: PxVec2.h:91
#define PX_ASSERT(exp)
Definition: PxAssert.h:61
PX_CUDA_CALLABLE PX_FORCE_INLINE float magnitudeSquared() const
returns the squared magnitude
Definition: PxVec2.h:173
PX_CUDA_CALLABLE PX_FORCE_INLINE float normalize()
normalizes the vector in place
Definition: PxVec2.h:286
#define PX_INLINE
Definition: PxPreprocessor.h:349
#define PX_CUDA_CALLABLE
Definition: PxPreprocessor.h:473
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2 operator-(const PxVec2 &v) const
vector difference
Definition: PxVec2.h:205
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2 maximum(const PxVec2 &v) const
element-wise maximum
Definition: PxVec2.h:321
PX_CUDA_CALLABLE PX_FORCE_INLINE const float & operator[](int index) const
element access
Definition: PxVec2.h:120