30 #ifndef PXFOUNDATION_PXMAT33_H 31 #define PXFOUNDATION_PXMAT33_H 100 : column0(1.0f, 0.0f, 0.0f), column1(0.0f, 1.0f, 0.0f), column2(0.0f, 0.0f, 1.0f)
113 : column0(col0), column1(col1), column2(col2)
119 : column0(r, 0.0f, 0.0f), column1(0.0f, r, 0.0f), column2(0.0f, 0.0f, r)
125 : column0(values[0], values[1], values[2])
126 , column1(values[3], values[4], values[5])
127 , column2(values[6], values[7], values[8])
139 const float x2 = x + x;
140 const float y2 = y + y;
141 const float z2 = z + z;
143 const float xx = x2 * x;
144 const float yy = y2 * y;
145 const float zz = z2 * z;
147 const float xy = x2 * y;
148 const float xz = x2 * z;
149 const float xw = x2 * w;
151 const float yz = y2 * z;
152 const float yw = y2 * w;
153 const float zw = z2 * w;
155 column0 =
PxVec3(1.0f - yy - zz, xy + zw, xz - yw);
156 column1 =
PxVec3(xy - zw, 1.0f - xx - zz, yz + xw);
157 column2 =
PxVec3(xz + yw, yz - xw, 1.0f - xx - yy);
162 : column0(other.column0), column1(other.column1), column2(other.column2)
192 const PxVec3 v0(column0.x, column1.x, column2.x);
193 const PxVec3 v1(column0.y, column1.y, column2.y);
194 const PxVec3 v2(column0.z, column1.z, column2.z);
202 const float det = getDeterminant();
207 const float invDet = 1.0f / det;
209 inverse.
column0.
x = invDet * (column1.y * column2.z - column2.y * column1.z);
210 inverse.
column0.
y = invDet * -(column0.y * column2.z - column2.y * column0.z);
211 inverse.
column0.
z = invDet * (column0.y * column1.z - column0.z * column1.y);
213 inverse.
column1.
x = invDet * -(column1.x * column2.z - column1.z * column2.x);
214 inverse.
column1.
y = invDet * (column0.x * column2.z - column0.z * column2.x);
215 inverse.
column1.
z = invDet * -(column0.x * column1.z - column0.z * column1.x);
217 inverse.
column2.
x = invDet * (column1.x * column2.y - column1.y * column2.x);
218 inverse.
column2.
y = invDet * -(column0.x * column2.y - column0.y * column2.x);
219 inverse.
column2.
z = invDet * (column0.x * column1.y - column1.x * column0.y);
232 return column0.dot(column1.cross(column2));
238 return PxMat33(-column0, -column1, -column2);
256 return PxMat33(column0 * scalar, column1 * scalar, column2 * scalar);
264 return transform(vec);
307 *
this = *
this * other;
314 return (*
this)[col][row];
320 return (*
this)[col][row];
328 return column0 * other.
x + column1 * other.
y + column2 * other.
z;
334 return PxVec3(column0.dot(other), column1.dot(other), column2.dot(other));
344 return (&column0)[num];
348 return (&column0)[num];
396 #endif // #ifndef PXFOUNDATION_PXMAT33_H Definition: GuContactBuffer.h:37
PX_CUDA_CALLABLE PX_INLINE PxMat33(PxZERO r)
zero constructor
Definition: PxMat33.h:106
PX_CUDA_CALLABLE PX_INLINE bool operator==(const PxMat33 &m) const
returns true if the two matrices are exactly equal
Definition: PxMat33.h:184
PX_CUDA_CALLABLE PX_INLINE PxMat33 & operator-=(const PxMat33 &other)
Equals-sub.
Definition: PxMat33.h:287
PX_CUDA_CALLABLE PX_INLINE const PxMat33 operator-() const
Unary minus.
Definition: PxMat33.h:236
PX_CUDA_CALLABLE PX_INLINE PxMat33(PxIDENTITY r)
identity constructor
Definition: PxMat33.h:99
#define PX_FORCE_INLINE
Definition: PxPreprocessor.h:351
This is a quaternion class. For more information on quaternion mathematics consult a mathematics sour...
Definition: PxQuat.h:49
PxZERO
Definition: Px.h:76
PX_CUDA_CALLABLE PX_INLINE const PxMat33 operator-(const PxMat33 &other) const
Subtract.
Definition: PxMat33.h:248
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 & operator[](unsigned int num)
Definition: PxMat33.h:342
PX_CUDA_CALLABLE PX_INLINE PxMat33 & operator*=(const PxMat33 &other)
Equals matrix multiplication.
Definition: PxMat33.h:305
float z
Definition: PxQuat.h:395
PX_CUDA_CALLABLE PX_INLINE PxMat33(const PxMat33 &other)
Copy constructor.
Definition: PxMat33.h:161
static PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2 operator*(float f, const PxVec2 &v)
Definition: PxVec2.h:337
PX_CUDA_CALLABLE PX_FORCE_INLINE float PxSqrt(float a)
Square root.
Definition: PxMath.h:144
PX_CUDA_CALLABLE PX_INLINE const PxVec3 transformTranspose(const PxVec3 &other) const
Transform vector by matrix transpose, v' = M^t*v.
Definition: PxMat33.h:332
PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat33 & operator=(const PxMat33 &other)
Assignment operator.
Definition: PxMat33.h:167
PX_CUDA_CALLABLE static PX_INLINE const PxMat33 createDiagonal(const PxVec3 &d)
Construct from diagonal, off-diagonals are zero.
Definition: PxMat33.h:176
float y
Definition: PxVec3.h:381
PX_CUDA_CALLABLE PX_INLINE PxMat33(float values[])
Construct from float[9].
Definition: PxMat33.h:124
PX_CUDA_CALLABLE PX_INLINE const PxMat33 operator+(const PxMat33 &other) const
Add.
Definition: PxMat33.h:242
float w
Definition: PxQuat.h:395
PX_CUDA_CALLABLE PX_FORCE_INLINE float operator()(unsigned int row, unsigned int col) const
Element access, mathematical way!
Definition: PxMat33.h:312
float x
Definition: PxQuat.h:395
PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec3 transform(const PxVec3 &other) const
Transform vector by matrix, equal to v' = M*v.
Definition: PxMat33.h:326
PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat()
Default constructor, does not do any initialization.
Definition: PxQuat.h:55
PxVec3 column2
Definition: PxMat33.h:353
PX_CUDA_CALLABLE PX_FORCE_INLINE const PxMat33 operator*(const PxMat33 &other) const
Matrix multiplication.
Definition: PxMat33.h:270
3x3 matrix class
Definition: PxMat33.h:90
PX_CUDA_CALLABLE PX_INLINE PxMat33 & operator*=(float scalar)
Equals scalar multiplication.
Definition: PxMat33.h:296
PX_CUDA_CALLABLE PX_INLINE void PX_UNUSED(T const &)
Definition: PxPreprocessor.h:466
PX_CUDA_CALLABLE PX_INLINE const PxMat33 getInverse() const
Get the real inverse.
Definition: PxMat33.h:200
PxVec3 column0
Definition: PxMat33.h:353
PX_CUDA_CALLABLE PxMat33(const PxVec3 &col0, const PxVec3 &col1, const PxVec3 &col2)
Construct from three base vectors.
Definition: PxMat33.h:112
PX_CUDA_CALLABLE PX_INLINE const PxVec3 operator*(const PxVec3 &vec) const
Matrix vector multiplication (returns 'this->transform(vec)')
Definition: PxMat33.h:262
float y
Definition: PxQuat.h:395
PxIDENTITY
Definition: Px.h:82
PX_CUDA_CALLABLE PX_FORCE_INLINE float & operator()(unsigned int row, unsigned int col)
Element access, mathematical way!
Definition: PxMat33.h:318
PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat33(const PxQuat &q)
Construct from a quaternion.
Definition: PxMat33.h:132
PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat33()
Default constructor.
Definition: PxMat33.h:94
PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec3 & operator[](unsigned int num) const
Definition: PxMat33.h:346
PX_CUDA_CALLABLE PX_INLINE float getDeterminant() const
Get determinant.
Definition: PxMat33.h:230
PX_CUDA_CALLABLE PX_INLINE const PxMat33 operator*(float scalar) const
Scalar multiplication.
Definition: PxMat33.h:254
PX_CUDA_CALLABLE PX_FORCE_INLINE const PxMat33 getTranspose() const
Get transposed matrix.
Definition: PxMat33.h:190
float z
Definition: PxVec3.h:381
PxVec3 column1
Definition: PxMat33.h:353
PX_CUDA_CALLABLE PX_INLINE PxMat33(float r)
constructor from a scalar, which generates a multiple of the identity matrix
Definition: PxMat33.h:118
#define PX_INLINE
Definition: PxPreprocessor.h:336
#define PX_CUDA_CALLABLE
Definition: PxPreprocessor.h:460
PX_CUDA_CALLABLE PX_INLINE PxMat33 & operator+=(const PxMat33 &other)
Equals-add.
Definition: PxMat33.h:278
3 Element vector class.
Definition: PxVec3.h:49
PX_CUDA_CALLABLE PX_FORCE_INLINE const float * front() const
Definition: PxMat33.h:337
float x
Definition: PxVec3.h:381