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

Bullet Collision Detection & Physics Library

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

btMultiBodyConstraintSolver.h
Go to the documentation of this file.
1/*
2Bullet Continuous Collision Detection and Physics Library
3Copyright (c) 2013 Erwin Coumans http://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_MULTIBODY_CONSTRAINT_SOLVER_H
17#define BT_MULTIBODY_CONSTRAINT_SOLVER_H
18
19#include "BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h"
20#include "btMultiBodySolverConstraint.h"
21
22#define DIRECTLY_UPDATE_VELOCITY_DURING_SOLVER_ITERATIONS
23
24class btMultiBody;
25
26#include "btMultiBodyConstraint.h"
27
28 ATTRIBUTE_ALIGNED16(class)
29 btMultiBodyConstraintSolver : public btSequentialImpulseConstraintSolver
30{
31protected:
32 btMultiBodyConstraintArray m_multiBodyNonContactConstraints;
33
34 btMultiBodyConstraintArray m_multiBodyNormalContactConstraints;
35 btMultiBodyConstraintArray m_multiBodyFrictionContactConstraints;
36 btMultiBodyConstraintArray m_multiBodyTorsionalFrictionContactConstraints;
37 btMultiBodyConstraintArray m_multiBodySpinningFrictionContactConstraints;
38
39 btMultiBodyJacobianData m_data;
40
41 //temp storage for multi body constraints for a specific island/group called by 'solveGroup'
42 btMultiBodyConstraint** m_tmpMultiBodyConstraints;
43 int m_tmpNumMultiBodyConstraints;
44
45 btScalar resolveSingleConstraintRowGeneric(const btMultiBodySolverConstraint& c);
46
47 //solve 2 friction directions and clamp against the implicit friction cone
48 btScalar resolveConeFrictionConstraintRows(const btMultiBodySolverConstraint& cA1, const btMultiBodySolverConstraint& cB);
49
50 void convertContacts(btPersistentManifold * *manifoldPtr, int numManifolds, const btContactSolverInfo& infoGlobal);
51
52 btMultiBodySolverConstraint& addMultiBodyFrictionConstraint(const btVector3& normalAxis, const btScalar& appliedImpulse, btPersistentManifold* manifold, int frictionIndex, btManifoldPoint& cp, btCollisionObject* colObj0, btCollisionObject* colObj1, btScalar relaxation, const btContactSolverInfo& infoGlobal, btScalar desiredVelocity = 0, btScalar cfmSlip = 0);
53
54 btMultiBodySolverConstraint& addMultiBodyTorsionalFrictionConstraint(const btVector3& normalAxis, btPersistentManifold* manifold, int frictionIndex, btManifoldPoint& cp,
55 btScalar combinedTorsionalFriction,
56 btCollisionObject* colObj0, btCollisionObject* colObj1, btScalar relaxation, const btContactSolverInfo& infoGlobal, btScalar desiredVelocity = 0, btScalar cfmSlip = 0);
57
58 btMultiBodySolverConstraint& addMultiBodySpinningFrictionConstraint(const btVector3& normalAxis, btPersistentManifold* manifold, int frictionIndex, btManifoldPoint& cp,
59 btScalar combinedTorsionalFriction,
60 btCollisionObject* colObj0, btCollisionObject* colObj1, btScalar relaxation, const btContactSolverInfo& infoGlobal, btScalar desiredVelocity = 0, btScalar cfmSlip = 0);
61
62 void setupMultiBodyJointLimitConstraint(btMultiBodySolverConstraint & constraintRow,
63 btScalar * jacA, btScalar * jacB,
64 btScalar penetration, btScalar combinedFrictionCoeff, btScalar combinedRestitutionCoeff,
65 const btContactSolverInfo& infoGlobal);
66
67 void setupMultiBodyContactConstraint(btMultiBodySolverConstraint & solverConstraint,
68 const btVector3& contactNormal,
69 const btScalar& appliedImpulse,
70 btManifoldPoint& cp,
71 const btContactSolverInfo& infoGlobal,
72 btScalar& relaxation,
73 bool isFriction, btScalar desiredVelocity = 0, btScalar cfmSlip = 0);
74
75 //either rolling or spinning friction
76 void setupMultiBodyTorsionalFrictionConstraint(btMultiBodySolverConstraint & solverConstraint,
77 const btVector3& contactNormal,
78 btManifoldPoint& cp,
79 btScalar combinedTorsionalFriction,
80 const btContactSolverInfo& infoGlobal,
81 btScalar& relaxation,
82 bool isFriction, btScalar desiredVelocity = 0, btScalar cfmSlip = 0);
83
84 void convertMultiBodyContact(btPersistentManifold * manifold, const btContactSolverInfo& infoGlobal);
85 virtual btScalar solveGroupCacheFriendlySetup(btCollisionObject * *bodies, int numBodies, btPersistentManifold** manifoldPtr, int numManifolds, btTypedConstraint** constraints, int numConstraints, const btContactSolverInfo& infoGlobal, btIDebugDraw* debugDrawer);
86 // virtual btScalar solveGroupCacheFriendlyIterations(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer);
87 virtual btScalar solveSingleIteration(int iteration, btCollisionObject** bodies, int numBodies, btPersistentManifold** manifoldPtr, int numManifolds, btTypedConstraint** constraints, int numConstraints, const btContactSolverInfo& infoGlobal, btIDebugDraw* debugDrawer);
88 void applyDeltaVee(btScalar * deltaV, btScalar impulse, int velocityIndex, int ndof);
89 void writeBackSolverBodyToMultiBody(btMultiBodySolverConstraint & constraint, btScalar deltaTime);
90
91public:
92 BT_DECLARE_ALIGNED_ALLOCATOR();
93
95 virtual btScalar solveGroup(btCollisionObject * *bodies, int numBodies, btPersistentManifold** manifold, int numManifolds, btTypedConstraint** constraints, int numConstraints, const btContactSolverInfo& info, btIDebugDraw* debugDrawer, btDispatcher* dispatcher);
96 virtual btScalar solveGroupCacheFriendlyFinish(btCollisionObject * *bodies, int numBodies, const btContactSolverInfo& infoGlobal);
97
98 virtual void solveMultiBodyGroup(btCollisionObject * *bodies, int numBodies, btPersistentManifold** manifold, int numManifolds, btTypedConstraint** constraints, int numConstraints, btMultiBodyConstraint** multiBodyConstraints, int numMultiBodyConstraints, const btContactSolverInfo& info, btIDebugDraw* debugDrawer, btDispatcher* dispatcher);
99};
100
101#endif //BT_MULTIBODY_CONSTRAINT_SOLVER_H
btMultiBodyConstraint.h
btMultiBodySolverConstraint.h
btScalar
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition btScalar.h:314
ATTRIBUTE_ALIGNED16
#define ATTRIBUTE_ALIGNED16(a)
Definition btScalar.h:99
btSequentialImpulseConstraintSolver.h
btAlignedObjectArray< btMultiBodySolverConstraint >
btCollisionObject
btCollisionObject can be used to manage collision detection objects.
Definition btCollisionObject.h:51
btDispatcher
The btDispatcher interface class can be used in combination with broadphase to dispatch calculations ...
Definition btDispatcher.h:77
btIDebugDraw
The btIDebugDraw interface class allows hooking up a debug renderer to visually debug simulations.
Definition btIDebugDraw.h:27
btManifoldPoint
ManifoldContactPoint collects and maintains persistent contactpoints.
Definition btManifoldPoint.h:52
btMultiBodyConstraintSolver
Definition btMultiBodyConstraintSolver.h:30
btMultiBodyConstraintSolver::m_tmpMultiBodyConstraints
btMultiBodyConstraint ** m_tmpMultiBodyConstraints
Definition btMultiBodyConstraintSolver.h:42
btMultiBodyConstraintSolver::m_tmpNumMultiBodyConstraints
int m_tmpNumMultiBodyConstraints
Definition btMultiBodyConstraintSolver.h:43
btMultiBodyConstraintSolver::m_multiBodyTorsionalFrictionContactConstraints
btMultiBodyConstraintArray m_multiBodyTorsionalFrictionContactConstraints
Definition btMultiBodyConstraintSolver.h:36
btMultiBodyConstraintSolver::m_multiBodyNormalContactConstraints
btMultiBodyConstraintArray m_multiBodyNormalContactConstraints
Definition btMultiBodyConstraintSolver.h:34
btMultiBodyConstraintSolver::m_multiBodySpinningFrictionContactConstraints
btMultiBodyConstraintArray m_multiBodySpinningFrictionContactConstraints
Definition btMultiBodyConstraintSolver.h:37
btMultiBodyConstraintSolver::m_multiBodyFrictionContactConstraints
btMultiBodyConstraintArray m_multiBodyFrictionContactConstraints
Definition btMultiBodyConstraintSolver.h:35
btMultiBodyConstraintSolver::m_data
btMultiBodyJacobianData m_data
Definition btMultiBodyConstraintSolver.h:39
btMultiBodyConstraintSolver::BT_DECLARE_ALIGNED_ALLOCATOR
BT_DECLARE_ALIGNED_ALLOCATOR()
btMultiBodyConstraintSolver::setupMultiBodyJointLimitConstraint
void setupMultiBodyJointLimitConstraint(btMultiBodySolverConstraint &constraintRow, btScalar *jacA, btScalar *jacB, btScalar penetration, btScalar combinedFrictionCoeff, btScalar combinedRestitutionCoeff, const btContactSolverInfo &infoGlobal)
btMultiBodyConstraintSolver::m_multiBodyNonContactConstraints
btMultiBodyConstraintArray m_multiBodyNonContactConstraints
Definition btMultiBodyConstraintSolver.h:32
btMultiBodyConstraint
Definition btMultiBodyConstraint.h:57
btMultiBody
Definition btMultiBody.h:51
btPersistentManifold
btPersistentManifold is a contact point cache, it stays persistent as long as objects are overlapping...
Definition btPersistentManifold.h:65
btSequentialImpulseConstraintSolver
The btSequentialImpulseConstraintSolver is a fast SIMD implementation of the Projected Gauss Seidel (...
Definition btSequentialImpulseConstraintSolver.h:52
btTypedConstraint
TypedConstraint is the baseclass for Bullet constraints and vehicles.
Definition btTypedConstraint.h:76
btVector3
btVector3 can be used to represent 3D points and vectors.
Definition btVector3.h:82
btContactSolverInfo
Definition btContactSolverInfo.h:76
btMultiBodyJacobianData
Definition btMultiBodyConstraint.h:44
btMultiBodySolverConstraint
1D constraint along a normal axis between bodyA and bodyB. It can be combined to solve contact and fr...
Definition btMultiBodySolverConstraint.h:30