32#include "foundation/PxVecMath.h"
33#include "foundation/PxFPU.h"
34#include "foundation/PxUtilities.h"
37#if (defined __GNUC__ && defined _DEBUG)
38#define PX_EPA_FORCE_INLINE
40#define PX_EPA_FORCE_INLINE PX_FORCE_INLINE
49#define MaxSupportPoints 64
53 const PxU32 lookUp[3] = {1, 2, 0};
59 typedef Cm::InlineDeferredIDPool<MaxFacets> EPAFacetManager;
70 : m_obsolete(
false), m_inHeap(
false)
72 m_indices[0]= PxToI8(_i0);
73 m_indices[1]= PxToI8(_i1);
74 m_indices[2]= PxToI8(_i2);
76 m_adjFacets[0] = m_adjFacets[1] = m_adjFacets[2] = NULL;
77 m_adjEdges[0] = m_adjEdges[1] = m_adjEdges[2] = -1;
83 m_adjFacets[0] = m_adjFacets[1] = m_adjFacets[2] = NULL;
84 m_adjEdges[0] = m_adjEdges[1] = m_adjEdges[2] = -1;
89 return (m_adjFacets[0] != NULL) & (m_adjFacets[1] != NULL) & (m_adjFacets[2] != NULL);
94 return PxU32(m_indices[i]);
107 const aos::FloatVArg upper);
112 return aos::FLoad(m_planeDist);
118 return m_planeNormal;
133 bool operator <(
const Facet& b)
const
135 return m_planeDist < b.m_planeDist;
168 m_facet = other.m_facet;
169 m_index = other.m_index;
179 PX_ASSERT(m_index < 3);
180 return (*m_facet)[m_index];
186 PX_ASSERT(m_index < 3);
187 return (*m_facet)[incMod3(m_index)];
204 if (m_Size < MaxEdges)
206 Edge* pEdge = &m_pEdges[m_Size++];
207 pEdge->m_facet = facet;
208 pEdge->m_index = index;
215 Edge* Get(
const PxU32 index)
217 PX_ASSERT(index < m_Size);
218 return &m_pEdges[index];
228 return m_Size > 0 && !m_OverFlow;
237 Edge m_pEdges[MaxEdges];
248 const Vec3V pa0(aBuf[m_indices[0]]);
249 const Vec3V pa1(aBuf[m_indices[1]]);
250 const Vec3V pa2(aBuf[m_indices[2]]);
252 const Vec3V pb0(bBuf[m_indices[0]]);
253 const Vec3V pb1(bBuf[m_indices[1]]);
254 const Vec3V pb2(bBuf[m_indices[2]]);
256 const Vec3V p0 = V3Sub(pa0, pb0);
257 const Vec3V p1 = V3Sub(pa1, pb1);
258 const Vec3V p2 = V3Sub(pa2, pb2);
260 const Vec3V v0 = V3Sub(p1, p0);
261 const Vec3V v1 = V3Sub(p2, p0);
263 const Vec3V closestP = V3Scale(m_planeNormal, FLoad(m_planeDist));
264 const Vec3V v2 = V3Sub(closestP, p0);
266 const FloatV d00 = V3Dot(v0, v0);
267 const FloatV d01 = V3Dot(v0, v1);
268 const FloatV d11 = V3Dot(v1, v1);
270 const FloatV d20 = V3Dot(v2, v0);
271 const FloatV d21 = V3Dot(v2, v1);
273 const FloatV det = FNegScaleSub(d01, d01, FMul(d00, d11));
274 const FloatV recip = FSel(FIsGrtr(det, FEps()), FRecip(det), FZero());
276 const FloatV lambda1 = FMul(FNegScaleSub(d01, d21, FMul(d11, d20)), recip);
277 const FloatV lambda2 = FMul(FNegScaleSub(d01, d20, FMul(d00, d21)), recip);
280 FStore(lambda1, &m_lambda1);
281 FStore(lambda2, &m_lambda2);
284 const FloatV u = FSub(FOne(), FAdd(lambda1, lambda2));
285 closestA = V3ScaleAdd(pa0, u, V3ScaleAdd(pa1, lambda1, V3Scale(pa2, lambda2)));
286 closestB = V3ScaleAdd(pb0, u, V3ScaleAdd(pb1, lambda1, V3Scale(pb2, lambda2)));
292 m_adjFacets[edge0] = facet;
293 m_adjEdges[edge0] = PxToI8(edge1);
294 facet->m_adjFacets[edge1] =
this;
295 facet->m_adjEdges[edge1] = PxToI8(edge0);
297 return (m_indices[edge0] == facet->m_indices[incMod3(edge1)]) && (m_indices[incMod3(edge0)] == facet->m_indices[edge1]);
Definition GuEPAFacet.h:196
Definition GuEPAFacet.h:160
Definition GuEPAFacet.h:62
#define PX_RESTRICT
Definition PxPreprocessor.h:355
#define PX_FORCE_INLINE
Definition PxPreprocessor.h:335
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
Definition PxVecMathAoSScalar.h:90
Definition PxVecMathAoSScalar.h:52
Definition PxVecMathAoSScalar.h:77