Bullet Collision Detection & Physics Library
btDeformableContactProjection.h
Go to the documentation of this file.
1/*
2 Written by Xuchen Han <xuchenhan2015@u.northwestern.edu>
3
4 Bullet Continuous Collision Detection and Physics Library
5 Copyright (c) 2019 Google Inc. http://bulletphysics.org
6 This software is provided 'as-is', without any express or implied warranty.
7 In no event will the authors be held liable for any damages arising from the use of this software.
8 Permission is granted to anyone to use this software for any purpose,
9 including commercial applications, and to alter it and redistribute it freely,
10 subject to the following restrictions:
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_CONTACT_PROJECTION_H
17#define BT_CONTACT_PROJECTION_H
18#include "btCGProjection.h"
19#include "btSoftBody.h"
24#include <vector>
26{
27public:
30
31// // map from node index to static constraint
32// btHashMap<btHashInt, btDeformableStaticConstraint> m_staticConstraints;
33// // map from node index to node rigid constraint
34// btHashMap<btHashInt, btAlignedObjectArray<btDeformableNodeRigidContactConstraint> > m_nodeRigidConstraints;
35// // map from node index to face rigid constraint
36// btHashMap<btHashInt, btAlignedObjectArray<btDeformableFaceRigidContactConstraint*> > m_faceRigidConstraints;
37// // map from node index to deformable constraint
38// btHashMap<btHashInt, btAlignedObjectArray<btDeformableFaceNodeContactConstraint*> > m_deformableConstraints;
39// // map from node index to node anchor constraint
40// btHashMap<btHashInt, btDeformableNodeAnchorConstraint> m_nodeAnchorConstraints;
41
42 // all constraints involving face
44
45 // map from node index to projection directions
47
48 // map from node index to static constraint
50 // map from node index to node rigid constraint
52 // map from node index to face rigid constraint
54 // map from node index to deformable constraint
56 // map from node index to node anchor constraint
58
60 : m_softBodies(softBodies)
61 {
62 }
63
65 {
66 }
67
68 // apply the constraints to the rhs of the linear solve
69 virtual void project(TVStack& x);
70
71 // add friction force to the rhs of the linear solve
72 virtual void applyDynamicFriction(TVStack& f);
73
74 // update and solve the constraints
75 virtual btScalar update(btCollisionObject** deformableBodies,int numDeformableBodies);
76
77 // solve the position error using split impulse
78 virtual btScalar solveSplitImpulse(const btContactSolverInfo& infoGlobal);
79
80 // Add constraints to m_constraints. In addition, the constraints that each vertex own are recorded in m_constraintsDict.
81 virtual void setConstraints();
82
83 // Set up projections for each vertex by adding the projection direction to
84 virtual void setProjection();
85
86 virtual void reinitialize(bool nodeUpdated);
87
88 virtual void splitImpulseSetup(const btContactSolverInfo& infoGlobal);
89};
90#endif /* btDeformableContactProjection_h */
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:314
btCollisionObject can be used to manage collision detection objects.
virtual btScalar update(btCollisionObject **deformableBodies, int numDeformableBodies)
btAlignedObjectArray< btSoftBody * > & m_softBodies
virtual btScalar solveSplitImpulse(const btContactSolverInfo &infoGlobal)
virtual void reinitialize(bool nodeUpdated)
btAlignedObjectArray< btAlignedObjectArray< btDeformableFaceNodeContactConstraint > > m_deformableConstraints
btDeformableContactProjection(btAlignedObjectArray< btSoftBody * > &softBodies)
btAlignedObjectArray< btAlignedObjectArray< btDeformableNodeRigidContactConstraint > > m_nodeRigidConstraints
btAlignedObjectArray< btVector3 > TVStack
btHashMap< btHashInt, btAlignedObjectArray< btVector3 > > m_projectionsDict
virtual void splitImpulseSetup(const btContactSolverInfo &infoGlobal)
btAlignedObjectArray< btAlignedObjectArray< btDeformableStaticConstraint > > m_staticConstraints
btAlignedObjectArray< btAlignedObjectArray< btDeformableFaceRigidContactConstraint > > m_faceRigidConstraints
btAlignedObjectArray< btAlignedObjectArray< btDeformableNodeAnchorConstraint > > m_nodeAnchorConstraints
btAlignedObjectArray< btDeformableContactConstraint * > m_allFaceConstraints
The btHashMap template class implements a generic and lightweight hashmap.
Definition: btHashMap.h:220