Bullet Collision Detection & Physics Library
btGjkEpa2.h
Go to the documentation of this file.
1 /*
2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2008 Erwin Coumans http://continuousphysics.com/Bullet/
4 
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
7 use of this software.
8 Permission is granted to anyone to use this software for any purpose,
9 including commercial applications, and to alter it and redistribute it
10 freely,
11 subject to the following restrictions:
12 
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
16 but is not required.
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.
20 */
21 
22 /*
23 GJK-EPA collision solver by Nathanael Presson, 2008
24 */
25 #ifndef BT_GJK_EPA2_H
26 #define BT_GJK_EPA2_H
27 
29 
32 {
33  struct sResults
34  {
35  enum eStatus
36  {
37  Separated, /* Shapes doesnt penetrate */
38  Penetrating, /* Shapes are penetrating */
39  GJK_Failed, /* GJK phase fail, no big issue, shapes are probably just 'touching' */
40  EPA_Failed /* EPA phase fail, bigger problem, need to save parameters, and debug */
41  } status;
45  };
46 
47  static int StackSizeRequirement();
48 
49  static bool Distance(const btConvexShape* shape0, const btTransform& wtrs0,
50  const btConvexShape* shape1, const btTransform& wtrs1,
51  const btVector3& guess,
52  sResults& results);
53 
54  static bool Penetration(const btConvexShape* shape0, const btTransform& wtrs0,
55  const btConvexShape* shape1, const btTransform& wtrs1,
56  const btVector3& guess,
57  sResults& results,
58  bool usemargins = true);
59 #ifndef __SPU__
60  static btScalar SignedDistance(const btVector3& position,
61  btScalar margin,
62  const btConvexShape* shape,
63  const btTransform& wtrs,
64  sResults& results);
65 
66  static bool SignedDistance(const btConvexShape* shape0, const btTransform& wtrs0,
67  const btConvexShape* shape1, const btTransform& wtrs1,
68  const btVector3& guess,
69  sResults& results);
70 #endif //__SPU__
71 };
72 
73 #endif //BT_GJK_EPA2_H
btGjkEpaSolver2::StackSizeRequirement
static int StackSizeRequirement()
Definition: btGjkEpa2.cpp:931
btGjkEpaSolver2::Distance
static bool Distance(const btConvexShape *shape0, const btTransform &wtrs0, const btConvexShape *shape1, const btTransform &wtrs1, const btVector3 &guess, sResults &results)
Definition: btGjkEpa2.cpp:937
btScalar
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:314
btGjkEpaSolver2::sResults::eStatus
eStatus
Definition: btGjkEpa2.h:35
btConvexShape.h
btGjkEpaSolver2::sResults::Penetrating
Definition: btGjkEpa2.h:38
btGjkEpaSolver2::sResults
Definition: btGjkEpa2.h:33
btGjkEpaSolver2::SignedDistance
static btScalar SignedDistance(const btVector3 &position, btScalar margin, const btConvexShape *shape, const btTransform &wtrs, sResults &results)
Definition: btGjkEpa2.cpp:1021
btGjkEpaSolver2::sResults::Separated
Definition: btGjkEpa2.h:37
btGjkEpaSolver2::sResults::status
enum btGjkEpaSolver2::sResults::eStatus status
btGjkEpaSolver2
btGjkEpaSolver contributed under zlib by Nathanael Presson
Definition: btGjkEpa2.h:31
btGjkEpaSolver2::sResults::normal
btVector3 normal
Definition: btGjkEpa2.h:43
btTransform
The btTransform class supports rigid transforms with only translation and rotation and no scaling/she...
Definition: btTransform.h:28
btGjkEpaSolver2::sResults::witnesses
btVector3 witnesses[2]
Definition: btGjkEpa2.h:42
btVector3
btVector3 can be used to represent 3D points and vectors.
Definition: btVector3.h:80
btGjkEpaSolver2::sResults::EPA_Failed
Definition: btGjkEpa2.h:40
btConvexShape
The btConvexShape is an abstract shape interface, implemented by all convex shapes such as btBoxShape...
Definition: btConvexShape.h:31
btGjkEpaSolver2::sResults::GJK_Failed
Definition: btGjkEpa2.h:39
btGjkEpaSolver2::sResults::distance
btScalar distance
Definition: btGjkEpa2.h:44
btGjkEpaSolver2::Penetration
static bool Penetration(const btConvexShape *shape0, const btTransform &wtrs0, const btConvexShape *shape1, const btTransform &wtrs1, const btVector3 &guess, sResults &results, bool usemargins=true)
Definition: btGjkEpa2.cpp:973