29#ifndef GU_DISTANCE_POINT_TETRAHEDRON_H
30#define GU_DISTANCE_POINT_TETRAHEDRON_H
32#include "foundation/PxVec3.h"
33#include "foundation/PxVec4.h"
34#include "GuDistancePointTriangle.h"
35#include "common/PxPhysXCommonConfig.h"
41 PX_PHYSX_COMMON_API PxVec4 PointOutsideOfPlane4(
const PxVec3& p,
const PxVec3& _a,
const PxVec3& _b,
42 const PxVec3& _c,
const PxVec3& _d);
44 PX_PHYSX_COMMON_API PxVec3 closestPtPointTetrahedron(
const PxVec3& p,
const PxVec3& a,
const PxVec3& b,
const PxVec3& c,
const PxVec3& d,
const PxVec4& result);
46 PX_INLINE PX_CUDA_CALLABLE PxVec3 closestPtPointTetrahedron(
const PxVec3& p,
const PxVec3& a,
const PxVec3& b,
const PxVec3& c,
const PxVec3& d)
48 const PxVec3 ab = b - a;
49 const PxVec3 ac = c - a;
50 const PxVec3 ad = d - a;
51 const PxVec3 bc = c - b;
52 const PxVec3 bd = d - b;
55 PxVec3 bestClosestPt = closestPtPointTriangle2(p, a, b, c, ab, ac);
56 PxReal bestSqDist = bestClosestPt.dot(bestClosestPt);
59 PxVec3 closestPt = closestPtPointTriangle2(p, a, c, d, ac, ad);
60 PxReal sqDist = closestPt.dot(closestPt);
61 if (sqDist < bestSqDist)
63 bestClosestPt = closestPt;
68 closestPt = closestPtPointTriangle2(p, a, d, b, ad, ab);
69 sqDist = closestPt.dot(closestPt);
70 if (sqDist < bestSqDist)
72 bestClosestPt = closestPt;
77 closestPt = closestPtPointTriangle2(p, b, d, c, bd, bc);
78 sqDist = closestPt.dot(closestPt);
79 if (sqDist < bestSqDist)
81 bestClosestPt = closestPt;
#define PX_INLINE
Definition PxPreprocessor.h:320
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39