Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/masterserver2/src/external/bullet/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h @ 8795

Last change on this file since 8795 was 5781, checked in by rgrieder, 15 years ago

Reverted trunk again. We might want to find a way to delete these revisions again (x3n's changes are still available as diff in the commit mails).

  • Property svn:eol-style set to native
File size: 2.8 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 "BulletCollision/CollisionShapes/btCollisionMargin.h"
24
25class btConvexShape;
26#include "btSimplexSolverInterface.h"
27class btConvexPenetrationDepthSolver;
28
29/// btGjkPairDetector uses GJK to implement the btDiscreteCollisionDetectorInterface
30class btGjkPairDetector : public btDiscreteCollisionDetectorInterface
31{
32       
33
34        btVector3       m_cachedSeparatingAxis;
35        btConvexPenetrationDepthSolver* m_penetrationDepthSolver;
36        btSimplexSolverInterface* m_simplexSolver;
37        const btConvexShape* m_minkowskiA;
38        const btConvexShape* m_minkowskiB;
39        bool            m_ignoreMargin;
40        btScalar        m_cachedSeparatingDistance;
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        const btVector3& getCachedSeparatingAxis() const
72        {
73                return m_cachedSeparatingAxis;
74        }
75        btScalar        getCachedSeparatingDistance() const
76        {
77                return m_cachedSeparatingDistance;
78        }
79
80        void    setPenetrationDepthSolver(btConvexPenetrationDepthSolver*       penetrationDepthSolver)
81        {
82                m_penetrationDepthSolver = penetrationDepthSolver;
83        }
84
85        ///don't use setIgnoreMargin, it's for Bullet's internal use
86        void    setIgnoreMargin(bool ignoreMargin)
87        {
88                m_ignoreMargin = ignoreMargin;
89        }
90
91
92};
93
94#endif //GJK_PAIR_DETECTOR_H
Note: See TracBrowser for help on using the repository browser.