29#ifndef GU_BOX_CONVERSION_H
30#define GU_BOX_CONVERSION_H
33#include "foundation/PxMathUtils.h"
34#include "foundation/PxMat34.h"
35#include "foundation/PxVecMath.h"
43 const QuatV qV = V4LoadU(&q.x);
44 Vec3V column0, column1, column2;
45 QuatGetMat33V(qV, column0, column1, column2);
47 V4StoreU(Vec4V_From_Vec3V(column0), &dst.rot.column0.x);
48 V4StoreU(Vec4V_From_Vec3V(column1), &dst.rot.column1.x);
49 V4StoreU(Vec4V_From_Vec3V(column2), &dst.rot.column2.x);
52 PX_FORCE_INLINE void buildFrom(Gu::Box& dst,
const PxVec3& center,
const PxVec3& extents,
const PxQuat& q)
58 dst.extents = extents;
61 PX_FORCE_INLINE void buildMatrixFromBox(PxMat34& mat34,
const Gu::Box& box)
72 PxMat33& obbBasis = ret.rot;
74 obbBasis.column0 = transfo.rotate(box.rot.column0 * box.extents.x);
75 obbBasis.column1 = transfo.rotate(box.rot.column1 * box.extents.y);
76 obbBasis.column2 = transfo.rotate(box.rot.column2 * box.extents.z);
78 ret.center = transfo.transform(box.center);
83 PX_INLINE Gu::Box transformBoxOrthonormal(
const Gu::Box& box,
const PxTransform& t)
86 PxMat33& obbBasis = ret.rot;
87 obbBasis.column0 = t.rotate(box.rot.column0);
88 obbBasis.column1 = t.rotate(box.rot.column1);
89 obbBasis.column2 = t.rotate(box.rot.column2);
90 ret.center = t.transform(box.center);
91 ret.extents = box.extents;
103 obb.extents = src.extents;
107 obb.rot = mtx.m * src.rot;
111 PX_FORCE_INLINE void getInverse(PxMat33& dstRot, PxVec3& dstTrans,
const PxMat33& srcRot,
const PxVec3& srcTrans)
Represents an oriented bounding box.
Definition GuBox.h:72
PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec3T< Type > transform(const PxVec3T< Type > &other) const
Transform vector by matrix, equal to v' = M*v.
Definition PxMat33.h:347
PX_CUDA_CALLABLE PX_INLINE const PxMat33T getInverse() const
Get the real inverse.
Definition PxMat33.h:218
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T< Type > transform(const PxVec3T< Type > &other) const
Transform point by matrix.
Definition PxMat34.h:216
#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