PxVec2T

Defined in include/foundation/PxVec2.h

template<class Type>
class PxVec2T

2 Element vector class.

This is a 2-dimensional vector class with public data members.

Public Functions

inline PxVec2T()

default constructor leaves data uninitialized.

inline PxVec2T(PxZERO)

zero constructor.

inline explicit PxVec2T(Type a)

Assigns scalar parameter to all elements.

Useful to initialize to zero or one.

Parameters

a[in] Value to assign to elements.

inline PxVec2T(Type nx, Type ny)

Initializes from 2 scalar parameters.

Parameters
  • nx[in] Value to initialize X component.

  • ny[in] Value to initialize Y component.

inline PxVec2T(const PxVec2T &v)

Copy ctor.

inline PxVec2T &operator=(const PxVec2T &p)

Assignment operator.

inline Type &operator[](unsigned int index)

element access

inline const Type &operator[](unsigned int index) const

element access

inline bool operator==(const PxVec2T &v) const

returns true if the two vectors are exactly equal.

inline bool operator!=(const PxVec2T &v) const

returns true if the two vectors are not exactly equal.

inline bool isZero() const

tests for exact zero vector

inline bool isFinite() const

returns true if all 2 elems of the vector are finite (not NAN or INF, etc.)

inline bool isNormalized() const

is normalized - used by API parameter validation

inline Type magnitudeSquared() const

returns the squared magnitude

Avoids calling PxSqrt()!

inline Type magnitude() const

returns the magnitude

inline PxVec2T operator-() const

negation

inline PxVec2T operator+(const PxVec2T &v) const

vector addition

inline PxVec2T operator-(const PxVec2T &v) const

vector difference

inline PxVec2T operator*(Type f) const

scalar post-multiplication

inline PxVec2T operator/(Type f) const

scalar division

inline PxVec2T &operator+=(const PxVec2T &v)

vector addition

inline PxVec2T &operator-=(const PxVec2T &v)

vector difference

inline PxVec2T &operator*=(Type f)

scalar multiplication

inline PxVec2T &operator/=(Type f)

scalar division

inline Type dot(const PxVec2T &v) const

returns the scalar product of this and other.

inline PxVec2T getNormalized() const

returns a unit vector

inline Type normalize()

normalizes the vector in place

inline PxVec2T multiply(const PxVec2T &a) const

a[i] * b[i], for all i.

inline PxVec2T minimum(const PxVec2T &v) const

element-wise minimum

inline Type minElement() const

returns MIN(x, y);

inline PxVec2T maximum(const PxVec2T &v) const

element-wise maximum

inline Type maxElement() const

returns MAX(x, y);

Public Members

Type x
Type y