Bullet Collision Detection & Physics Library
btMultiBodyMLCPConstraintSolver.h
Go to the documentation of this file.
1 /*
2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2018 Google Inc. 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_MLCP_CONSTRAINT_SOLVER_H
17 #define BT_MULTIBODY_MLCP_CONSTRAINT_SOLVER_H
18 
19 #include "LinearMath/btMatrixX.h"
20 #include "LinearMath/btThreads.h"
22 
24 class btMultiBody;
25 
27 {
28 protected:
31 
34 
37 
40 
43 
46 
48 
52 
55 
58 
60 
63 
66 
69 
72 
75 
78 
80 
88 
96 
99 
102 
105 
108 
115 
118 
121 
124 
126 
128  virtual void createMLCPFast(const btContactSolverInfo& infoGlobal);
129 
131  void createMLCPFastRigidBody(const btContactSolverInfo& infoGlobal);
132 
134  void createMLCPFastMultiBody(const btContactSolverInfo& infoGlobal);
135 
137  virtual bool solveMLCP(const btContactSolverInfo& infoGlobal);
138 
139  // Documentation inherited
141  btCollisionObject** bodies,
142  int numBodies,
143  btPersistentManifold** manifoldPtr,
144  int numManifolds,
145  btTypedConstraint** constraints,
146  int numConstraints,
147  const btContactSolverInfo& infoGlobal,
148  btIDebugDraw* debugDrawer) BT_OVERRIDE;
149 
150  // Documentation inherited
152  btCollisionObject** bodies,
153  int numBodies,
154  btPersistentManifold** manifoldPtr,
155  int numManifolds,
156  btTypedConstraint** constraints,
157  int numConstraints,
158  const btContactSolverInfo& infoGlobal,
159  btIDebugDraw* debugDrawer) ;
160 
161 public:
163 
164 
169 
172 
174  void setMLCPSolver(btMLCPSolverInterface* solver);
175 
178  int getNumFallbacks() const;
179 
181  void setNumFallbacks(int num);
182 
184  virtual btConstraintSolverType getSolverType() const;
185 };
186 
187 #endif // BT_MULTIBODY_MLCP_CONSTRAINT_SOLVER_H
btConstraintSolverType
btConstraintSolver provides solver interface
#define btMatrixXu
Definition: btMatrixX.h:529
#define btVectorXu
Definition: btMatrixX.h:528
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:314
#define BT_OVERRIDE
Definition: btThreads.h:26
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:27
original version written by Erwin Coumans, October 2013
btMatrixXu m_scratchJ3
Cache variable for constraint Jacobian matrix.
btAlignedObjectArray< int > m_multiBodyLimitDependencies
Indices of normal contact constraint associated with frictional contact constraint for multibodies.
btScalar solveGroupCacheFriendlySetup(btCollisionObject **bodies, int numBodies, btPersistentManifold **manifoldPtr, int numManifolds, btTypedConstraint **constraints, int numConstraints, const btContactSolverInfo &infoGlobal, btIDebugDraw *debugDrawer) BT_OVERRIDE
btVectorXu m_xSplit
Split impulse cache vector corresponding to m_x.
btVectorXu m_b
b vector in the MLCP formulation.
btAlignedObjectArray< btMultiBodySolverConstraint * > m_multiBodyAllConstraintPtrArray
Array of all the multibody constraints.
btMLCPSolverInterface * m_solver
MLCP solver.
int getNumFallbacks() const
Returns the number of fallbacks of using btSequentialImpulseConstraintSolver, which happens when the ...
void setNumFallbacks(int num)
Sets the number of fallbacks. This function may be used to reset the number to zero.
btScalar solveGroupCacheFriendlyIterations(btCollisionObject **bodies, int numBodies, btPersistentManifold **manifoldPtr, int numManifolds, btTypedConstraint **constraints, int numConstraints, const btContactSolverInfo &infoGlobal, btIDebugDraw *debugDrawer)
btVectorXu m_lo
Lower bound of constraint impulse, m_x.
btMatrixXu m_A
A matrix in the MLCP formulation.
int m_fallback
Count of fallbacks of using btSequentialImpulseConstraintSolver, which happens when the MLCP solver f...
btMatrixXu m_multiBodyA
A matrix in the MLCP formulation.
btAlignedObjectArray< int > m_limitDependencies
Indices of normal contact constraint associated with frictional contact constraint for rigid bodies.
btVectorXu m_bSplit
Split impulse Cache vector corresponding to m_b.
void setMLCPSolver(btMLCPSolverInterface *solver)
Sets MLCP solver. Assumed it's not null.
btAlignedObjectArray< int > m_scratchOfs
Cache variable for offsets.
void createMLCPFastRigidBody(const btContactSolverInfo &infoGlobal)
Constructs MLCP terms for constraints of two rigid bodies.
btVectorXu m_hi
Upper bound of constraint impulse, m_x.
virtual bool solveMLCP(const btContactSolverInfo &infoGlobal)
Solves MLCP and returns the success.
btVectorXu m_x
Constraint impulse, which is an output of MLCP solving.
btVectorXu m_multiBodyLo
Lower bound of constraint impulse, m_x.
virtual void createMLCPFast(const btContactSolverInfo &infoGlobal)
Constructs MLCP terms, which are m_A, m_b, m_lo, and m_hi.
btAlignedObjectArray< btSolverConstraint * > m_allConstraintPtrArray
Array of all the rigid body constraints.
btMatrixXu m_scratchJInvM3
Cache variable for constraint Jacobian times inverse mass matrix.
btVectorXu m_multiBodyX
Constraint impulse, which is an output of MLCP solving.
void createMLCPFastMultiBody(const btContactSolverInfo &infoGlobal)
Constructs MLCP terms for constraints of two multi-bodies or one rigid body and one multibody.
btVectorXu m_multiBodyHi
Upper bound of constraint impulse, m_x.
virtual btConstraintSolverType getSolverType() const
Returns the constraint solver type.
btVectorXu m_multiBodyB
b vector in the MLCP formulation.
btPersistentManifold is a contact point cache, it stays persistent as long as objects are overlapping...
TypedConstraint is the baseclass for Bullet constraints and vehicles.