2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2008 Erwin Coumans https://bulletphysics.org
5 This software is provided 'as-is', without any express or implied warranty.
6 In no event will the authors be held liable for any damages arising from the
8 Permission is granted to anyone to use this software for any purpose,
9 including commercial applications, and to alter it and redistribute it
11 subject to the following restrictions:
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software in a
15 product, an acknowledgment in the product documentation would be appreciated
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
23 GJK-EPA collision solver by Nathanael Presson, 2008
28 #include "Bullet3Common/b3AlignedObjectArray.h"
29 #include "Bullet3Common/b3Transform.h"
30 #include "Bullet3Collision/NarrowPhaseCollision/shared/b3ConvexPolyhedronData.h"
32 ///btGjkEpaSolver contributed under zlib by Nathanael Presson
33 struct b3GjkEpaSolver2
39 Separated, /* Shapes doesnt penetrate */
40 Penetrating, /* Shapes are penetrating */
41 GJK_Failed, /* GJK phase fail, no big issue, shapes are probably just 'touching' */
42 EPA_Failed /* EPA phase fail, bigger problem, need to save parameters, and debug */
44 b3Vector3 witnesses[2];
49 static int StackSizeRequirement();
51 static bool Distance(const b3Transform& transA, const b3Transform& transB,
52 const b3ConvexPolyhedronData* hullA, const b3ConvexPolyhedronData* hullB,
53 const b3AlignedObjectArray<b3Vector3>& verticesA,
54 const b3AlignedObjectArray<b3Vector3>& verticesB,
55 const b3Vector3& guess,
58 static bool Penetration(const b3Transform& transA, const b3Transform& transB,
59 const b3ConvexPolyhedronData* hullA, const b3ConvexPolyhedronData* hullB,
60 const b3AlignedObjectArray<b3Vector3>& verticesA,
61 const b3AlignedObjectArray<b3Vector3>& verticesB,
62 const b3Vector3& guess,
64 bool usemargins = true);
66 static b3Scalar SignedDistance( const b3Vector3& position,
68 const btConvexShape* shape,
69 const btTransform& wtrs,
72 static bool SignedDistance( const btConvexShape* shape0,const btTransform& wtrs0,
73 const btConvexShape* shape1,const btTransform& wtrs1,
74 const b3Vector3& guess,
79 #endif //B3_GJK_EPA2_H