35#include "foundation/PxQuat.h"
36#include "foundation/PxVec4.h"
37#include "foundation/PxMat33.h"
38#include "foundation/PxTransform.h"
64 column0(Type(1.0), Type(0.0), Type(0.0), Type(0.0)),
65 column1(Type(0.0), Type(1.0), Type(0.0), Type(0.0)),
66 column2(Type(0.0), Type(0.0), Type(1.0), Type(0.0)),
67 column3(Type(0.0), Type(0.0), Type(0.0), Type(1.0))
87 column0(r, Type(0.0), Type(0.0), Type(0.0)),
88 column1(Type(0.0), r, Type(0.0), Type(0.0)),
89 column2(Type(0.0), Type(0.0), r, Type(0.0)),
90 column3(Type(0.0), Type(0.0), Type(0.0), r)
96 column0(col0, Type(0.0)),
97 column1(col1, Type(0.0)),
98 column2(col2, Type(0.0)),
99 column3(col3, Type(1.0))
105 column0(values[0], values[1], values[2], values[3]),
106 column1(values[4], values[5], values[6], values[7]),
107 column2(values[8], values[9], values[10], values[11]),
108 column3(values[12], values[13], values[14], values[15])
121 const Type x2 = x + x;
122 const Type y2 = y + y;
123 const Type z2 = z + z;
125 const Type xx = x2 * x;
126 const Type yy = y2 * y;
127 const Type zz = z2 * z;
129 const Type xy = x2 * y;
130 const Type xz = x2 * z;
131 const Type xw = x2 * w;
133 const Type yz = y2 * z;
134 const Type yw = y2 * w;
135 const Type zw = z2 * w;
137 column0 =
PxVec4T<Type>(Type(1.0) - yy - zz, xy + zw, xz - yw, Type(0.0));
138 column1 =
PxVec4T<Type>(xy - zw, Type(1.0) - xx - zz, yz + xw, Type(0.0));
139 column2 =
PxVec4T<Type>(xz + yw, yz - xw, Type(1.0) - xx - yy, Type(0.0));
140 column3 =
PxVec4T<Type>(Type(0.0), Type(0.0), Type(0.0), Type(1.0));
145 column0(diagonal.x, Type(0.0), Type(0.0), Type(0.0)),
146 column1(Type(0.0), diagonal.y, Type(0.0), Type(0.0)),
147 column2(Type(0.0), Type(0.0), diagonal.z, Type(0.0)),
148 column3(Type(0.0), Type(0.0), Type(0.0), diagonal.w)
154 column0(axes.column0, Type(0.0)),
155 column1(axes.column1, Type(0.0)),
156 column2(axes.column2, Type(0.0)),
157 column3(position, Type(1.0))
171 return column0 == m.column0 && column1 == m.column1 && column2 == m.column2 && column3 == m.column3;
176 column0(other.column0),
177 column1(other.column1),
178 column2(other.column2),
179 column3(other.column3)
186 column0 = other.column0;
187 column1 = other.column1;
188 column2 = other.column2;
189 column3 = other.column3;
204 return PxMat44T(-column0, -column1, -column2, -column3);
210 return PxMat44T(column0 + other.column0, column1 + other.column1, column2 + other.column2, column3 + other.column3);
216 return PxMat44T(column0 - other.column0, column1 - other.column1, column2 - other.column2, column3 - other.column3);
222 return PxMat44T(column0 * scalar, column1 * scalar, column2 * scalar, column3 * scalar);
225 template<
class Type2>
241 column0 += other.column0;
242 column1 += other.column1;
243 column2 += other.column2;
244 column3 += other.column3;
251 column0 -= other.column0;
252 column1 -= other.column1;
253 column2 -= other.column2;
254 column3 -= other.column3;
271 *
this = *
this * other;
278 return (*
this)[col][row];
284 return (*
this)[col][row];
290 return column0 * other.x + column1 * other.y + column2 * other.z + column3 * other.w;
302 return column0 * other.x + column1 * other.y + column2 * other.z;
314 return (&column0)[num].getXYZ();
317 PX_CUDA_CALLABLE
PX_INLINE const PxVec3T<Type> getPosition()
const
319 return column3.getXYZ();
322 PX_CUDA_CALLABLE
PX_INLINE void setPosition(
const PxVec3T<Type>& position)
324 column3.x = position.x;
325 column3.y = position.y;
326 column3.z = position.z;
336 return (&column0)[num];
338 PX_CUDA_CALLABLE
PX_FORCE_INLINE const PxVec4T<Type>& operator[](PxU32 num)
const
340 return (&column0)[num];
343 PX_CUDA_CALLABLE
PX_INLINE void scale(
const PxVec4T<Type>& p)
353 const PxVec3T<Type> r0(column0.x, column1.x, column2.x);
354 const PxVec3T<Type> r1(column0.y, column1.y, column2.y);
355 const PxVec3T<Type> r2(column0.z, column1.z, column2.z);
357 return PxMat44T(r0, r1, r2, -(r0 * column3.x + r1 * column3.y + r2 * column3.z));
360 PX_CUDA_CALLABLE
PX_INLINE bool isFinite()
const
362 return column0.isFinite() && column1.isFinite() && column2.isFinite() && column3.isFinite();
367 PxVec4T<Type> column0, column1, column2, column3;
372PX_CUDA_CALLABLE
PX_FORCE_INLINE PxTransformT<Type>::PxTransformT(
const PxMat44T<Type>& m)
374 const PxVec3T<Type> column0(m.column0.x, m.column0.y, m.column0.z);
375 const PxVec3T<Type> column1(m.column1.x, m.column1.y, m.column1.z);
376 const PxVec3T<Type> column2(m.column2.x, m.column2.y, m.column2.z);
378 q = PxQuatT<Type>(PxMat33T<Type>(column0, column1, column2));
379 p = PxVec3T<Type>(m.column3.x, m.column3.y, m.column3.z);
382typedef PxMat44T<float> PxMat44;
383typedef PxMat44T<double> PxMat44d;
3x3 matrix class
Definition PxMat33.h:91
4x4 matrix class
Definition PxMat44.h:55
PX_CUDA_CALLABLE PX_INLINE const PxVec3T< Type > transform(const PxVec3T< Type > &other) const
Transform vector by matrix, equal to v' = M*v.
Definition PxMat44.h:294
PX_CUDA_CALLABLE PX_INLINE PxMat44T(const PxQuatT< Type > &q)
Construct from a quaternion.
Definition PxMat44.h:113
PX_CUDA_CALLABLE PX_INLINE PxMat44T(const PxVec4T< Type > &diagonal)
Construct from a diagonal vector.
Definition PxMat44.h:144
PX_CUDA_CALLABLE PX_INLINE PxMat44T(Type r)
constructor that generates a multiple of the identity matrix
Definition PxMat44.h:86
PX_CUDA_CALLABLE PxMat44T(const PxVec3T< Type > &col0, const PxVec3T< Type > &col1, const PxVec3T< Type > &col2, const PxVec3T< Type > &col3)
Construct from three base vectors and a translation.
Definition PxMat44.h:95
PX_CUDA_CALLABLE PX_INLINE PxMat44T(const PxMat44T &other)
Copy constructor.
Definition PxMat44.h:175
PX_CUDA_CALLABLE PX_INLINE const PxVec4T< Type > rotate(const PxVec4T< Type > &other) const
Rotate vector by matrix, equal to v' = M*v.
Definition PxMat44.h:300
PX_CUDA_CALLABLE PX_INLINE bool operator==(const PxMat44T &m) const
returns true if the two matrices are exactly equal
Definition PxMat44.h:169
PX_CUDA_CALLABLE PX_INLINE const PxMat44T getTranspose() const
Get transposed matrix.
Definition PxMat44.h:194
PX_CUDA_CALLABLE PX_INLINE const PxMat44T operator*(Type scalar) const
Scalar multiplication.
Definition PxMat44.h:220
PX_CUDA_CALLABLE PX_INLINE const PxMat44T operator+(const PxMat44T &other) const
Add.
Definition PxMat44.h:208
PX_CUDA_CALLABLE PX_INLINE const PxMat44T operator-(const PxMat44T &other) const
Subtract.
Definition PxMat44.h:214
PX_CUDA_CALLABLE PX_FORCE_INLINE Type & operator()(PxU32 row, PxU32 col)
Element access, mathematical way!
Definition PxMat44.h:282
PX_CUDA_CALLABLE PX_INLINE PxMat44T & operator-=(const PxMat44T &other)
Equals-sub.
Definition PxMat44.h:249
PX_CUDA_CALLABLE PX_INLINE PxMat44T & operator+=(const PxMat44T &other)
Equals-add.
Definition PxMat44.h:239
PX_CUDA_CALLABLE PxMat44T(const PxMat33T< Type > &axes, const PxVec3T< Type > &position)
Construct from Mat33 and a translation.
Definition PxMat44.h:153
PX_CUDA_CALLABLE PX_INLINE const PxMat44T operator-() const
Unary minus.
Definition PxMat44.h:202
PX_CUDA_CALLABLE PX_INLINE PxMat44T(Type values[])
Construct from Type[16].
Definition PxMat44.h:104
PX_CUDA_CALLABLE PX_FORCE_INLINE Type operator()(PxU32 row, PxU32 col) const
Element access, mathematical way!
Definition PxMat44.h:276
PX_CUDA_CALLABLE PX_INLINE const PxMat44T operator*(const PxMat44T &other) const
Matrix multiplication.
Definition PxMat44.h:229
PX_CUDA_CALLABLE PX_INLINE PxMat44T & operator=(const PxMat44T &other)
Assignment operator.
Definition PxMat44.h:184
PX_CUDA_CALLABLE PX_INLINE PxMat44T & operator*=(Type scalar)
Equals scalar multiplication.
Definition PxMat44.h:259
PX_CUDA_CALLABLE PX_INLINE PxMat44T(PxZERO)
zero constructor
Definition PxMat44.h:72
PX_CUDA_CALLABLE PX_INLINE const PxVec3T< Type > rotate(const PxVec3T< Type > &other) const
Rotate vector by matrix, equal to v' = M*v.
Definition PxMat44.h:306
PX_CUDA_CALLABLE PX_INLINE const PxVec4T< Type > transform(const PxVec4T< Type > &other) const
Transform vector by matrix, equal to v' = M*v.
Definition PxMat44.h:288
PX_CUDA_CALLABLE PX_INLINE PxMat44T(PxIDENTITY)
identity constructor
Definition PxMat44.h:63
PX_CUDA_CALLABLE PxMat44T(const PxVec4T< Type > &col0, const PxVec4T< Type > &col1, const PxVec4T< Type > &col2, const PxVec4T< Type > &col3)
Construct from four 4-vectors.
Definition PxMat44.h:77
PX_CUDA_CALLABLE PX_INLINE PxMat44T & operator*=(const PxMat44T &other)
Equals matrix multiplication.
Definition PxMat44.h:269
PX_CUDA_CALLABLE PX_INLINE PxMat44T()
Default constructor.
Definition PxMat44.h:58
This is a quaternion class. For more information on quaternion mathematics consult a mathematics sour...
Definition PxQuat.h:49
Type x
Definition PxQuat.h:394
3 Element vector class.
Definition PxVec3.h:50
#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
PxIDENTITY
Definition Px.h:99