Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef BT_CONVEX_2D_CONVEX_2D_ALGORITHM_H
00017 #define BT_CONVEX_2D_CONVEX_2D_ALGORITHM_H
00018
00019 #include "BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.h"
00020 #include "BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h"
00021 #include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h"
00022 #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
00023 #include "BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h"
00024 #include "BulletCollision/CollisionDispatch/btCollisionCreateFunc.h"
00025 #include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h"
00026 #include "LinearMath/btTransformUtil.h"
00027
00028 class btConvexPenetrationDepthSolver;
00029
00030
00033 class btConvex2dConvex2dAlgorithm : public btActivatingCollisionAlgorithm
00034 {
00035 btSimplexSolverInterface* m_simplexSolver;
00036 btConvexPenetrationDepthSolver* m_pdSolver;
00037
00038
00039 bool m_ownManifold;
00040 btPersistentManifold* m_manifoldPtr;
00041 bool m_lowLevelOfDetail;
00042
00043 int m_numPerturbationIterations;
00044 int m_minimumPointsPerturbationThreshold;
00045
00046 public:
00047
00048 btConvex2dConvex2dAlgorithm(btPersistentManifold* mf,const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* body0,btCollisionObject* body1, btSimplexSolverInterface* simplexSolver, btConvexPenetrationDepthSolver* pdSolver, int numPerturbationIterations, int minimumPointsPerturbationThreshold);
00049
00050
00051 virtual ~btConvex2dConvex2dAlgorithm();
00052
00053 virtual void processCollision (btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
00054
00055 virtual btScalar calculateTimeOfImpact(btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
00056
00057 virtual void getAllContactManifolds(btManifoldArray& manifoldArray)
00058 {
00060 if (m_manifoldPtr && m_ownManifold)
00061 manifoldArray.push_back(m_manifoldPtr);
00062 }
00063
00064
00065 void setLowLevelOfDetail(bool useLowLevel);
00066
00067
00068 const btPersistentManifold* getManifold()
00069 {
00070 return m_manifoldPtr;
00071 }
00072
00073 struct CreateFunc :public btCollisionAlgorithmCreateFunc
00074 {
00075
00076 btConvexPenetrationDepthSolver* m_pdSolver;
00077 btSimplexSolverInterface* m_simplexSolver;
00078 int m_numPerturbationIterations;
00079 int m_minimumPointsPerturbationThreshold;
00080
00081 CreateFunc(btSimplexSolverInterface* simplexSolver, btConvexPenetrationDepthSolver* pdSolver);
00082
00083 virtual ~CreateFunc();
00084
00085 virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1)
00086 {
00087 void* mem = ci.m_dispatcher1->allocateCollisionAlgorithm(sizeof(btConvex2dConvex2dAlgorithm));
00088 return new(mem) btConvex2dConvex2dAlgorithm(ci.m_manifold,ci,body0,body1,m_simplexSolver,m_pdSolver,m_numPerturbationIterations,m_minimumPointsPerturbationThreshold);
00089 }
00090 };
00091
00092
00093 };
00094
00095 #endif //BT_CONVEX_2D_CONVEX_2D_ALGORITHM_H