Bullet Collision Detection & Physics Library
btMultiBodyConstraintSolver.h
Go to the documentation of this file.
1 /*
2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2013 Erwin Coumans http://bulletphysics.org
4 
5 This software is provided 'as-is', without any express or implied warranty.
6 In no event will the authors be held liable for any damages arising from the use of this software.
7 Permission is granted to anyone to use this software for any purpose,
8 including commercial applications, and to alter it and redistribute it freely,
9 subject to the following restrictions:
10 
11 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.
12 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
13 3. 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 
21 
22 
23 class btMultiBody;
24 
25 #include "btMultiBodyConstraint.h"
26 
27 
28 
30 {
31 
32 protected:
33 
35 
38 
40 
41  //temp storage for multi body constraints for a specific island/group called by 'solveGroup'
44 
46  void resolveSingleConstraintRowGenericMultiBody(const btMultiBodySolverConstraint& c);
47 
48  void convertContacts(btPersistentManifold** manifoldPtr,int numManifolds, const btContactSolverInfo& infoGlobal);
49  btMultiBodySolverConstraint& addMultiBodyFrictionConstraint(const btVector3& normalAxis,btPersistentManifold* manifold,int frictionIndex,btManifoldPoint& cp,btCollisionObject* colObj0,btCollisionObject* colObj1, btScalar relaxation, const btContactSolverInfo& infoGlobal, btScalar desiredVelocity=0, btScalar cfmSlip=0);
50 
51 
52  void setupMultiBodyJointLimitConstraint(btMultiBodySolverConstraint& constraintRow,
53  btScalar* jacA,btScalar* jacB,
54  btScalar penetration,btScalar combinedFrictionCoeff, btScalar combinedRestitutionCoeff,
55  const btContactSolverInfo& infoGlobal);
56 
57  void setupMultiBodyContactConstraint(btMultiBodySolverConstraint& solverConstraint,
58  const btVector3& contactNormal,
59  btManifoldPoint& cp, const btContactSolverInfo& infoGlobal,
60  btScalar& relaxation,
61  bool isFriction, btScalar desiredVelocity=0, btScalar cfmSlip=0);
62 
63  void convertMultiBodyContact(btPersistentManifold* manifold,const btContactSolverInfo& infoGlobal);
64  virtual btScalar solveGroupCacheFriendlySetup(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer);
65 // virtual btScalar solveGroupCacheFriendlyIterations(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer);
66 
67  virtual btScalar solveSingleIteration(int iteration, btCollisionObject** bodies ,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer);
68  void applyDeltaVee(btScalar* deltaV, btScalar impulse, int velocityIndex, int ndof);
69 
70 public:
71 
73 
75  virtual btScalar solveGroup(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifold,int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& info, btIDebugDraw* debugDrawer,btDispatcher* dispatcher);
76 
77  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);
78 };
79 
80 
81 
82 
83 
84 #endif //BT_MULTIBODY_CONSTRAINT_SOLVER_H
85 
btPersistentManifold is a contact point cache, it stays persistent as long as objects are overlapping...
1D constraint along a normal axis between bodyA and bodyB. It can be combined to solve contact and fr...
ManifoldContactPoint collects and maintains persistent contactpoints.
void applyDeltaVee(const btScalar *delta_vee)
Definition: btMultiBody.h:269
btMultiBodyConstraintArray m_multiBodyNonContactConstraints
btCollisionObject can be used to manage collision detection objects.
The btIDebugDraw interface class allows hooking up a debug renderer to visually debug simulations...
Definition: btIDebugDraw.h:28
btMultiBodyConstraintArray m_multiBodyFrictionContactConstraints
The btSequentialImpulseConstraintSolver is a fast SIMD implementation of the Projected Gauss Seidel (...
btVector3 can be used to represent 3D points and vectors.
Definition: btVector3.h:83
#define ATTRIBUTE_ALIGNED16(a)
Definition: btScalar.h:59
TypedConstraint is the baseclass for Bullet constraints and vehicles.
btMultiBodyConstraintArray m_multiBodyNormalContactConstraints
#define BT_DECLARE_ALIGNED_ALLOCATOR()
Definition: btScalar.h:357
btMultiBodyConstraint ** m_tmpMultiBodyConstraints
void resolveSingleConstraintRowGeneric(PfxSolverBody &body1, PfxSolverBody &body2, const btSolverConstraint &c)
The btDispatcher interface class can be used in combination with broadphase to dispatch calculations ...
Definition: btDispatcher.h:69
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:266