29#ifndef GU_CCD_SWEEP_CONVEX_MESH_H
30#define GU_CCD_SWEEP_CONVEX_MESH_H
32#include "common/PxPhysXCommonConfig.h"
33#include "foundation/PxVecTransform.h"
36#define GU_TRIANGLE_SWEEP_METHOD_ARGS \
37 const PxGeometry& shape0, \
38 const PxGeometry& shape1, \
39 const PxTransform& transform0, \
40 const PxTransform& transform1, \
41 const PxTransform& lastTm0, \
42 const PxTransform& lastTm1, \
43 PxReal restDistance, \
44 PxVec3& worldNormal, \
46 const Cm::FastVertex2ShapeScaling& meshScaling, \
47 Gu::TriangleV& triangle, \
48 const PxF32 toiEstimate
50#define GU_SWEEP_METHOD_ARGS \
51 const Gu::CCDShape& shape0, \
52 const Gu::CCDShape& shape1, \
53 const PxTransform& transform0, \
54 const PxTransform& transform1, \
55 const PxTransform& lastTm0, \
56 const PxTransform& lastTm1, \
57 PxReal restDistance, \
58 PxVec3& worldNormal, \
60 const PxF32 toiEstimate, \
61 PxU32& outCCDFaceIndex, \
62 const PxReal fastMovingThreshold
64#define GU_SWEEP_ESTIMATE_ARGS \
65 const CCDShape& shape0, \
66 const CCDShape& shape1, \
67 const PxReal restDistance, \
68 const PxReal fastMovingThreshold
70#define GU_SWEEP_METHOD_ARGS_UNUSED \
71 const Gu::CCDShape& , \
72 const Gu::CCDShape& , \
73 const PxTransform& , \
74 const PxTransform& , \
75 const PxTransform& , \
76 const PxTransform& , \
91 PxReal mFastMovingThreshold;
102 const PxVec3 cAcB = centerA - centerB;
103 const PxVec3 sumExtents = extentsA + extentsB;
106 if(
PxAbs(cAcB.x) <= sumExtents.x &&
107 PxAbs(cAcB.y) <= sumExtents.y &&
108 PxAbs(cAcB.z) <= sumExtents.z)
112 const PxVec3 relTr = trB - trA;
116 const PxVec3 aMax = centerA + extentsA;
117 const PxVec3 aMin = centerA - extentsA;
118 const PxVec3 bMax = centerB + extentsB;
119 const PxVec3 bMin = centerB - extentsB;
121 const PxF32 eps = 1e-6f;
123 for(PxU32 a = 0; a < 3; ++a)
127 if(bMax[a] < aMin[a])
129 if(aMax[a] < bMin[a])
130 tfirst =
PxMax((aMax[a] - bMin[a])/relTr[a], tfirst);
131 if(bMax[a] > aMin[a])
132 tlast =
PxMin((aMin[a] - bMax[a])/relTr[a], tlast);
134 else if(relTr[a] > eps)
136 if(bMin[a] > aMax[a])
138 if(bMax[a] < aMin[a])
139 tfirst =
PxMax((aMin[a] - bMax[a])/relTr[a], tfirst);
140 if(aMax[a] > bMin[a])
141 tlast =
PxMin((aMax[a] - bMin[a])/relTr[a], tlast);
145 if(bMax[a] < aMin[a] || bMin[a] > aMax[a])
157 PX_PHYSX_COMMON_API PxReal SweepShapeShape(GU_SWEEP_METHOD_ARGS);
159 PX_PHYSX_COMMON_API PxReal SweepEstimateAnyShapeHeightfield(GU_SWEEP_ESTIMATE_ARGS);
A geometry object.
Definition PxGeometry.h:79
3 Element vector class.
Definition PxVec3.h:50
#define PX_FORCE_INLINE
Definition PxPreprocessor.h:335
PxReal SweepEstimateAnyShapeMesh(GU_SWEEP_ESTIMATE_ARGS)
This code performs a conservative estimate of the TOI of a shape v mesh.
Definition GuCCDSweepConvexMesh.cpp:605
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
PX_CUDA_CALLABLE PX_FORCE_INLINE T PxMax(T a, T b)
The return value is the greater of the two specified values.
Definition PxMath.h:72
PX_CUDA_CALLABLE PX_FORCE_INLINE T PxMin(T a, T b)
The return value is the lesser of the two specified values.
Definition PxMath.h:88
Definition GuCCDSweepConvexMesh.h:89