Bullet Collision Detection & Physics Library
|
Go to the documentation of this file.
16 #ifndef BT_DEFORMABLE_LAGRANGIAN_FORCE_H
17 #define BT_DEFORMABLE_LAGRANGIAN_FORCE_H
35 return low +
static_cast<double>(rand()) / RAND_MAX * (high - low);
139 for (
int i = 0; i < dphi_dx.
size(); ++i)
141 dphi_dx[i].setZero();
154 x[counter] = psb->
m_nodes[j].m_q;
161 for (
int i = 0; i < dx.
size(); ++i)
169 for (
int it = 0; it < 10; ++it)
171 for (
int i = 0; i < dx.
size(); ++i)
178 for (
int i = 0; i < dx.
size(); ++i)
180 dphi += dphi_dx[i].dot(dx[i]);
188 psb->
m_nodes[j].m_q = x[counter] + dx[counter];
201 psb->
m_nodes[j].m_q = x[counter] - dx[counter];
216 psb->
m_nodes[j].m_q = x[counter];
222 double error = f1 - f2 - 2 * dphi;
224 std::cout <<
"Iteration = " << it <<
", f1 = " << f1 <<
", f2 = " << f2 <<
", error = " << error << std::endl;
226 for (
int i = 1; i < errors.
size(); ++i)
228 std::cout <<
"Iteration = " << i <<
", ratio = " << errors[i - 1] / errors[i] << std::endl;
263 x[counter] = psb->
m_nodes[j].m_q;
270 for (
int i = 0; i < dx.
size(); ++i)
278 for (
int it = 0; it < 10; ++it)
280 for (
int i = 0; i < dx.
size(); ++i)
286 for (
int i = 0; i < df.
size(); ++i)
301 psb->
m_nodes[j].m_q = x[counter] + dx[counter];
316 psb->
m_nodes[j].m_q = x[counter] - dx[counter];
332 psb->
m_nodes[j].m_q = x[counter];
339 for (
int i = 0; i < df.
size(); ++i)
341 btVector3 error_vector = f1[i] - f2[i] - 2 * df[i];
342 error += error_vector.
length2();
346 std::cout <<
"Iteration = " << it <<
", error = " << error << std::endl;
348 for (
int i = 1; i < errors.
size(); ++i)
350 std::cout <<
"Iteration = " << i <<
", ratio = " << errors[i - 1] / errors[i] << std::endl;
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
void resize(int newsize, const T &fillData=T())
The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with...
btMatrix3x3 transpose() const
Return the transpose of the matrix.
btVector3 can be used to represent 3D points and vectors.
The btSoftBody is an class to simulate cloth and volumetric soft bodies.
void push_back(const T &_Val)
void remove(const T &key)
btScalar btSqrt(btScalar y)
int size() const
return the number of elements in the array
btScalar length2() const
Return the length of the vector squared.