Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/physics/src/bullet/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h @ 2122

Last change on this file since 2122 was 2119, checked in by rgrieder, 16 years ago

Merged physics branch into physics_new branch.

  • Property svn:eol-style set to native
File size: 2.7 KB
Line 
1/*
2Bullet Continuous Collision Detection and Physics Library
3Copyright (c) 2003-2006 Erwin Coumans  http://continuousphysics.com/Bullet/
4
5This software is provided 'as-is', without any express or implied warranty.
6In no event will the authors be held liable for any damages arising from the use of this software.
7Permission is granted to anyone to use this software for any purpose,
8including commercial applications, and to alter it and redistribute it freely,
9subject to the following restrictions:
10
111. 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.
122. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
133. This notice may not be removed or altered from any source distribution.
14*/
15
16
17
18
19#ifndef GJK_PAIR_DETECTOR_H
20#define GJK_PAIR_DETECTOR_H
21
22#include "btDiscreteCollisionDetectorInterface.h"
23#include "LinearMath/btPoint3.h"
24#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
25
26class btConvexShape;
27#include "btSimplexSolverInterface.h"
28class btConvexPenetrationDepthSolver;
29
30/// btGjkPairDetector uses GJK to implement the btDiscreteCollisionDetectorInterface
31class btGjkPairDetector : public btDiscreteCollisionDetectorInterface
32{
33       
34
35        btVector3       m_cachedSeparatingAxis;
36        btConvexPenetrationDepthSolver* m_penetrationDepthSolver;
37        btSimplexSolverInterface* m_simplexSolver;
38        const btConvexShape* m_minkowskiA;
39        const btConvexShape* m_minkowskiB;
40        bool            m_ignoreMargin;
41       
42
43public:
44
45        //some debugging to fix degeneracy problems
46        int                     m_lastUsedMethod;
47        int                     m_curIter;
48        int                     m_degenerateSimplex;
49        int                     m_catchDegeneracies;
50
51
52        btGjkPairDetector(const btConvexShape* objectA,const btConvexShape* objectB,btSimplexSolverInterface* simplexSolver,btConvexPenetrationDepthSolver*     penetrationDepthSolver);
53        virtual ~btGjkPairDetector() {};
54
55        virtual void    getClosestPoints(const ClosestPointInput& input,Result& output,class btIDebugDraw* debugDraw,bool swapResults=false);
56
57        void setMinkowskiA(btConvexShape* minkA)
58        {
59                m_minkowskiA = minkA;
60        }
61
62        void setMinkowskiB(btConvexShape* minkB)
63        {
64                m_minkowskiB = minkB;
65        }
66        void setCachedSeperatingAxis(const btVector3& seperatingAxis)
67        {
68                m_cachedSeparatingAxis = seperatingAxis;
69        }
70
71        void    setPenetrationDepthSolver(btConvexPenetrationDepthSolver*       penetrationDepthSolver)
72        {
73                m_penetrationDepthSolver = penetrationDepthSolver;
74        }
75
76        ///don't use setIgnoreMargin, it's for Bullet's internal use
77        void    setIgnoreMargin(bool ignoreMargin)
78        {
79                m_ignoreMargin = ignoreMargin;
80        }
81
82
83};
84
85#endif //GJK_PAIR_DETECTOR_H
Note: See TracBrowser for help on using the repository browser.