Blender  V3.3
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 #ifndef BT_GJK_PAIR_DETECTOR_H
17 #define BT_GJK_PAIR_DETECTOR_H
18 
21 
22 class btConvexShape;
25 
28 {
29  btVector3 m_cachedSeparatingAxis;
30  btConvexPenetrationDepthSolver* m_penetrationDepthSolver;
31  btSimplexSolverInterface* m_simplexSolver;
32  const btConvexShape* m_minkowskiA;
33  const btConvexShape* m_minkowskiB;
34  int m_shapeTypeA;
35  int m_shapeTypeB;
36  btScalar m_marginA;
37  btScalar m_marginB;
38 
39  bool m_ignoreMargin;
40  btScalar m_cachedSeparatingDistance;
41 
42 public:
43  //some debugging to fix degeneracy problems
45  int m_curIter;
49 
50  btGjkPairDetector(const btConvexShape* objectA, const btConvexShape* objectB, btSimplexSolverInterface* simplexSolver, btConvexPenetrationDepthSolver* penetrationDepthSolver);
51  btGjkPairDetector(const btConvexShape* objectA, const btConvexShape* objectB, int shapeTypeA, int shapeTypeB, btScalar marginA, btScalar marginB, btSimplexSolverInterface* simplexSolver, btConvexPenetrationDepthSolver* penetrationDepthSolver);
52  virtual ~btGjkPairDetector(){};
53 
54  virtual void getClosestPoints(const ClosestPointInput& input, Result& output, class btIDebugDraw* debugDraw, bool swapResults = false);
55 
56  void getClosestPointsNonVirtual(const ClosestPointInput& input, Result& output, class btIDebugDraw* debugDraw);
57 
58  void setMinkowskiA(const btConvexShape* minkA)
59  {
60  m_minkowskiA = minkA;
61  }
62 
63  void setMinkowskiB(const btConvexShape* minkB)
64  {
65  m_minkowskiB = minkB;
66  }
67  void setCachedSeparatingAxis(const btVector3& separatingAxis)
68  {
69  m_cachedSeparatingAxis = separatingAxis;
70  }
71 
73  {
74  return m_cachedSeparatingAxis;
75  }
77  {
78  return m_cachedSeparatingDistance;
79  }
80 
82  {
83  m_penetrationDepthSolver = penetrationDepthSolver;
84  }
85 
87  void setIgnoreMargin(bool ignoreMargin)
88  {
89  m_ignoreMargin = ignoreMargin;
90  }
91 };
92 
93 #endif //BT_GJK_PAIR_DETECTOR_H
btConvexShape()
not supported on IBM SDK, until we fix the alignment of btVector3
void debugDraw(btIDebugDraw *debugDrawer)
btActionInterface interface
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:314
#define btSimplexSolverInterface
btVector3
btVector3 can be used to represent 3D points and vectors. It has an un-used w component to suit 16-by...
Definition: btVector3.h:82
ConvexPenetrationDepthSolver provides an interface for penetration depth calculation.
btGjkPairDetector uses GJK to implement the btDiscreteCollisionDetectorInterface
void setPenetrationDepthSolver(btConvexPenetrationDepthSolver *penetrationDepthSolver)
virtual void getClosestPoints(const ClosestPointInput &input, Result &output, class btIDebugDraw *debugDraw, bool swapResults=false)
btScalar getCachedSeparatingDistance() const
void setCachedSeparatingAxis(const btVector3 &separatingAxis)
btGjkPairDetector(const btConvexShape *objectA, const btConvexShape *objectB, btSimplexSolverInterface *simplexSolver, btConvexPenetrationDepthSolver *penetrationDepthSolver)
virtual ~btGjkPairDetector()
void setIgnoreMargin(bool ignoreMargin)
don't use setIgnoreMargin, it's for Bullet's internal use
void setMinkowskiA(const btConvexShape *minkA)
const btVector3 & getCachedSeparatingAxis() const
void getClosestPointsNonVirtual(const ClosestPointInput &input, Result &output, class btIDebugDraw *debugDraw)
void setMinkowskiB(const btConvexShape *minkB)
ccl_global KernelShaderEvalInput ccl_global float * output
ccl_global KernelShaderEvalInput * input