21#define CHAOS_COLLISIONERROR_LOG_ENABLED ((!UE_BUILD_TEST && !UE_BUILD_SHIPPING) && 0)
22#define CHAOS_COLLISIONERROR_ENSURE_ENABLED ((!UE_BUILD_TEST && !UE_BUILD_SHIPPING) && 1)
24#if CHAOS_COLLISIONERROR_LOG_ENABLED
25#define CHAOS_COLLISIONERROR_CLOG(Condition, Fmt, ...) UE_CLOG((Condition), LogChaos, Error, Fmt, __VA_ARGS__)
27#define CHAOS_COLLISIONERROR_CLOG(Condition, Fmt, ...)
30#if CHAOS_COLLISIONERROR_ENSURE_ENABLED
31#define CHAOS_COLLISIONERROR_ENSURE(X) ensure(X)
33#define CHAOS_COLLISIONERROR_ENSURE(X)
76 return ((
const T*)Geom)->SupportCoreSimd(V,
InMargin);
86 template <
typename T, EGJKTestSpace TestSpace>
106 template <EGJKTestSpace TestSpace>
141 template<
typename ConvexTypeA,
typename ConvexTypeB>
155 template <
typename TGeometryA,
typename TGeometryB,
typename T>
189 template <
typename T,
typename TGeometryA,
typename TGeometryB>
192 const FReal EpsilonScale = FMath::Max<FReal>(
A.TGeometryA::BoundingBox().Extents().Max(),
B.TGeometryB::BoundingBox().Extents().Max());
198 template <
typename TGeometryA,
typename TGeometryB>
201 const FReal EpsilonScale = FMath::Max<FReal>(
A.TGeometryA::BoundingBox().Extents().Max(),
B.TGeometryB::BoundingBox().Extents().Max());
213 int NumIterations = 0;
234 if (!
ensure(NumIterations++ < 32))
273 template <
typename T>
274 bool GJKIntersection(
const FGeomGJKHelperSIMD&
RESTRICT A,
const FGeomGJKHelperSIMD&
RESTRICT B,
FReal EpsilonScale,
const TRigidTransform<T, 3>&
BToATM,
const T
InThicknessA = 0,
const TVector<T, 3>&
InitialDir =
TVector<T, 3>(1, 0, 0))
301 template <
typename TGeometryA,
typename TGeometryB>
315 int NumIterations = 0;
329 if (!
ensure(NumIterations++ < 32))
453 const T
Distance = FMath::Sqrt(DistanceSq);
557 template <
typename T,
typename TGeometryA,
typename TGeometryB>
558 bool GJKPenetrationWarmStartable(
const TGeometryA&
A,
const TGeometryB&
B,
const TRigidTransform<T, 3>&
BToATM, T&
OutPenetration,
TVec3<T>&
OutClosestA,
TVec3<T>&
OutClosestB,
TVec3<T>&
OutNormalA,
TVec3<T>&
OutNormalB,
int32&
OutVertexA,
int32&
OutVertexB,
TGJKSimplexData<T>&
InOutSimplexData, T&
OutMaxSupportDelta,
const T Epsilon = T(1.e-3),
const T
EPAEpsilon = T(1.e-2))
594 int32 NumIterations = 0;
728 template <
typename T,
typename TGeometryA,
typename TGeometryB>
729 bool GJKPenetrationWarmStartable2(
const TGeometryA&
A,
const TGeometryB&
B,
const TRigidTransform<T, 3>&
BToATM, T&
OutPenetration,
TVec3<T>&
OutClosestA,
TVec3<T>&
OutClosestB,
TVec3<T>&
OutNormalA,
TVec3<T>&
OutNormalB,
int32&
OutVertexA,
int32&
OutVertexB,
TGJKSimplexData<T>&
InOutSimplexData, T&
OutMaxSupportDelta,
const T Epsilon = T(1.e-3),
const T
EPAEpsilon = T(1.e-2))
765 int32 NumIterations = 0;
917 template <
typename T,
typename TGeometryA,
typename TGeometryB>
918 bool GJKPenetrationSameSpace(
const TGeometryA&
A,
const TGeometryB&
B, T&
OutPenetration,
TVec3<T>&
OutClosestA,
TVec3<T>&
OutClosestB,
TVec3<T>& OutNormal,
int32&
OutVertexA,
int32&
OutVertexB, T&
OutMaxSupportDelta,
const TVec3<T>&
InitialDir,
const T Epsilon = T(1.e-3),
const T
EPAEpsilon = T(1.e-2))
949 int32 NumIterations = 0;
1009 for (
int i = 0; i <
SimplexIDs.NumVerts; ++i)
1054 for (
int i = 0; i <
SimplexIDs.NumVerts; ++i)
1071 template <
typename T,
typename TGeometryA,
typename TGeometryB>
1072 bool GJKPenetrationSameSpace2(
const TGeometryA&
A,
const TGeometryB&
B, T&
OutPenetration,
TVec3<T>&
OutClosestA,
TVec3<T>&
OutClosestB,
TVec3<T>& OutNormal,
int32&
OutVertexA,
int32&
OutVertexB, T&
OutMaxSupportDelta,
const TVec3<T>&
InitialDir,
const T Epsilon = T(1.e-3),
const T
EPAEpsilon = T(1.e-2))
1103 int32 NumIterations = 0;
1136 NumVerts,
Simplex[0].
X,
Simplex[0].
Y,
Simplex[0].
Z,
Simplex[1].
X,
Simplex[1].
Y,
Simplex[1].
Z,
Simplex[2].
X,
Simplex[2].
Y,
Simplex[2].
Z,
Simplex[3].
X,
Simplex[3].
Y,
Simplex[3].
Z);
1229 template <
bool bNegativePenetrationAllowed = false,
typename T>
1230 bool GJKPenetrationImpl(
const FGeomGJKHelper&
A,
const FGeomGJKHelper&
B,
const TRigidTransform<T, 3>&
BToATM, T&
OutPenetration,
TVec3<T>&
OutClosestA,
TVec3<T>&
OutClosestB,
TVec3<T>& OutNormal,
int32&
OutClosestVertexIndexA,
int32&
OutClosestVertexIndexB,
const T
InThicknessA = 0.0f,
const T
InThicknessB = 0.0f,
const TVector<T, 3>&
InitialDir =
TVector<T, 3>(1, 0, 0),
const T Epsilon = 1.e-3f)
1239 if (V.SafeNormalize() == 0)
1250 T Barycentric[4] = { -1,-1,-1,-1 };
1254 int NumIterations = 0;
1261 if (!
ensure(NumIterations++ < 32))
1315 for (
int i = 0; i <
SimplexIDs.NumVerts; ++i)
1383 for (
int i = 0; i <
SimplexIDs.NumVerts; ++i)
1385 ClosestA += As[i] * Barycentric[i];
1427 template <
bool bNegativePenetrationAllowed = false,
typename T,
typename TGeometryA,
typename TGeometryB>
1428 bool GJKPenetration(
const TGeometryA&
A,
const TGeometryB&
B,
const TRigidTransform<T, 3>&
BToATM, T&
OutPenetration,
TVec3<T>&
OutClosestA,
TVec3<T>&
OutClosestB,
TVec3<T>& OutNormal,
int32&
OutClosestVertexIndexA,
int32&
OutClosestVertexIndexB,
const T
InThicknessA = 0.0f,
const T
InThicknessB = 0.0f,
const TVector<T, 3>&
InitialDir =
TVector<T, 3>(1, 0, 0),
const T Epsilon = 1.e-3f)
1430 return GJKPenetrationImpl<bNegativePenetrationAllowed, T>(
A,
B,
BToATM,
OutPenetration,
OutClosestA,
OutClosestB, OutNormal,
OutClosestVertexIndexA,
OutClosestVertexIndexB,
InThicknessA,
InThicknessB,
InitialDir, Epsilon);
1448 template <
typename T,
typename TGeometryA,
typename TGeometryB>
1450 T& OutTime,
TVector<T, 3>& OutPosition,
TVector<T, 3>& OutNormal,
const T
ThicknessA = 0,
const TVector<T, 3>&
InitialDir =
TVector<T, 3>(1, 0, 0),
const T
ThicknessB = 0)
1454 check(
A.IsConvex() &&
B.IsConvex());
1463 T Barycentric[4] = { -1,-1,-1,-1 };
1484 int NumIterations = 0;
1489 if (!(NumIterations++ < 32))
1524 X = StartPoint + Lambda *
RayDir;
1556 OutNormal =
Normal.GetUnsafeNormal();
1560 for (
int i = 0; i <
SimplexIDs.NumVerts; ++i)
1562 ClosestB += Bs[i] * Barycentric[i];
1586 template<
typename T, EGJKTestSpace TestSpace = EGJKTestSpace::ALocalSpace>
1656 int NumIterations = 0;
1662 if (!(NumIterations++ < 32))
1797 else if (bComputeMTD)
1838 Penetration =
VectorMin(Penetration, LimitMax);
1871 OutTime = -OutTime - (
A.Margin +
B.Margin);
1880 OutTime = -OutTime - (
A.Margin +
B.Margin);
1889 OutTime = -(
A.Margin +
B.Margin);
1901 OutTime = -(
A.Margin +
B.Margin);
1934 const bool Result =
GJKRaycast2ImplSimd<VectorRegister4Float>(
A,
B,
Rotation,
Translation, RayDirSimd,
static_cast<FRealSingle>(
RayLength),
OutTimeFloat, OutPositionSimd, OutNormalSimd, bComputeMTD,
InitialDirSimd);
1952 template <
typename T = FReal,
typename TGeometryA,
typename TGeometryB>
1954 T& OutTime,
TVector<T, 3>& OutPosition,
TVector<T, 3>& OutNormal,
const T
GivenThicknessA = 0,
bool bComputeMTD =
false,
const TVector<T, 3>&
InitialDir =
TVector<T, 3>(1, 0, 0),
const T
GivenThicknessB = 0)
1956 return GJKRaycast2Impl(
A,
B, StartTM,
RayDir,
RayLength, OutTime, OutPosition, OutNormal,
GivenThicknessA, bComputeMTD,
InitialDir,
GivenThicknessB);
1970 const bool Result =
GJKRaycast2ImplSimd<VectorRegister4Float, EGJKTestSpace::SameSpace>(
A,
B,
UnusedRotation,
Translation, RayDirSimd,
static_cast<FRealSingle>(
RayLength),
OutTimeFloat, OutPositionSimd, OutNormalSimd, bComputeMTD,
InitialDirSimd);
1988 template <
typename T = FReal,
typename TGeometryA,
typename TGeometryB>
1990 T& OutTime,
TVector<T, 3>& OutPosition,
TVector<T, 3>& OutNormal,
const T
GivenThicknessA = 0,
bool bComputeMTD =
false,
const TVector<T, 3>&
InitialDir =
TVector<T, 3>(1, 0, 0),
const T
GivenThicknessB = 0)
1992 return GJKRaycast2SameSpaceImpl(
A,
B, Start,
RayDir,
RayLength, OutTime, OutPosition, OutNormal,
GivenThicknessA, bComputeMTD,
InitialDir,
GivenThicknessB);
1995 template <
typename T,
typename TGeometryA,
typename TGeometryB>
1996 UE_DEPRECATED(5.5,
"Use GJKDistanceInitialVFromDirection if possible, or GJKDistanceInitialVFromRelativeTransform if original behaviour was required")
2005 template <
typename T,
typename TGeometryA,
typename TGeometryB>
2009 if (Direction.IsZero())
2031 template <
typename T,
typename TGeometryA,
typename TGeometryB>
2034 if (Direction.IsZero())
2082 template <
typename T,
typename GJKShapeTypeA,
typename GJKShapeTypeB>
2087 T Barycentric[4] = { -1, -1, -1, -1 };
2100 while (
VLen > Epsilon)
2110 Mu = FMath::Max(Mu,
D);
2131 for (
int32 VertIndex = 0; VertIndex <
SimplexIDs.NumVerts; ++VertIndex)
#define check(expr)
Definition AssertionMacros.h:314
#define ensure( InExpression)
Definition AssertionMacros.h:464
@ INDEX_NONE
Definition CoreMiscDefines.h:150
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define CHAOS_COLLISIONERROR_ENSURE(X)
Definition GJK.h:31
#define CHAOS_COLLISIONERROR_CLOG(Condition, Fmt,...)
Definition GJK.h:27
#define FVector
Definition IOSSystemIncludes.h:8
FORCEINLINE VectorRegister4Float VectorSubtract(const VectorRegister4Float &Vec1, const VectorRegister4Float &Vec2)
Definition UnrealMathFPU.h:731
FORCEINLINE VectorRegister4Float VectorSqrt(const VectorRegister4Float &Vec)
Definition UnrealMathFPU.h:1263
FORCEINLINE VectorRegister4Float VectorDot3(const VectorRegister4Float &Vec1, const VectorRegister4Float &Vec2)
Definition UnrealMathFPU.h:880
FORCEINLINE VectorRegister4Float VectorMin(const VectorRegister4Float &Vec1, const VectorRegister4Float &Vec2)
Definition UnrealMathFPU.h:1686
FORCEINLINE VectorRegister4Float MakeVectorRegister(uint32 X, uint32 Y, uint32 Z, uint32 W)
Definition UnrealMathFPU.h:195
FORCEINLINE VectorRegister4Float VectorDivide(const VectorRegister4Float &Vec1, const VectorRegister4Float &Vec2)
Definition UnrealMathFPU.h:834
FORCEINLINE VectorRegister4Float VectorMultiply(const VectorRegister4Float &Vec1, const VectorRegister4Float &Vec2)
Definition UnrealMathFPU.h:758
FORCEINLINE VectorRegister4Float VectorMax(const VectorRegister4Float &Vec1, const VectorRegister4Float &Vec2)
Definition UnrealMathFPU.h:1713
FORCEINLINE VectorRegister4Float VectorBitwiseAnd(const VectorRegister4Float &Vec1, const VectorRegister4Float &Vec2)
Definition UnrealMathFPU.h:1165
FORCEINLINE VectorRegister4Float VectorLoadFloat1(const float *Ptr)
Definition UnrealMathFPU.h:468
FORCEINLINE constexpr VectorRegister4Float MakeVectorRegisterFloatConstant(float X, float Y, float Z, float W)
Definition UnrealMathFPU.h:297
FORCEINLINE VectorRegister4Float VectorMultiplyAdd(const VectorRegister4Float &Vec1, const VectorRegister4Float &Vec2, const VectorRegister4Float &Vec3)
Definition UnrealMathFPU.h:786
FORCEINLINE VectorRegister4Float VectorCompareGT(const VectorRegister4Float &Vec1, const VectorRegister4Float &Vec2)
Definition UnrealMathFPU.h:974
#define VectorSet1(F)
Definition UnrealMathFPU.h:2651
FORCEINLINE VectorRegister4Float VectorCompareGE(const VectorRegister4Float &Vec1, const VectorRegister4Float &Vec2)
Definition UnrealMathFPU.h:1000
FORCEINLINE VectorRegister4Float VectorCompareLT(const VectorRegister4Float &Vec1, const VectorRegister4Float &Vec2)
Definition UnrealMathFPU.h:1025
FORCEINLINE int32 VectorMaskBits(const VectorRegister4Float &Vec1)
Definition UnrealMathFPU.h:1075
FORCEINLINE VectorRegister4Float VectorNegate(const VectorRegister4Float &Vec)
Definition UnrealMathFPU.h:687
FORCEINLINE VectorRegister4Float VectorNegateMultiplyAdd(const VectorRegister4Float &Vec1, const VectorRegister4Float &Vec2, const VectorRegister4Float &Vec3)
Definition UnrealMathFPU.h:815
FORCEINLINE VectorRegister4Float VectorAdd(const VectorRegister4Float &Vec1, const VectorRegister4Float &Vec2)
Definition UnrealMathFPU.h:704
void VectorStoreAligned(const VectorRegister4Float &Vec, float *Ptr)
Definition UnrealMathFPU.h:534
#define VectorSwizzle(Vec, X, Y, Z, W)
Definition UnrealMathFPU.h:639
FORCEINLINE VectorRegister4Float VectorZeroFloat(void)
Definition UnrealMathFPU.h:331
FORCEINLINE VectorRegister4Float VectorCompareEQ(const VectorRegister4Float &Vec1, const VectorRegister4Float &Vec2)
Definition UnrealMathFPU.h:923
FORCEINLINE void VectorStoreFloat1(const VectorRegister4Float &Vec, float *Dst)
Definition UnrealMathFPU.h:610
FORCEINLINE VectorRegister4Float MakeVectorRegisterFloat(uint32 X, uint32 Y, uint32 Z, uint32 W)
Definition UnrealMathFPU.h:175
FORCEINLINE VectorRegister4Float MakeVectorRegisterFloatFromDouble(const VectorRegister4Double &Vec4d)
Definition UnrealMathFPU.h:262
#define UE_KINDA_SMALL_NUMBER
Definition UnrealMathUtility.h:131
FORCEINLINE TVectorRegisterType VectorNormalizeAccurate(TVectorRegisterType Vector)
Definition UnrealMathVectorCommon.h.inl:412
FORCEINLINE VectorRegister4Float VectorZero(void)
Definition UnrealMathVectorCommon.h.inl:16
FORCEINLINE VectorRegister4Float VectorNormalizeSafe(VectorRegister4Float Vector, VectorRegister4Float DefaultValue)
Definition UnrealMathVectorCommon.h.inl:425
FORCEINLINE VectorRegister4Float VectorQuaternionInverse(VectorRegister4Float NormalizedQuat)
Definition UnrealMathVectorCommon.h.inl:723
FORCEINLINE VectorRegister4Float VectorQuaternionRotateVector(VectorRegister4Float Quat, VectorRegister4Float VectorW0)
Definition UnrealMathVectorCommon.h.inl:741
Internal simplex data for GJK that can also be stored for warm-starting subsequent calls.
Definition GJK.h:379
void Restore(const TRigidTransform< T, 3 > &BToATM, FSimplex &OutSimplexIDs, TVec3< T > OutSimplex[], TVec3< T > &OutV, T &OutDistance, const T Epsilon)
Definition GJK.h:402
int32 NumVerts
Definition GJK.h:475
TGJKSimplexData()
Definition GJK.h:381
void Save(const FSimplex InSimplexIDs)
Definition GJK.h:392
T Barycentric[MaxSimplexVerts]
Definition GJK.h:472
void Reset()
Definition GJK.h:386
void Restore2(const TRigidTransform< T, 3 > &BToATM, int32 &OutNumVerts, TVec3< T > OutSimplex[], TVec3< T > &OutV, T &OutDistance, const T Epsilon)
Definition GJK.h:433
TVec3< T > Bs[MaxSimplexVerts]
Definition GJK.h:469
TVec3< T > As[MaxSimplexVerts]
Definition GJK.h:466
static const int32 MaxSimplexVerts
Definition GJK.h:463
FORCEINLINE T Size() const
Definition Vector.h:1055
FORCEINLINE bool ContainsNaN() const
Definition Vector.h:1101
FORCEINLINE T SizeSquared() const
Definition Vector.h:1067
UE_FORCEINLINE_HINT void Reserve(SizeType Number)
Definition Array.h:3016
Definition SkeletalMeshComponent.h:307
bool GJKPenetrationSameSpace2(const TGeometryA &A, const TGeometryB &B, T &OutPenetration, TVec3< T > &OutClosestA, TVec3< T > &OutClosestB, TVec3< T > &OutNormal, int32 &OutVertexA, int32 &OutVertexB, T &OutMaxSupportDelta, const TVec3< T > &InitialDir, const T Epsilon=T(1.e-3), const T EPAEpsilon=T(1.e-2))
Definition GJK.h:1072
TVector< T, 3 > GJKDistanceInitialV(const TGeometryA &A, const TGeometryB &B, const TRigidTransform< T, 3 > &BToATM)
Definition GJK.h:1997
bool GJKIntersectionSimd(const TGeometryA &RESTRICT A, const TGeometryB &RESTRICT B, const VectorRegister4Float &Translation, const VectorRegister4Float &Rotation, FRealSingle InThicknessA, const VectorRegister4Float &InitialDir)
Definition GJK.h:199
bool CheckGJKIterationLimit(const int32 NumIterations, const ConvexTypeA &A, const ConvexTypeB &B)
Definition GJK.h:142
bool GJKRaycast(const TGeometryA &A, const TGeometryB &B, const TRigidTransform< T, 3 > &StartTM, const TVector< T, 3 > &RayDir, const T RayLength, T &OutTime, TVector< T, 3 > &OutPosition, TVector< T, 3 > &OutNormal, const T ThicknessA=0, const TVector< T, 3 > &InitialDir=TVector< T, 3 >(1, 0, 0), const T ThicknessB=0)
Definition GJK.h:1449
TVec3< T > GJKDistanceInitialVFromDirection(const TGeometryA &A, const TGeometryB &B, TVec3< T > Direction)
Definition GJK.h:2032
EEPAResult VectorEPA(TArray< VectorRegister4Float > &VertsABuffer, TArray< VectorRegister4Float > &VertsBBuffer, const TSupportA &SupportA, const TSupportB &SupportB, VectorRegister4Float &OutPenetration, VectorRegister4Float &OutDir, VectorRegister4Float &WitnessA, VectorRegister4Float &WitnessB)
Definition EPAVectorized.h:425
@ Y
Definition SimulationModuleBase.h:153
@ X
Definition SimulationModuleBase.h:152
bool GJKIntersectionSameSpaceSimd(const TGeometryA &A, const TGeometryB &B, FRealSingle InThicknessA, const VectorRegister4Float &InitialDir)
Definition GJK.h:302
bool GJKIntersection(const TGeometryA &RESTRICT A, const TGeometryB &RESTRICT B, const TRigidTransform< T, 3 > &BToATM, const T InThicknessA=0, const TVector< T, 3 > &InitialDir=TVector< T, 3 >(1, 0, 0))
Definition GJK.h:190
bool GJKRaycast2SameSpaceImpl(const FGeomGJKHelperSIMD &A, const FGeomGJKHelperSIMD &B, const TVector< FReal, 3 > &Start, const TVector< FReal, 3 > &RayDir, const FReal RayLength, FReal &OutTime, TVector< FReal, 3 > &OutPosition, TVector< FReal, 3 > &OutNormal, const FReal GivenThicknessA, bool bComputeMTD, const TVector< FReal, 3 > &InitialDir, const FReal GivenThicknessB)
Definition GJK.h:1959
FRealDouble FReal
Definition Real.h:22
EGJKDistanceResult
Definition GJK.h:2046
bool GJKRaycast2ImplSimd(const FGeomGJKHelperSIMD &RESTRICT A, const FGeomGJKHelperSIMD &RESTRICT B, const T &BToARotation, const T &StartPoint, const T &RayDir, FRealSingle RayLength, FRealSingle &OutTime, T &OutPosition, T &OutNormal, bool bComputeMTD, const T &InitialDir)
Definition GJK.h:1587
bool GJKRaycast2(const TGeometryA &A, const TGeometryB &B, const TRigidTransform< T, 3 > &StartTM, const TVector< T, 3 > &RayDir, const T RayLength, T &OutTime, TVector< T, 3 > &OutPosition, TVector< T, 3 > &OutNormal, const T GivenThicknessA=0, bool bComputeMTD=false, const TVector< T, 3 > &InitialDir=TVector< T, 3 >(1, 0, 0), const T GivenThicknessB=0)
Definition GJK.h:1953
bool GJKRaycast2Impl(const FGeomGJKHelperSIMD &A, const FGeomGJKHelperSIMD &B, const TRigidTransform< FReal, 3 > &StartTM, const TVector< FReal, 3 > &RayDir, const FReal RayLength, FReal &OutTime, TVector< FReal, 3 > &OutPosition, TVector< FReal, 3 > &OutNormal, const FReal GivenThicknessA, bool bComputeMTD, const TVector< FReal, 3 > &InitialDir, const FReal GivenThicknessB)
Definition GJK.h:1917
bool GJKPenetrationImpl(const FGeomGJKHelper &A, const FGeomGJKHelper &B, const TRigidTransform< T, 3 > &BToATM, T &OutPenetration, TVec3< T > &OutClosestA, TVec3< T > &OutClosestB, TVec3< T > &OutNormal, int32 &OutClosestVertexIndexA, int32 &OutClosestVertexIndexB, const T InThicknessA=0.0f, const T InThicknessB=0.0f, const TVector< T, 3 > &InitialDir=TVector< T, 3 >(1, 0, 0), const T Epsilon=1.e-3f)
Definition GJK.h:1230
bool GJKPenetrationWarmStartable(const TGeometryA &A, const TGeometryB &B, const TRigidTransform< T, 3 > &BToATM, T &OutPenetration, TVec3< T > &OutClosestA, TVec3< T > &OutClosestB, TVec3< T > &OutNormalA, TVec3< T > &OutNormalB, int32 &OutVertexA, int32 &OutVertexB, TGJKSimplexData< T > &InOutSimplexData, T &OutMaxSupportDelta, const T Epsilon=T(1.e-3), const T EPAEpsilon=T(1.e-2))
Calculate the penetration data for two shapes using GJK and a warm-start buffer.
Definition GJK.h:558
float FRealSingle
Definition Real.h:14
bool GJKRaycast2SameSpace(const TGeometryA &A, const TGeometryB &B, const TVector< T, 3 > &Start, const TVector< T, 3 > &RayDir, const T RayLength, T &OutTime, TVector< T, 3 > &OutPosition, TVector< T, 3 > &OutNormal, const T GivenThicknessA=0, bool bComputeMTD=false, const TVector< T, 3 > &InitialDir=TVector< T, 3 >(1, 0, 0), const T GivenThicknessB=0)
Definition GJK.h:1989
EGJKTestSpace
Definition GJK.h:81
@ ALocalSpace
Definition GJK.h:83
@ SameSpace
Definition GJK.h:82
EGJKDistanceResult GJKDistance(const GJKShapeTypeA &A, const GJKShapeTypeB &B, const TVec3< T > &InitialV, T &OutDistance, TVec3< T > &OutNearestA, TVec3< T > &OutNearestB, TVec3< T > &OutNormalA, const T Epsilon=(T) 1e-3, const int32 MaxIts=16)
Definition GJK.h:2083
EEPAResult
Definition EPA.h:421
void CalculateQueryMargins(const TGeometryA &A, const TGeometryB &B, T &outMarginA, T &outMarginB)
Definition GJK.h:156
bool GJKPenetration(const TGeometryA &A, const TGeometryB &B, const TRigidTransform< T, 3 > &BToATM, T &OutPenetration, TVec3< T > &OutClosestA, TVec3< T > &OutClosestB, TVec3< T > &OutNormal, int32 &OutClosestVertexIndexA, int32 &OutClosestVertexIndexB, const T InThicknessA=0.0f, const T InThicknessB=0.0f, const TVector< T, 3 > &InitialDir=TVector< T, 3 >(1, 0, 0), const T Epsilon=1.e-3f)
Definition GJK.h:1428
bool GJKPenetrationSameSpace(const TGeometryA &A, const TGeometryB &B, T &OutPenetration, TVec3< T > &OutClosestA, TVec3< T > &OutClosestB, TVec3< T > &OutNormal, int32 &OutVertexA, int32 &OutVertexB, T &OutMaxSupportDelta, const TVec3< T > &InitialDir, const T Epsilon=T(1.e-3), const T EPAEpsilon=T(1.e-2))
Calculate the penetration data for two shapes using GJK, assuming both shapes are already in the same...
Definition GJK.h:918
TVector< T, 3 > GJKDistanceInitialVFromRelativeTransform(const TGeometryA &A, const TGeometryB &B, const TRigidTransform< T, 3 > &BToATM)
Definition GJK.h:2006
TVec3< T > SimplexFindClosestToOrigin2(TVec3< T > *Simplex, int32 &NumVerts, T *OutBarycentric, TVec3< T > *A, TVec3< T > *B)
Definition Simplex.h:636
TVec3< T > SimplexFindClosestToOrigin(TVec3< T > *Simplex, FSimplex &Idxs, T *OutBarycentric, TVec3< T > *A=nullptr, TVec3< T > *B=nullptr)
Definition Simplex.h:587
bool GJKPenetrationWarmStartable2(const TGeometryA &A, const TGeometryB &B, const TRigidTransform< T, 3 > &BToATM, T &OutPenetration, TVec3< T > &OutClosestA, TVec3< T > &OutClosestB, TVec3< T > &OutNormalA, TVec3< T > &OutNormalB, int32 &OutVertexA, int32 &OutVertexB, TGJKSimplexData< T > &InOutSimplexData, T &OutMaxSupportDelta, const T Epsilon=T(1.e-3), const T EPAEpsilon=T(1.e-2))
Definition GJK.h:729
constexpr VectorRegister4Float BigNumber
Definition UnrealMathVectorConstants.h.inl:55
constexpr VectorRegister4Float Float0001
Definition UnrealMathVectorConstants.h.inl:43
FRealSingle Margin
Definition GJK.h:47
const void * Geometry
Definition GJK.h:46
VectorRegister4Float SupportFunction(const VectorRegister4Float AToBRotation, const VectorRegister4Float BToARotation, const VectorRegister4Float V) const
Definition GJK.h:66
VectorRegister4Float SupportFunction(const VectorRegister4Float V, FRealSingle InMargin) const
Definition GJK.h:63
VectorRegister4Float SupportFunction(const VectorRegister4Float V) const
Definition GJK.h:62
VectorRegister4Float operator()(const VectorRegister4Float V) const
Definition GJK.h:61
VectorRegister4Float operator()(const VectorRegister4Float AToBRotation, const VectorRegister4Float BToARotation, const VectorRegister4Float V) const
Definition GJK.h:65
VectorRegister4Float(* SupportFunc)(const void *Geom, FRealSingle Margin, const VectorRegister4Float V)
Definition GJK.h:44
FRealSingle GetMarginf() const
Definition GJK.h:59
FRealSingle GetMargin() const
Definition GJK.h:57
FRealSingle GetRadius() const
Definition GJK.h:56
SupportFunc Func
Definition GJK.h:49
FRealSingle Radius
Definition GJK.h:48
FGeomGJKHelperSIMD(const T &Geom)
Definition GJK.h:52
FRealSingle GetRadiusf() const
Definition GJK.h:58
FGeomGJKHelper(const T &Geom)
Definition GJK.h:490
FVector SupportFunction(const FRotation3 &AToBRotation, const FVec3 &V, FReal *OutSupportDelta, int32 &VertexIndex) const
Definition GJK.h:495
FReal GetMargin() const
Definition GJK.h:515
FVector SupportFunction(const FRigidTransform3 &BToATM, const FRotation3 &AToBRotation, const FVec3 &V, int32 &VertexIndex) const
Definition GJK.h:501
FVector SupportFunction(const FVec3 &V, int32 &VertexIndex) const
Definition GJK.h:492
FReal GetMarginf() const
Definition GJK.h:516
FVector(* SupportFunc)(const void *Geom, const FVec3 &Direction, FReal *OutSupportDelta, int32 &VertexIndex)
Definition GJK.h:483
FVector SupportFunction(const FRigidTransform3 &BToATM, const FRotation3 &AToBRotation, const FVec3 &V, FReal *OutSupportDelta, int32 &VertexIndex) const
Definition GJK.h:508
FRealSingle Margin
Definition GJK.h:487
const void * Geometry
Definition GJK.h:485
FVector SupportFunction(const FVec3 &V, FReal *OutSupportDelta, int32 &VertexIndex) const
Definition GJK.h:493
SupportFunc Func
Definition GJK.h:486
int32 NumVerts
Definition Simplex.h:85
static void Support(const FGeomGJKHelperSIMD &RESTRICT A, const FGeomGJKHelperSIMD &RESTRICT B, const T &SearchDir, const T &BToARotation, const T &AToBRotation, T &OutSupportA, T &OutSupportB)
Definition GJK.h:99
static void Support(const FGeomGJKHelperSIMD &RESTRICT A, const FGeomGJKHelperSIMD &RESTRICT B, const T &SearchDir, const T &AToBRotation, const T &BToARotation, T &OutSupportA, T &OutSupportB)
Definition GJK.h:89
const FGeomGJKHelperSIMD & B
Definition GJK.h:128
VectorRegister4Float operator()(const VectorRegister4Float &V) const
Definition GJK.h:135
TSupportBAtOriginHelperSIMD(const FGeomGJKHelperSIMD &InB, const VectorRegister4Float &InAToBRotation, const VectorRegister4Float InBToARotation, const VectorRegister4Float &InStartPoint)
Definition GJK.h:130
const VectorRegister4Float StartPoint
Definition GJK.h:129
VectorRegister4Float operator()(const VectorRegister4Float &V) const
Definition GJK.h:122
const FGeomGJKHelperSIMD & B
Definition GJK.h:109
TSupportBAtOriginHelperSIMD(const FGeomGJKHelperSIMD &InB, const VectorRegister4Float &InAToBRotation, const VectorRegister4Float InBToARotation, const VectorRegister4Float &InStartPoint)
Definition GJK.h:114
const VectorRegister4Float AToBRotation
Definition GJK.h:110
const VectorRegister4Float StartPoint
Definition GJK.h:112
const VectorRegister4Float BToARotation
Definition GJK.h:111
static UE_FORCEINLINE_HINT bool IsNearlyEqual(float A, float B, float ErrorTolerance=UE_SMALL_NUMBER)
Definition UnrealMathUtility.h:388
static constexpr UE_FORCEINLINE_HINT T Square(const T A)
Definition UnrealMathUtility.h:578
Definition NumericLimits.h:41
Definition UnrealMathFPU.h:20