32#include "foundation/PxBounds3.h"
33#include "foundation/PxFlags.h"
34#include "foundation/PxVecMath.h"
35#include "geometry/PxGeometry.h"
36#include "geometry/PxCapsuleGeometry.h"
39#include "GuCenterExtents.h"
46#define GU_EMPTY_BOUNDS_EXTENTS PxSqrt(0.25f * 1e33f)
52 PX_FORCE_INLINE void computeCapsuleBounds(PxBounds3& bounds,
const PxCapsuleGeometry& capsuleGeom,
const PxTransform& pose,
float contactOffset=0.0f,
float inflation=1.0f)
54 const PxVec3 d = pose.q.getBasisVector0();
56 for(PxU32 ax = 0; ax<3; ax++)
57 extents[ax] = (
PxAbs(d[ax]) * capsuleGeom.halfHeight + capsuleGeom.radius + contactOffset)*inflation;
58 bounds.
minimum = pose.p - extents;
59 bounds.
maximum = pose.p + extents;
63 PX_PHYSX_COMMON_API
void computeBounds(PxBounds3& bounds,
const PxGeometry& geometry,
const PxTransform& transform,
float contactOffset,
float inflation);
65 PX_FORCE_INLINE PxBounds3 computeBounds(
const PxGeometry& geometry,
const PxTransform& pose)
68 computeBounds(bounds, geometry, pose, 0.0f, 1.0f);
72 void computeGlobalBox(PxBounds3& bounds, PxU32 nbPrims,
const PxBounds3*
PX_RESTRICT boxes,
const PxU32*
PX_RESTRICT primitives);
74 PX_PHYSX_COMMON_API
void computeBoundsAroundVertices(PxBounds3& bounds, PxU32 nbVerts,
const PxVec3*
PX_RESTRICT verts);
75 PX_PHYSX_COMMON_API
void computeLocalBoundsAndGeomEpsilon(
const PxVec3* vertices, PxU32 nbVerties, PxBounds3& localBounds, PxReal& geomEpsilon);
77 #define StoreBounds(bounds, minV, maxV) \
78 V4StoreU(minV, &bounds.minimum.x); \
79 PX_ALIGN(16, PxVec4) max4; \
80 V4StoreA(maxV, &max4.x); \
81 bounds.maximum = PxVec3(max4.x, max4.y, max4.z);
84 template<const
bool useSIMD>
85 PX_FORCE_INLINE void inflateBounds(PxBounds3& dst,
const PxBounds3& src,
float enlargement)
87 const float coeff = 0.5f * enlargement;
90 using namespace physx::aos;
92 Vec4V minV = V4LoadU(&src.minimum.x);
93 Vec4V maxV = V4LoadU(&src.maximum.x);
94 const Vec4V eV = V4Scale(V4Sub(maxV, minV), FLoad(coeff));
96 minV = V4Sub(minV, eV);
97 maxV = V4Add(maxV, eV);
99 StoreBounds(dst, minV, maxV);
106 const PxVec3& minV = src.minimum;
107 const PxVec3& maxV = src.maximum;
108 const PxVec3 eV = (maxV - minV) * coeff;
109 dst.minimum = minV - eV;
121 PX_FORCE_INLINE const PxVec3& getPrunerBoxGeomExtentsInflated()
const {
return mPrunerBoxGeomExtents; }
134 PX_ASSERT(mType == PxGeometryType::eSPHERE);
135 return reinterpret_cast<const Gu::Sphere&
>(mGuSphere);
141 PX_ASSERT(mType == PxGeometryType::eBOX);
148 PX_ASSERT(mType == PxGeometryType::eCAPSULE);
149 return reinterpret_cast<const Gu::Capsule&
>(mGuCapsule);
154 PX_ASSERT(mType == PxGeometryType::eCAPSULE);
155 return mGuBox.extents.x;
168 PxVec3 mPrunerBoxGeomExtents;
Represents an oriented bounding box.
Definition GuBox.h:72
Represents a capsule.
Definition GuCapsule.h:47
Definition GuBounds.h:115
Class representing 3D range or axis aligned bounding box.
Definition PxBounds3.h:58
A geometry object.
Definition PxGeometry.h:79
3x3 matrix class
Definition PxMat33.h:91
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T minimum(const PxVec3T &v) const
element-wise minimum
Definition PxVec3.h:341
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3T maximum(const PxVec3T &v) const
element-wise maximum
Definition PxVec3.h:357
3 Element vector class.
Definition PxVec3.h:50
PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 maximum(const PxVec3 &v) const
element-wise maximum
Definition PxVec3.h:360
#define PX_RESTRICT
Definition PxPreprocessor.h:355
#define PX_FORCE_INLINE
Definition PxPreprocessor.h:335
#define PX_COMPILE_TIME_ASSERT(exp)
Definition PxPreprocessor.h:428
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
PX_CUDA_CALLABLE PX_FORCE_INLINE float PxAbs(float a)
abs returns the absolute value of its argument.
Definition PxMath.h:109
Enum
Definition PxGeometry.h:52
Definition PxVecMathAoSScalar.h:65