Bullet Collision Detection & Physics Library
btGjkPairDetector.h
Go to the documentation of this file.
1 /*
2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2006 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 use of this software.
7 Permission is granted to anyone to use this software for any purpose,
8 including commercial applications, and to alter it and redistribute it freely,
9 subject to the following restrictions:
10 
11 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
12 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
13 3. This notice may not be removed or altered from any source distribution.
14 */
15 
16 
17 
18 
19 #ifndef BT_GJK_PAIR_DETECTOR_H
20 #define BT_GJK_PAIR_DETECTOR_H
21 
24 
25 class btConvexShape;
28 
31 {
32 
33 
43 
46 
47 
48 public:
49 
50  //some debugging to fix degeneracy problems
52  int m_curIter;
56 
57  btGjkPairDetector(const btConvexShape* objectA,const btConvexShape* objectB,btSimplexSolverInterface* simplexSolver,btConvexPenetrationDepthSolver* penetrationDepthSolver);
58  btGjkPairDetector(const btConvexShape* objectA,const btConvexShape* objectB,int shapeTypeA,int shapeTypeB,btScalar marginA, btScalar marginB, btSimplexSolverInterface* simplexSolver,btConvexPenetrationDepthSolver* penetrationDepthSolver);
59  virtual ~btGjkPairDetector() {};
60 
61  virtual void getClosestPoints(const ClosestPointInput& input,Result& output,class btIDebugDraw* debugDraw,bool swapResults=false);
62 
63  void getClosestPointsNonVirtual(const ClosestPointInput& input,Result& output,class btIDebugDraw* debugDraw);
64 
65 
66  void setMinkowskiA(const btConvexShape* minkA)
67  {
68  m_minkowskiA = minkA;
69  }
70 
71  void setMinkowskiB(const btConvexShape* minkB)
72  {
73  m_minkowskiB = minkB;
74  }
75  void setCachedSeperatingAxis(const btVector3& seperatingAxis)
76  {
77  m_cachedSeparatingAxis = seperatingAxis;
78  }
79 
81  {
83  }
85  {
87  }
88 
90  {
91  m_penetrationDepthSolver = penetrationDepthSolver;
92  }
93 
95  void setIgnoreMargin(bool ignoreMargin)
96  {
97  m_ignoreMargin = ignoreMargin;
98  }
99 
100 
101 };
102 
103 #endif //BT_GJK_PAIR_DETECTOR_H
btConvexPenetrationDepthSolver * m_penetrationDepthSolver
btVector3 m_cachedSeparatingAxis
btSimplexSolverInterface * m_simplexSolver
btGjkPairDetector(const btConvexShape *objectA, const btConvexShape *objectB, btSimplexSolverInterface *simplexSolver, btConvexPenetrationDepthSolver *penetrationDepthSolver)
btScalar m_cachedSeparatingDistance
ConvexPenetrationDepthSolver provides an interface for penetration depth calculation.
btScalar getCachedSeparatingDistance() const
void setMinkowskiB(const btConvexShape *minkB)
void setMinkowskiA(const btConvexShape *minkA)
void setPenetrationDepthSolver(btConvexPenetrationDepthSolver *penetrationDepthSolver)
The btConvexShape is an abstract shape interface, implemented by all convex shapes such as btBoxShape...
Definition: btConvexShape.h:31
const btVector3 & getCachedSeparatingAxis() const
#define btSimplexSolverInterface
The btIDebugDraw interface class allows hooking up a debug renderer to visually debug simulations...
Definition: btIDebugDraw.h:28
virtual ~btGjkPairDetector()
const btConvexShape * m_minkowskiB
btVector3 can be used to represent 3D points and vectors.
Definition: btVector3.h:83
This interface is made to be used by an iterative approach to do TimeOfImpact calculations This inter...
btGjkPairDetector uses GJK to implement the btDiscreteCollisionDetectorInterface
void setCachedSeperatingAxis(const btVector3 &seperatingAxis)
const btConvexShape * m_minkowskiA
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:266
virtual void getClosestPoints(const ClosestPointInput &input, Result &output, class btIDebugDraw *debugDraw, bool swapResults=false)
void setIgnoreMargin(bool ignoreMargin)
don't use setIgnoreMargin, it's for Bullet's internal use
void getClosestPointsNonVirtual(const ClosestPointInput &input, Result &output, class btIDebugDraw *debugDraw)