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 BT_GJK_PAIR_DETECTOR_H
00020 #define BT_GJK_PAIR_DETECTOR_H
00021 
00022 #include "btDiscreteCollisionDetectorInterface.h"
00023 #include "BulletCollision/CollisionShapes/btCollisionMargin.h"
00024 
00025 class btConvexShape;
00026 #include "btSimplexSolverInterface.h"
00027 class btConvexPenetrationDepthSolver;
00028 
00030 class btGjkPairDetector : public btDiscreteCollisionDetectorInterface
00031 {
00032         
00033 
00034         btVector3       m_cachedSeparatingAxis;
00035         btConvexPenetrationDepthSolver* m_penetrationDepthSolver;
00036         btSimplexSolverInterface* m_simplexSolver;
00037         const btConvexShape* m_minkowskiA;
00038         const btConvexShape* m_minkowskiB;
00039         int     m_shapeTypeA;
00040         int m_shapeTypeB;
00041         btScalar        m_marginA;
00042         btScalar        m_marginB;
00043 
00044         bool            m_ignoreMargin;
00045         btScalar        m_cachedSeparatingDistance;
00046         
00047 
00048 public:
00049 
00050         //some debugging to fix degeneracy problems
00051         int                     m_lastUsedMethod;
00052         int                     m_curIter;
00053         int                     m_degenerateSimplex;
00054         int                     m_catchDegeneracies;
00055 
00056 
00057         btGjkPairDetector(const btConvexShape* objectA,const btConvexShape* objectB,btSimplexSolverInterface* simplexSolver,btConvexPenetrationDepthSolver*     penetrationDepthSolver);
00058         btGjkPairDetector(const btConvexShape* objectA,const btConvexShape* objectB,int shapeTypeA,int shapeTypeB,btScalar marginA, btScalar marginB, btSimplexSolverInterface* simplexSolver,btConvexPenetrationDepthSolver*   penetrationDepthSolver);
00059         virtual ~btGjkPairDetector() {};
00060 
00061         virtual void    getClosestPoints(const ClosestPointInput& input,Result& output,class btIDebugDraw* debugDraw,bool swapResults=false);
00062 
00063         void    getClosestPointsNonVirtual(const ClosestPointInput& input,Result& output,class btIDebugDraw* debugDraw);
00064         
00065 
00066         void setMinkowskiA(btConvexShape* minkA)
00067         {
00068                 m_minkowskiA = minkA;
00069         }
00070 
00071         void setMinkowskiB(btConvexShape* minkB)
00072         {
00073                 m_minkowskiB = minkB;
00074         }
00075         void setCachedSeperatingAxis(const btVector3& seperatingAxis)
00076         {
00077                 m_cachedSeparatingAxis = seperatingAxis;
00078         }
00079 
00080         const btVector3& getCachedSeparatingAxis() const
00081         {
00082                 return m_cachedSeparatingAxis;
00083         }
00084         btScalar        getCachedSeparatingDistance() const
00085         {
00086                 return m_cachedSeparatingDistance;
00087         }
00088 
00089         void    setPenetrationDepthSolver(btConvexPenetrationDepthSolver*       penetrationDepthSolver)
00090         {
00091                 m_penetrationDepthSolver = penetrationDepthSolver;
00092         }
00093 
00095         void    setIgnoreMargin(bool ignoreMargin)
00096         {
00097                 m_ignoreMargin = ignoreMargin;
00098         }
00099 
00100 
00101 };
00102 
00103 #endif //BT_GJK_PAIR_DETECTOR_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


bullet
Author(s): Erwin Coumans, ROS package maintained by Tully Foote
autogenerated on Wed Oct 31 2012 07:54:31