32#include "foundation/PxBounds3.h"
33#include "foundation/PxMat33.h"
34#include "foundation/PxMathUtils.h"
35#include "foundation/PxMat34.h"
36#include "foundation/PxSIMDHelpers.h"
37#include "geometry/PxMeshScale.h"
47 const PxMat33Padded rot(meshScale.rotation);
49 PxMat33 trans = rot.getTranspose();
50 trans.column0 *= meshScale.scale[0];
51 trans.column1 *= meshScale.scale[1];
52 trans.column2 *= meshScale.scale[2];
66 vertex2ShapeSkew =
PxMat33(PxIdentity);
67 shape2VertexSkew =
PxMat33(PxIdentity);
78 init(scale, rotation);
83 init(scale.scale, scale.rotation);
88 vertex2ShapeSkew =
PxMat33(PxIdentity);
89 shape2VertexSkew =
PxMat33(PxIdentity);
102 vertex2ShapeSkew = vertex2ShapeSkew * diagonal;
103 vertex2ShapeSkew = vertex2ShapeSkew * R;
114 shape2VertexSkew = vertex2ShapeSkew.
getInverse();
116 mFlipNormal = ((scale.x * scale.y * scale.z) < 0.0f);
123 PxVec3 tmp = v1; v1 = v2; v2 = tmp;
129 return vertex2ShapeSkew * src;
134 return shape2VertexSkew * src;
139 return vertex2ShapeSkew;
144 return shape2VertexSkew;
149 const PxMat34 vertex2worldSkew = shape2world * getVertex2ShapeSkew();
152 return vertex2worldSkew;
160 const PxMat33 rotate( shape2world[0], shape2world[1], shape2world[2] );
162 return PxMat34(M[0], M[1], M[2], -M * shape2world[3]);
168 basis.column0 = shape2VertexSkew * (basis.column0 * extents.x);
169 basis.column1 = shape2VertexSkew * (basis.column1 * extents.y);
170 basis.column2 = shape2VertexSkew * (basis.column2 * extents.z);
172 center = shape2VertexSkew * center;
176 void transformPlaneToShapeSpace(
const PxVec3& nIn,
const PxReal dIn,
PxVec3& nOut, PxReal& dOut)
const
179 const PxReal denom = 1.0f / tmp.
magnitude();
187 PxMat33 vertex2ShapeSkew;
188 PxMat33 shape2VertexSkew;
192 PX_FORCE_INLINE void getScaledVertices(PxVec3* v,
const PxVec3& v0,
const PxVec3& v1,
const PxVec3& v2,
bool idtMeshScale,
const Cm::FastVertex2ShapeScaling& scaling)
202 const PxI32 winding = scaling.flipsNormal() ? 1 : 0;
204 v[1+winding] = scaling * v1;
205 v[2-winding] = scaling * v2;
212PX_INLINE PxMat34 operator*(
const PxTransform& transform,
const PxMeshScale& scale)
216 return PxMat34(tmp * Cm::toMat33(scale),
transform.p);
219PX_INLINE PxMat34 operator*(
const PxMeshScale& scale,
const PxTransform& transform)
221 const PxMat33 scaleMat = Cm::toMat33(scale);
223 const PxMat33 r = scaleMat * t;
225 return PxMat34(r, p);
228PX_INLINE PxMat34 operator*(
const PxMat34& transform,
const PxMeshScale& scale)
233PX_INLINE PxMat34 operator*(
const PxMeshScale& scale,
const PxMat34& transform)
235 const PxMat33 scaleMat = Cm::toMat33(scale);
Definition CmScaling.h:61
void transformQueryBounds(PxVec3 ¢er, PxVec3 &extents, PxMat33 &basis) const
Transforms a shape space OBB to a vertex space OBB. All 3 params are in and out.
Definition CmScaling.h:166
A padded version of PxMat33, to safely load its data using SIMD.
Definition PxSIMDHelpers.h:41
PX_CUDA_CALLABLE static PX_INLINE const PxMat33T createDiagonal(const PxVec3T< float > &d)
Construct from diagonal, off-diagonals are zero.
Definition PxMat33.h:186
3x3 matrix class
Definition PxMat33.h:91
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 const PxMat33 getTranspose() const
Get transposed matrix.
Definition PxMat33.h:190
PX_CUDA_CALLABLE PX_INLINE const PxMat33 getInverse() const
Get the real inverse.
Definition PxMat33.h:200
A class expressing a nonuniform scaling transformation.
Definition PxMeshScale.h:69
This is a quaternion class. For more information on quaternion mathematics consult a mathematics sour...
Definition PxQuat.h:50
3 Element vector class.
Definition PxVec3.h:50
PX_CUDA_CALLABLE PX_FORCE_INLINE float magnitude() const
returns the magnitude
Definition PxVec3.h:183
#define PX_FORCE_INLINE
Definition PxPreprocessor.h:335
#define PX_INLINE
Definition PxPreprocessor.h:320
transform(pattern)
Definition docopt.py:72
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
PX_INLINE void rotate(const Gu::Box &src, const PxMat34 &mtx, Gu::Box &obb)
recomputes the OBB after an arbitrary transform by a 4x4 matrix.
Definition GuBoxConversion.h:100
PX_FOUNDATION_API PxVec3 PxOptimizeBoundingBox(PxMat33 &basis)
computes a oriented bounding box around the scaled basis.
Definition FdMathUtils.cpp:140