36 template <
bool LastPo
intPartOfClosestFeature>
40 for (
int i = 0;
i < mNumPoints; ++
i)
62 v = ClosestPoint::GetClosestPointOnTriangle<LastPointPartOfClosestFeature>(mY[0], mY[1], mY[2],
set);
67 v = ClosestPoint::GetClosestPointOnTetrahedron<LastPointPartOfClosestFeature>(mY[0], mY[1], mY[2], mY[3],
set);
91 Trace(
"New closer point is further away, failed to converge");
97 float GetMaxYLengthSq()
const
100 for (
int i = 1;
i < mNumPoints; ++
i)
109 for (
int i = 0;
i < mNumPoints; ++
i)
110 if ((
inSet & (1 <<
i)) != 0)
126 for (
int i = 0;
i < mNumPoints; ++
i)
127 if ((
inSet & (1 <<
i)) != 0)
139 for (
int i = 0;
i < mNumPoints; ++
i)
140 if ((
inSet & (1 <<
i)) != 0)
153 for (
int i = 0;
i < mNumPoints; ++
i)
154 if ((
inSet & (1 <<
i)) != 0)
213 template <
typename A,
typename B>
222 for (
int i = 0;
i < 4; ++
i)
243 if (
ioV.Dot(w) < 0.0f)
247 Trace(
"Separating axis");
270 Trace(
"Full simplex");
280 Trace(
"Distance zero");
290 Trace(
"Machine precision reached");
313 UpdatePointSetY(
set);
333 template <
typename A,
typename B>
346 for (
int i = 0;
i < 4; ++
i)
394 Trace(
"Distance bigger than max");
424 Trace(
"Full simplex");
432 UpdatePointSetYPQ(
set);
438 Trace(
"Distance zero");
452 Trace(
"Machine precision reached");
504 uint size =
sizeof(
Vec3) * mNumPoints;
522 template <
typename A>
597 for (
int i = 0;
i < mNumPoints; ++
i)
605 Trace(
"Failed to converge");
627 Trace(
"Full simplex");
637 UpdatePointSetP(
set);
664 template <
typename A,
typename B>
695 template <
typename A,
typename B>
696 bool CastShape(
Mat44Arg inStart,
Vec3Arg inDirection,
float inTolerance,
const A &
inA,
const B &
inB,
float inConvexRadiusA,
float inConvexRadiusB,
float &
ioLambda,
Vec3 &
outPointA,
Vec3 &
outPointB,
Vec3 &
outSeparatingAxis)
795 for (
int i = 0;
i < mNumPoints; ++
i)
796 mY[
i] = x - (mQ[
i] - mP[
i]);
803 Trace(
"Failed to converge");
826 Trace(
"Full simplex");
836 UpdatePointSetPQ(
set);
852 for (
int i = 0;
i < mNumPoints; ++
i)
853 mY[
i] = x - (mQ[
i] - mP[
i]);
912 for (
int i = 0;
i < mNumPoints; ++
i)
917 for (
int j =
i + 1;
j < mNumPoints; ++
j)
922 for (
int k =
j + 1;
k < mNumPoints; ++
k)
937 mOffset +=
Vec3(mGeometry->mBounds.GetSize().GetX() + 2.0f, 0, 0);
#define JPH_GCC_SUPPRESS_WARNING(w)
Definition Core.h:264
unsigned int uint
Definition Core.h:439
#define JPH_NAMESPACE_END
Definition Core.h:367
std::uint32_t uint32
Definition Core.h:442
#define JPH_NAMESPACE_BEGIN
Definition Core.h:361
TraceFunction Trace
Definition IssueReporting.cpp:18
#define JPH_ASSERT(...)
Definition IssueReporting.h:33
constexpr T Square(T inV)
Square a value.
Definition Math.h:52
AllocateFunction Allocate
Definition Memory.cpp:59
float Real
Definition Real.h:27
static const Color sPurple
Definition Color.h:58
static const Color sGreen
Definition Color.h:54
static const Color sLightGrey
Definition Color.h:63
static const Color sOrange
Definition Color.h:60
static const Color sCyan
Definition Color.h:59
static const Color sRed
Definition Color.h:52
static const Color sYellow
Definition Color.h:57
GeometryRef CreateTriangleGeometryForConvex(SupportFunction inGetSupport)
Definition DebugRenderer.cpp:688
void DrawMarker(RVec3Arg inPosition, ColorArg inColor, float inSize)
Draw a marker on a position.
Definition DebugRenderer.cpp:172
void DrawCoordinateSystem(RMat44Arg inTransform, float inSize=1.0f)
Draw coordinate system (3 arrows, x = red, y = green, z = blue)
Definition DebugRenderer.cpp:206
virtual void DrawGeometry(RMat44Arg inModelMatrix, const AABox &inWorldSpaceBounds, float inLODScaleSq, ColorArg inModelColor, const GeometryRef &inGeometry, ECullMode inCullMode=ECullMode::CullBackFace, ECastShadow inCastShadow=ECastShadow::On, EDrawMode inDrawMode=EDrawMode::Solid)=0
static DebugRenderer * sInstance
Singleton instance.
Definition DebugRenderer.h:168
virtual void DrawLine(RVec3Arg inFrom, RVec3Arg inTo, ColorArg inColor)=0
Draw line.
void DrawArrow(RVec3Arg inFrom, RVec3Arg inTo, ColorArg inColor, float inSize)
Draw an arrow.
Definition DebugRenderer.cpp:184
virtual void DrawTriangle(RVec3Arg inV1, RVec3Arg inV2, RVec3Arg inV3, ColorArg inColor, ECastShadow inCastShadow=ECastShadow::Off)=0
Draw a single back face culled triangle.
Definition GJKClosestPoint.h:23
bool Intersects(const A &inA, const B &inB, float inTolerance, Vec3 &ioV)
Definition GJKClosestPoint.h:214
bool CastShape(Mat44Arg inStart, Vec3Arg inDirection, float inTolerance, const A &inA, const B &inB, float &ioLambda)
Definition GJKClosestPoint.h:665
void GetClosestPointsSimplex(Vec3 *outY, Vec3 *outP, Vec3 *outQ, uint &outNumPoints) const
Definition GJKClosestPoint.h:502
bool CastShape(Mat44Arg inStart, Vec3Arg inDirection, float inTolerance, const A &inA, const B &inB, float inConvexRadiusA, float inConvexRadiusB, float &ioLambda, Vec3 &outPointA, Vec3 &outPointB, Vec3 &outSeparatingAxis)
Definition GJKClosestPoint.h:696
float GetClosestPoints(const A &inA, const B &inB, float inTolerance, float inMaxDistSq, Vec3 &ioV, Vec3 &outPointA, Vec3 &outPointB)
Definition GJKClosestPoint.h:334
bool CastRay(Vec3Arg inRayOrigin, Vec3Arg inRayDirection, float inTolerance, const A &inA, float &ioLambda)
Definition GJKClosestPoint.h:523
Holds a 4x4 matrix of floats, but supports also operations on the 3x3 upper left part of the matrix.
Definition Mat44.h:13
static JPH_INLINE Mat44 sTranslation(Vec3Arg inV)
Get matrix that translates.
Definition Mat44.inl:144
Class that makes another class non-copyable. Usage: Inherit from NonCopyable.
Definition NonCopyable.h:11
JPH_INLINE float Dot(Vec3Arg inV2) const
Dot product.
Definition Vec3.inl:637
JPH_INLINE Vec3 NormalizedOr(Vec3Arg inZeroValue) const
Normalize vector or return inZeroValue if the length of the vector is zero.
Definition Vec3.inl:708
JPH_INLINE float LengthSq() const
Squared length of vector.
Definition Vec3.inl:653
static JPH_INLINE Vec3 sZero()
Vector with all zeros.
Definition Vec3.inl:107
bool GetBaryCentricCoordinates(Vec3Arg inA, Vec3Arg inB, float &outU, float &outV)
Definition ClosestPoint.h:18
Vec3 GetClosestPointOnLine(Vec3Arg inA, Vec3Arg inB, uint32 &outSet)
Definition ClosestPoint.h:132
Structure that performs a Minkowski difference A - B.
Definition ConvexSupport.h:67