36#include "foundation/PxMath.h"
111 PX_ASSERT(index <= 1);
112 return reinterpret_cast<Type*
>(
this)[index];
120 PX_ASSERT(index <= 1);
121 return reinterpret_cast<const Type*
>(
this)[index];
129 return x == v.x && y == v.y;
137 return x != v.x || y != v.y;
145 return x == Type(0.0) && y == Type(0.0);
161 const Type unitTolerance = Type(1e-4);
172 return x * x + y * y;
196 return PxVec2T(x + v.x, y + v.y);
204 return PxVec2T(x - v.x, y - v.y);
270 return x * v.x + y * v.y;
296 return PxVec2T(x * a.x, y * a.y);
335PX_CUDA_CALLABLE
static PX_FORCE_INLINE PxVec2T<Type> operator*(Type f,
const PxVec2T<Type>& v)
337 return PxVec2T<Type>(f * v.x, f * v.y);
340typedef PxVec2T<float> PxVec2;
341typedef PxVec2T<double> PxVec2d;
2 Element vector class.
Definition PxVec2.h:50
PX_CUDA_CALLABLE PX_FORCE_INLINE Type magnitude() const
returns the magnitude
Definition PxVec2.h:178
PX_CUDA_CALLABLE PX_FORCE_INLINE bool isNormalized() const
is normalized - used by API parameter validation
Definition PxVec2.h:159
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T multiply(const PxVec2T &a) const
a[i] * b[i], for all i.
Definition PxVec2.h:294
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T(const PxVec2T &v)
Copy ctor.
Definition PxVec2.h:90
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T getNormalized() const
Definition PxVec2.h:274
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T operator/(Type f) const
scalar division
Definition PxVec2.h:218
PX_CUDA_CALLABLE PX_FORCE_INLINE Type normalize()
normalizes the vector in place
Definition PxVec2.h:283
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T & operator-=(const PxVec2T &v)
vector difference
Definition PxVec2.h:237
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T(Type a)
Assigns scalar parameter to all elements.
Definition PxVec2.h:73
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T operator-(const PxVec2T &v) const
vector difference
Definition PxVec2.h:202
PX_CUDA_CALLABLE PX_FORCE_INLINE Type maxElement() const
returns MAX(x, y);
Definition PxVec2.h:326
PX_CUDA_CALLABLE PX_FORCE_INLINE Type & operator[](unsigned int index)
element access
Definition PxVec2.h:109
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T & operator=(const PxVec2T &p)
Assignment operator.
Definition PxVec2.h:99
PX_CUDA_CALLABLE PX_FORCE_INLINE bool isZero() const
tests for exact zero vector
Definition PxVec2.h:143
PX_CUDA_CALLABLE PX_FORCE_INLINE Type magnitudeSquared() const
returns the squared magnitude
Definition PxVec2.h:170
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T maximum(const PxVec2T &v) const
element-wise maximum
Definition PxVec2.h:318
PX_CUDA_CALLABLE PX_FORCE_INLINE Type dot(const PxVec2T &v) const
returns the scalar product of this and other.
Definition PxVec2.h:268
PX_CUDA_CALLABLE PX_FORCE_INLINE bool operator==(const PxVec2T &v) const
returns true if the two vectors are exactly equal.
Definition PxVec2.h:127
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T operator+(const PxVec2T &v) const
vector addition
Definition PxVec2.h:194
PX_CUDA_CALLABLE PX_FORCE_INLINE const Type & operator[](unsigned int index) const
element access
Definition PxVec2.h:118
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T operator*(Type f) const
scalar post-multiplication
Definition PxVec2.h:210
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T & operator*=(Type f)
scalar multiplication
Definition PxVec2.h:247
PX_CUDA_CALLABLE PX_FORCE_INLINE bool operator!=(const PxVec2T &v) const
returns true if the two vectors are not exactly equal.
Definition PxVec2.h:135
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T & operator/=(Type f)
scalar division
Definition PxVec2.h:257
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T minimum(const PxVec2T &v) const
element-wise minimum
Definition PxVec2.h:302
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T(PxZERO)
zero constructor.
Definition PxVec2.h:62
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:151
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T operator-() const
negation
Definition PxVec2.h:186
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T & operator+=(const PxVec2T &v)
vector addition
Definition PxVec2.h:227
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T(Type nx, Type ny)
Initializes from 2 scalar parameters.
Definition PxVec2.h:83
PX_CUDA_CALLABLE PX_FORCE_INLINE Type minElement() const
returns MIN(x, y);
Definition PxVec2.h:310
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2T()
default constructor leaves data uninitialized.
Definition PxVec2.h:55
#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