Bullet Collision Detection & Physics Library: btConvexConvexAlgorithm.h Source File

Bullet Collision Detection & Physics Library

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

btConvexConvexAlgorithm.h
Go to the documentation of this file.
1/*
2Bullet Continuous Collision Detection and Physics Library
3Copyright (c) 2003-2006 Erwin Coumans https://bulletphysics.org
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#ifndef BT_CONVEX_CONVEX_ALGORITHM_H
17#define BT_CONVEX_CONVEX_ALGORITHM_H
18
19#include "btActivatingCollisionAlgorithm.h"
20#include "BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h"
21#include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h"
22#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
23#include "BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h"
24#include "btCollisionCreateFunc.h"
25#include "btCollisionDispatcher.h"
26#include "LinearMath/btTransformUtil.h" //for btConvexSeparatingDistanceUtil
27#include "BulletCollision/NarrowPhaseCollision/btPolyhedralContactClipping.h"
28
29class btConvexPenetrationDepthSolver;
30
35
36//#define USE_SEPDISTANCE_UTIL2 1
37
41 class btConvexConvexAlgorithm : public btActivatingCollisionAlgorithm
42{
43#ifdef USE_SEPDISTANCE_UTIL2
44 btConvexSeparatingDistanceUtil m_sepDistance;
45#endif
46 btConvexPenetrationDepthSolver* m_pdSolver;
47
48 btVertexArray worldVertsB1;
49 btVertexArray worldVertsB2;
50
51 bool m_ownManifold;
52 btPersistentManifold* m_manifoldPtr;
53 bool m_lowLevelOfDetail;
54
55 int m_numPerturbationIterations;
56 int m_minimumPointsPerturbationThreshold;
57
59
60public:
61 btConvexConvexAlgorithm(btPersistentManifold* mf, const btCollisionAlgorithmConstructionInfo& ci, const btCollisionObjectWrapper* body0Wrap, const btCollisionObjectWrapper* body1Wrap, btConvexPenetrationDepthSolver* pdSolver, int numPerturbationIterations, int minimumPointsPerturbationThreshold);
62
63 virtual ~btConvexConvexAlgorithm();
64
65 virtual void processCollision(const btCollisionObjectWrapper* body0Wrap, const btCollisionObjectWrapper* body1Wrap, const btDispatcherInfo& dispatchInfo, btManifoldResult* resultOut);
66
67 virtual btScalar calculateTimeOfImpact(btCollisionObject* body0, btCollisionObject* body1, const btDispatcherInfo& dispatchInfo, btManifoldResult* resultOut);
68
69 virtual void getAllContactManifolds(btManifoldArray& manifoldArray)
70 {
72 if (m_manifoldPtr && m_ownManifold)
73 manifoldArray.push_back(m_manifoldPtr);
74 }
75
76 void setLowLevelOfDetail(bool useLowLevel);
77
78 const btPersistentManifold* getManifold()
79 {
80 return m_manifoldPtr;
81 }
82
83 struct CreateFunc : public btCollisionAlgorithmCreateFunc
84 {
85 btConvexPenetrationDepthSolver* m_pdSolver;
86 int m_numPerturbationIterations;
87 int m_minimumPointsPerturbationThreshold;
88
89 CreateFunc(btConvexPenetrationDepthSolver* pdSolver);
90
91 virtual ~CreateFunc();
92
93 virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, const btCollisionObjectWrapper* body0Wrap, const btCollisionObjectWrapper* body1Wrap)
94 {
95 void* mem = ci.m_dispatcher1->allocateCollisionAlgorithm(sizeof(btConvexConvexAlgorithm));
96 return new (mem) btConvexConvexAlgorithm(ci.m_manifold, ci, body0Wrap, body1Wrap, m_pdSolver, m_numPerturbationIterations, m_minimumPointsPerturbationThreshold);
97 }
98 };
99};
100
101#endif //BT_CONVEX_CONVEX_ALGORITHM_H
btActivatingCollisionAlgorithm.h
btBroadphaseProxy.h
btCollisionCreateFunc.h
btCollisionDispatcher.h
btGjkPairDetector.h
btPersistentManifold.h
btPolyhedralContactClipping.h
btScalar
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:314
btTransformUtil.h
btVoronoiSimplexSolver.h
btActivatingCollisionAlgorithm
This class is not enabled yet (work-in-progress) to more aggressively activate objects.
Definition: btActivatingCollisionAlgorithm.h:23
btAlignedObjectArray< btVector3 >
btAlignedObjectArray::push_back
void push_back(const T &_Val)
Definition: btAlignedObjectArray.h:257
btCollisionAlgorithm
btCollisionAlgorithm is an collision interface that is compatible with the Broadphase and btDispatche...
Definition: btCollisionAlgorithm.h:54
btCollisionObject
btCollisionObject can be used to manage collision detection objects.
Definition: btCollisionObject.h:51
btConvexConvexAlgorithm
Enabling USE_SEPDISTANCE_UTIL2 requires 100% reliable distance computation.
Definition: btConvexConvexAlgorithm.h:42
btConvexConvexAlgorithm::m_manifoldPtr
btPersistentManifold * m_manifoldPtr
Definition: btConvexConvexAlgorithm.h:52
btConvexConvexAlgorithm::getManifold
const btPersistentManifold * getManifold()
Definition: btConvexConvexAlgorithm.h:78
btConvexConvexAlgorithm::m_lowLevelOfDetail
bool m_lowLevelOfDetail
Definition: btConvexConvexAlgorithm.h:53
btConvexConvexAlgorithm::~btConvexConvexAlgorithm
virtual ~btConvexConvexAlgorithm()
Definition: btConvexConvexAlgorithm.cpp:201
btConvexConvexAlgorithm::m_pdSolver
btConvexPenetrationDepthSolver * m_pdSolver
Definition: btConvexConvexAlgorithm.h:46
btConvexConvexAlgorithm::calculateTimeOfImpact
virtual btScalar calculateTimeOfImpact(btCollisionObject *body0, btCollisionObject *body1, const btDispatcherInfo &dispatchInfo, btManifoldResult *resultOut)
Definition: btConvexConvexAlgorithm.cpp:792
btConvexConvexAlgorithm::setLowLevelOfDetail
void setLowLevelOfDetail(bool useLowLevel)
Definition: btConvexConvexAlgorithm.cpp:210
btConvexConvexAlgorithm::m_minimumPointsPerturbationThreshold
int m_minimumPointsPerturbationThreshold
Definition: btConvexConvexAlgorithm.h:56
btConvexConvexAlgorithm::worldVertsB2
btVertexArray worldVertsB2
Definition: btConvexConvexAlgorithm.h:49
btConvexConvexAlgorithm::getAllContactManifolds
virtual void getAllContactManifolds(btManifoldArray &manifoldArray)
Definition: btConvexConvexAlgorithm.h:69
btConvexConvexAlgorithm::processCollision
virtual void processCollision(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btDispatcherInfo &dispatchInfo, btManifoldResult *resultOut)
Definition: btConvexConvexAlgorithm.cpp:273
btConvexConvexAlgorithm::worldVertsB1
btVertexArray worldVertsB1
Definition: btConvexConvexAlgorithm.h:48
btConvexConvexAlgorithm::m_ownManifold
bool m_ownManifold
Definition: btConvexConvexAlgorithm.h:51
btConvexConvexAlgorithm::m_numPerturbationIterations
int m_numPerturbationIterations
Definition: btConvexConvexAlgorithm.h:55
btConvexPenetrationDepthSolver
ConvexPenetrationDepthSolver provides an interface for penetration depth calculation.
Definition: btConvexPenetrationDepthSolver.h:26
btConvexSeparatingDistanceUtil
The btConvexSeparatingDistanceUtil can help speed up convex collision detection by conservatively upd...
Definition: btTransformUtil.h:148
btDispatcher::allocateCollisionAlgorithm
virtual void * allocateCollisionAlgorithm(int size)=0
btManifoldResult
btManifoldResult is a helper class to manage contact results.
Definition: btManifoldResult.h:48
btPersistentManifold
btPersistentManifold is a contact point cache, it stays persistent as long as objects are overlapping...
Definition: btPersistentManifold.h:65
btCollisionAlgorithmConstructionInfo
Definition: btCollisionAlgorithm.h:33
btCollisionAlgorithmConstructionInfo::m_manifold
btPersistentManifold * m_manifold
Definition: btCollisionAlgorithm.h:46
btCollisionAlgorithmConstructionInfo::m_dispatcher1
btDispatcher * m_dispatcher1
Definition: btCollisionAlgorithm.h:45
btCollisionAlgorithmCreateFunc
Used by the btCollisionDispatcher to register and create instances for btCollisionAlgorithm.
Definition: btCollisionCreateFunc.h:27
btCollisionObjectWrapper
Definition: btCollisionObjectWrapper.h:18
btConvexConvexAlgorithm::CreateFunc
Definition: btConvexConvexAlgorithm.h:84
btConvexConvexAlgorithm::CreateFunc::m_numPerturbationIterations
int m_numPerturbationIterations
Definition: btConvexConvexAlgorithm.h:86
btConvexConvexAlgorithm::CreateFunc::CreateCollisionAlgorithm
virtual btCollisionAlgorithm * CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo &ci, const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap)
Definition: btConvexConvexAlgorithm.h:93
btConvexConvexAlgorithm::CreateFunc::~CreateFunc
virtual ~CreateFunc()
Definition: btConvexConvexAlgorithm.cpp:180
btConvexConvexAlgorithm::CreateFunc::m_minimumPointsPerturbationThreshold
int m_minimumPointsPerturbationThreshold
Definition: btConvexConvexAlgorithm.h:87
btConvexConvexAlgorithm::CreateFunc::m_pdSolver
btConvexPenetrationDepthSolver * m_pdSolver
Definition: btConvexConvexAlgorithm.h:85
btDispatcherInfo
Definition: btDispatcher.h:31