btDeformableMultiBodyConstraintSolver.h 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. Written by Xuchen Han <xuchenhan2015@u.northwestern.edu>
  3. Bullet Continuous Collision Detection and Physics Library
  4. Copyright (c) 2019 Google Inc. http://bulletphysics.org
  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. 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.
  11. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
  12. 3. This notice may not be removed or altered from any source distribution.
  13. */
  14. #ifndef BT_DEFORMABLE_MULTIBODY_CONSTRAINT_SOLVER_H
  15. #define BT_DEFORMABLE_MULTIBODY_CONSTRAINT_SOLVER_H
  16. #include "btDeformableBodySolver.h"
  17. #include "BulletDynamics/Featherstone/btMultiBodyConstraintSolver.h"
  18. class btDeformableBodySolver;
  19. // btDeformableMultiBodyConstraintSolver extendsn btMultiBodyConstraintSolver to solve for the contact among rigid/multibody and deformable bodies. Notice that the following constraints
  20. // 1. rigid/multibody against rigid/multibody
  21. // 2. rigid/multibody against deforamble
  22. // 3. deformable against deformable
  23. // 4. deformable self collision
  24. // 5. joint constraints
  25. // are all coupled in this solve.
  26. ATTRIBUTE_ALIGNED16(class)
  27. btDeformableMultiBodyConstraintSolver : public btMultiBodyConstraintSolver
  28. {
  29. btDeformableBodySolver* m_deformableSolver;
  30. protected:
  31. // override the iterations method to include deformable/multibody contact
  32. // virtual btScalar solveGroupCacheFriendlyIterations(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer);
  33. // write the velocity of the the solver body to the underlying rigid body
  34. void solverBodyWriteBack(const btContactSolverInfo& infoGlobal);
  35. // write the velocity of the underlying rigid body to the the the solver body
  36. void writeToSolverBody(btCollisionObject * *bodies, int numBodies, const btContactSolverInfo& infoGlobal);
  37. virtual void solveGroupCacheFriendlySplitImpulseIterations(btCollisionObject * *bodies, int numBodies, btCollisionObject** deformableBodies, int numDeformableBodies, btPersistentManifold** manifoldPtr, int numManifolds, btTypedConstraint** constraints, int numConstraints, const btContactSolverInfo& infoGlobal, btIDebugDraw* debugDrawer);
  38. virtual btScalar solveDeformableGroupIterations(btCollisionObject * *bodies, int numBodies, btCollisionObject** deformableBodies, int numDeformableBodies, btPersistentManifold** manifoldPtr, int numManifolds, btTypedConstraint** constraints, int numConstraints, const btContactSolverInfo& infoGlobal, btIDebugDraw* debugDrawer);
  39. public:
  40. BT_DECLARE_ALIGNED_ALLOCATOR();
  41. void setDeformableSolver(btDeformableBodySolver * deformableSolver)
  42. {
  43. m_deformableSolver = deformableSolver;
  44. }
  45. virtual void solveDeformableBodyGroup(btCollisionObject * *bodies, int numBodies, btCollisionObject** deformableBodies, int numDeformableBodies, btPersistentManifold** manifold, int numManifolds, btTypedConstraint** constraints, int numConstraints, btMultiBodyConstraint** multiBodyConstraints, int numMultiBodyConstraints, const btContactSolverInfo& info, btIDebugDraw* debugDrawer, btDispatcher* dispatcher);
  46. };
  47. #endif /* BT_DEFORMABLE_MULTIBODY_CONSTRAINT_SOLVER_H */