PxVec3T

Defined in include/foundation/PxVec3.h

template<class Type>
class PxVec3T

3 Element vector class.

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

Public Functions

inline PxVec3T()

default constructor leaves data uninitialized.

inline PxVec3T(PxZERO)

zero constructor.

inline explicit PxVec3T(Type a)

Assigns scalar parameter to all elements.

Useful to initialize to zero or one.

Parameters

a[in] Value to assign to elements.

inline PxVec3T(Type nx, Type ny, Type nz)

Initializes from 3 scalar parameters.

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

  • ny[in] Value to initialize Y component.

  • nz[in] Value to initialize Z component.

inline PxVec3T(const PxVec3T &v)

Copy ctor.

inline PxVec3T &operator=(const PxVec3T &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 PxVec3T &v) const

returns true if the two vectors are exactly equal.

inline bool operator!=(const PxVec3T &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 3 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 PxVec3T operator-() const

negation

inline PxVec3T operator+(const PxVec3T &v) const

vector addition

inline PxVec3T operator-(const PxVec3T &v) const

vector difference

inline PxVec3T operator*(Type f) const

scalar post-multiplication

inline PxVec3T operator/(Type f) const

scalar division

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

vector addition

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

vector difference

inline PxVec3T &operator*=(Type f)

scalar multiplication

inline PxVec3T &operator/=(Type f)

scalar division

inline Type dot(const PxVec3T &v) const

returns the scalar product of this and other.

inline PxVec3T cross(const PxVec3T &v) const

cross product

inline PxVec3T getNormalized() const

returns a unit vector

inline Type normalize()

normalizes the vector in place

inline Type 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.

inline Type normalizeFast()

normalizes the vector in place.

Asserts if vector magnitude is under PX_NORMALIZATION_EPSILON. returns vector magnitude.

inline PxVec3T multiply(const PxVec3T &a) const

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

inline PxVec3T minimum(const PxVec3T &v) const

element-wise minimum

inline Type minElement() const

returns MIN(x, y, z);

inline PxVec3T maximum(const PxVec3T &v) const

element-wise maximum

inline Type maxElement() const

returns MAX(x, y, z);

inline PxVec3T abs() const

returns absolute values of components;

Public Members

Type x
Type y
Type z