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
34 return low + static_cast<double>(rand()) / RAND_MAX * (high - low);
128 for (
int i =0; i < dphi_dx.
size();++i)
130 dphi_dx[i].setZero();
143 x[counter] = psb->
m_nodes[j].m_q;
150 for (
int i = 0; i < dx.
size(); ++i)
158 for (
int it = 0; it < 10; ++it)
160 for (
int i = 0; i < dx.
size(); ++i)
167 for (
int i = 0; i < dx.
size(); ++i)
169 dphi += dphi_dx[i].dot(dx[i]);
178 psb->
m_nodes[j].m_q = x[counter] + dx[counter];
191 psb->
m_nodes[j].m_q = x[counter] - dx[counter];
206 psb->
m_nodes[j].m_q = x[counter];
212 double error = f1-f2-2*dphi;
214 std::cout <<
"Iteration = " << it <<
", f1 = " << f1 <<
", f2 = " << f2 <<
", error = " << error << std::endl;
216 for (
int i = 1; i < errors.
size(); ++i)
218 std::cout <<
"Iteration = " << i <<
", ratio = " << errors[i-1]/errors[i] << std::endl;
255 x[counter] = psb->
m_nodes[j].m_q;
262 for (
int i = 0; i < dx.
size(); ++i)
270 for (
int it = 0; it < 10; ++it)
272 for (
int i = 0; i < dx.
size(); ++i)
278 for (
int i =0; i < df.
size();++i)
293 psb->
m_nodes[j].m_q = x[counter] + dx[counter];
308 psb->
m_nodes[j].m_q = x[counter] - dx[counter];
324 psb->
m_nodes[j].m_q = x[counter];
331 for (
int i = 0; i < df.
size();++i)
333 btVector3 error_vector = f1[i]-f2[i]-2*df[i];
334 error += error_vector.
length2();
338 std::cout <<
"Iteration = " << it <<
", error = " << error << std::endl;
340 for (
int i = 1; i < errors.
size(); ++i)
342 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)
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.