Back to index

supertuxkart  0.5+dfsg1
btGjkPairDetector.h
Go to the documentation of this file.
00001 /*
00002 Bullet Continuous Collision Detection and Physics Library
00003 Copyright (c) 2003-2006 Erwin Coumans  http://continuousphysics.com/Bullet/
00004 
00005 This software is provided 'as-is', without any express or implied warranty.
00006 In no event will the authors be held liable for any damages arising from the use of this software.
00007 Permission is granted to anyone to use this software for any purpose, 
00008 including commercial applications, and to alter it and redistribute it freely, 
00009 subject to the following restrictions:
00010 
00011 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.
00012 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
00013 3. This notice may not be removed or altered from any source distribution.
00014 */
00015 
00016 
00017 
00018 
00019 #ifndef GJK_PAIR_DETECTOR_H
00020 #define GJK_PAIR_DETECTOR_H
00021 
00022 #include "btDiscreteCollisionDetectorInterface.h"
00023 #include "LinearMath/btPoint3.h"
00024 #include "BulletCollision/CollisionShapes/btCollisionMargin.h"
00025 
00026 class btConvexShape;
00027 #include "btSimplexSolverInterface.h"
00028 class btConvexPenetrationDepthSolver;
00029 
00031 class btGjkPairDetector : public btDiscreteCollisionDetectorInterface
00032 {
00033        
00034 
00035        btVector3     m_cachedSeparatingAxis;
00036        btConvexPenetrationDepthSolver*    m_penetrationDepthSolver;
00037        btSimplexSolverInterface* m_simplexSolver;
00038        const btConvexShape* m_minkowskiA;
00039        const btConvexShape* m_minkowskiB;
00040        bool          m_ignoreMargin;
00041        
00042 
00043 public:
00044 
00045        //some debugging to fix degeneracy problems
00046        int                  m_lastUsedMethod;
00047        int                  m_curIter;
00048        int                  m_degenerateSimplex;
00049        int                  m_catchDegeneracies;
00050 
00051 
00052        btGjkPairDetector(const btConvexShape* objectA,const btConvexShape* objectB,btSimplexSolverInterface* simplexSolver,btConvexPenetrationDepthSolver*       penetrationDepthSolver);
00053        virtual ~btGjkPairDetector() {};
00054 
00055        virtual void  getClosestPoints(const ClosestPointInput& input,Result& output,class btIDebugDraw* debugDraw);
00056 
00057        void setMinkowskiA(btConvexShape* minkA)
00058        {
00059               m_minkowskiA = minkA;
00060        }
00061 
00062        void setMinkowskiB(btConvexShape* minkB)
00063        {
00064               m_minkowskiB = minkB;
00065        }
00066        void setCachedSeperatingAxis(const btVector3& seperatingAxis)
00067        {
00068               m_cachedSeparatingAxis = seperatingAxis;
00069        }
00070 
00071        void   setPenetrationDepthSolver(btConvexPenetrationDepthSolver*      penetrationDepthSolver)
00072        {
00073               m_penetrationDepthSolver = penetrationDepthSolver;
00074        }
00075 
00077        void   setIgnoreMargin(bool ignoreMargin)
00078        {
00079               m_ignoreMargin = ignoreMargin;
00080        }
00081 
00082 
00083 };
00084 
00085 #endif //GJK_PAIR_DETECTOR_H