Bullet Collision Detection & Physics Library
|
Go to the documentation of this file.
16 #ifndef BT_MASS_SPRING_H
17 #define BT_MASS_SPRING_H
67 size_t id1 = node1->
index;
68 size_t id2 = node2->
index;
81 force[id1] += scaled_force;
82 force[id2] -= scaled_force;
104 size_t id1 = node1->
index;
105 size_t id2 = node2->
index;
111 btVector3 scaled_force = scaled_stiffness * (dir - dir_normalized * r);
112 force[id1] += scaled_force;
113 force[id2] -= scaled_force;
134 size_t id1 = node1->
index;
135 size_t id2 = node2->
index;
137 btVector3 local_scaled_df = scaled_k_damp * (dv[id2] - dv[id1]);
143 local_scaled_df= scaled_k_damp * (dv[id2] - dv[id1]).
dot(dir) * dir;
146 df[id1] += local_scaled_df;
147 df[id2] -= local_scaled_df;
194 dampingForce.
resize(sz+1);
195 for (
int i = 0; i < dampingForce.
size(); ++i)
196 dampingForce[i].setZero();
204 energy -= dampingForce[node.
index].dot(node.
m_v) / dt;
225 size_t id1 = node1->
index;
226 size_t id2 = node2->
index;
237 scaled_df -= scaled_k * dir_normalized.
dot(dx_diff) * dir_normalized;
238 scaled_df += scaled_k * dir_normalized.
dot(dx_diff) * ((dir_norm-r)/dir_norm) * dir_normalized;
239 scaled_df -= scaled_k * ((dir_norm-r)/dir_norm) * dx_diff;
242 df[id1] += scaled_df;
243 df[id2] -= scaled_df;
btScalar dot(const btQuaternion &q1, const btQuaternion &q2)
Calculate the dot product between two quaternions.
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
btScalar dot(const btVector3 &v) const
Return the dot product.
const T & btMax(const T &a, const T &b)
void resize(int newsize, const T &fillData=T())
btVector3 can be used to represent 3D points and vectors.
The btSoftBody is an class to simulate cloth and volumetric soft bodies.
btScalar norm() const
Return the norm (length) of the vector.
btVector3 normalized() const
Return a normalized version of this vector.
int size() const
return the number of elements in the array