PxVec4T

Defined in include/foundation/Px.h

template<class Type>
class PxVec4T

4 Element vector class.

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

Public Functions

inline PxVec4T()

default constructor leaves data uninitialized.

inline PxVec4T(PxZERO)

zero constructor.

inline explicit PxVec4T(Type a)

Assigns scalar parameter to all elements.

Useful to initialize to zero or one.

Parameters

a[in] Value to assign to elements.

inline PxVec4T(Type nx, Type ny, Type nz, Type nw)

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.

  • nw[in] Value to initialize W component.

inline PxVec4T(const PxVec3T<Type> &v, Type nw)

Initializes from 3 scalar parameters.

Parameters
  • v[in] Value to initialize the X, Y, and Z components.

  • nw[in] Value to initialize W component.

inline explicit PxVec4T(const Type v[])

Initializes from an array of scalar parameters.

Parameters

v[in] Value to initialize with.

inline PxVec4T(const PxVec4T &v)

Copy ctor.

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

returns true if the two vectors are exactly equal.

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

negation

inline PxVec4T operator+(const PxVec4T &v) const

vector addition

inline PxVec4T operator-(const PxVec4T &v) const

vector difference

inline PxVec4T operator*(Type f) const

scalar post-multiplication

inline PxVec4T operator/(Type f) const

scalar division

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

vector addition

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

vector difference

inline PxVec4T &operator*=(Type f)

scalar multiplication

inline PxVec4T &operator/=(Type f)

scalar division

inline Type dot(const PxVec4T &v) const

returns the scalar product of this and other.

inline PxVec4T getNormalized() const

returns a unit vector

inline Type normalize()

normalizes the vector in place

inline PxVec4T multiply(const PxVec4T &a) const

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

inline PxVec4T minimum(const PxVec4T &v) const

element-wise minimum

inline PxVec4T maximum(const PxVec4T &v) const

element-wise maximum

inline PxVec3T<Type> getXYZ() const

Public Members

Type x
Type y
Type z
Type w