Bullet Collision Detection & Physics Library
btReducedDeformableContactConstraint.h
Go to the documentation of this file.
1#include "../btDeformableContactConstraint.h"
3
4// ================= static constraints ===================
6{
7 public:
18
20 btSoftBody::Node* node,
21 const btVector3& ri,
22 const btVector3& x0,
23 const btVector3& dir,
24 const btContactSolverInfo& infoGlobal,
25 btScalar dt);
26 // btReducedDeformableStaticConstraint(const btReducedDeformableStaticConstraint& other);
29
30 virtual btScalar solveConstraint(const btContactSolverInfo& infoGlobal);
31
32 // this calls reduced deformable body's applyFullSpaceImpulse
33 virtual void applyImpulse(const btVector3& impulse);
34
35 btVector3 getDeltaVa() const;
36
37 // virtual void applySplitImpulse(const btVector3& impulse) {}
38};
39
40// ================= base contact constraints ===================
42{
43 public:
44 bool m_collideStatic; // flag for collision with static object
45 bool m_collideMultibody; // flag for collision with multibody
46
48 int m_solverBodyId; // for debugging
49
53
65
71
72 btVector3 m_contactNormalA; // surface normal for rigid body (opposite direction as impulse)
73 btVector3 m_contactNormalB; // surface normal for reduced deformable body (opposite direction as impulse)
74 btVector3 m_contactTangent; // tangential direction of the relative velocity
75 btVector3 m_contactTangent2; // 2nd tangential direction of the relative velocity
76 btVector3 m_relPosA; // relative position of the contact point for A (rigid)
77 btVector3 m_relPosB; // relative position of the contact point for B
78 btMatrix3x3 m_impulseFactor; // total impulse matrix
79
80 btVector3 m_bufferVelocityA; // velocity at the beginning of the iteration
82 btVector3 m_linearComponentNormal; // linear components for the solver body
83 btVector3 m_angularComponentNormal; // angular components for the solver body
84 // since 2nd contact direction only applies to multibody, these components will never be used
87
90 const btContactSolverInfo& infoGlobal,
91 btScalar dt);
92 // btReducedDeformableRigidContactConstraint(const btReducedDeformableRigidContactConstraint& other);
95
96 void setSolverBody(const int bodyId, btSolverBody& solver_body);
97
98 virtual void warmStarting() {}
99
100 virtual btScalar solveConstraint(const btContactSolverInfo& infoGlobal);
101
102 void calculateTangentialImpulse(btScalar& deltaImpulse_tangent,
103 btScalar& appliedImpulse,
104 const btScalar rhs_tangent,
105 const btScalar tangentImpulseFactorInv,
106 const btVector3& tangent,
107 const btScalar lower_limit,
108 const btScalar upper_limit,
109 const btVector3& deltaV_rel);
110
111 virtual void applyImpulse(const btVector3& impulse) {}
112
113 virtual void applySplitImpulse(const btVector3& impulse) {} // TODO: may need later
114
115 virtual btVector3 getVa() const;
116 virtual btVector3 getDeltaVa() const = 0;
117 virtual btVector3 getDeltaVb() const = 0;
118};
119
120// ================= node vs rigid constraints ===================
122{
123 public:
125
128 const btContactSolverInfo& infoGlobal,
129 btScalar dt);
130 // btReducedDeformableNodeRigidContactConstraint(const btReducedDeformableNodeRigidContactConstraint& other);
133
134 virtual void warmStarting();
135
136 // get the velocity of the deformable node in contact
137 virtual btVector3 getVb() const;
138
139 // get the velocity change of the rigid body
140 virtual btVector3 getDeltaVa() const;
141
142 // get velocity change of the node in contat
143 virtual btVector3 getDeltaVb() const;
144
145 // get the split impulse velocity of the deformable face at the contact point
146 virtual btVector3 getSplitVb() const;
147
148 // get the velocity change of the input soft body node in the constraint
149 virtual btVector3 getDv(const btSoftBody::Node*) const;
150
151 // cast the contact to the desired type
153 {
154 return static_cast<const btSoftBody::DeformableNodeRigidContact*>(m_contact);
155 }
156
157 // this calls reduced deformable body's applyFullSpaceImpulse
158 virtual void applyImpulse(const btVector3& impulse);
159};
160
161// ================= face vs rigid constraints ===================
163{
164 public:
167
170 const btContactSolverInfo& infoGlobal,
171 btScalar dt,
172 bool useStrainLimiting);
173 // btReducedDeformableFaceRigidContactConstraint(const btReducedDeformableFaceRigidContactConstraint& other);
176
177 // get the velocity of the deformable face at the contact point
178 virtual btVector3 getVb() const;
179
180 // get the split impulse velocity of the deformable face at the contact point
181 virtual btVector3 getSplitVb() const;
182
183 // get the velocity change of the input soft body node in the constraint
184 virtual btVector3 getDv(const btSoftBody::Node*) const;
185
186 // cast the contact to the desired type
188 {
189 return static_cast<const btSoftBody::DeformableFaceRigidContact*>(m_contact);
190 }
191
192 // this calls reduced deformable body's applyFullSpaceImpulse
193 virtual void applyImpulse(const btVector3& impulse);
194};
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:314
const btSoftBody::DeformableRigidContact * m_contact
The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with...
Definition: btMatrix3x3.h:50
virtual btVector3 getDv(const btSoftBody::Node *) const
const btSoftBody::DeformableFaceRigidContact * getContact() const
virtual btVector3 getDv(const btSoftBody::Node *) const
const btSoftBody::DeformableNodeRigidContact * getContact() const
virtual btScalar solveConstraint(const btContactSolverInfo &infoGlobal)
void setSolverBody(const int bodyId, btSolverBody &solver_body)
virtual void applySplitImpulse(const btVector3 &impulse)
void calculateTangentialImpulse(btScalar &deltaImpulse_tangent, btScalar &appliedImpulse, const btScalar rhs_tangent, const btScalar tangentImpulseFactorInv, const btVector3 &tangent, const btScalar lower_limit, const btScalar upper_limit, const btVector3 &deltaV_rel)
virtual btVector3 getDeltaVb() const =0
virtual btVector3 getDeltaVa() const =0
virtual void applyImpulse(const btVector3 &impulse)
virtual btScalar solveConstraint(const btContactSolverInfo &infoGlobal)
btVector3 can be used to represent 3D points and vectors.
Definition: btVector3.h:82
The btSolverBody is an internal datastructure for the constraint solver. Only necessary data is packe...
Definition: btSolverBody.h:105