2#include "../btSoftBodyInternals.h"
9 :
btSoftBody(worldInfo, node_count, x, m), m_rigidOnly(false)
65 for (
int i = 0; i <
m_nFull; ++i)
150 for (
int i = 0; i <
m_nFull; ++i)
152 for (
int k = 0; k < 3; ++k)
183 for (
int i = 0; i <
m_nFull; ++i)
189 for (
int k = 0; k < 3; ++k)
204 for (
int i = 0; i <
m_nFull; ++i)
210 for (
int k = 0; k < 3; ++k)
265 for (
int i = 0; i <
m_nFull; ++i)
321 for (
int i = 0; i <
m_nFull; ++i)
333 for (
int i = 0; i <
m_nFull; ++i)
339 for (
int k = 0; k < 3; ++k)
350 return L_rigid + L_reduced;
358 for (
int k = 0; k < 3; ++k)
367 ref_trans.
getBasis() * v_from_reduced +
378 for (
int k = 0; k < 3; ++k)
388 ref_trans.
getBasis() * deltaV_from_reduced +
427 n.
m_x = rotation * (n.
m_x - CoM) + CoM + translation;
428 n.
m_q = rotation * (n.
m_q - CoM) + CoM + translation;
471 n.
m_x = (n.
m_x - CoM) * scl + CoM;
472 n.
m_q = (n.
m_q - CoM) * scl + CoM;
502 for (
int i = 0; i <
m_nFull; ++i)
525 for (
int i = 0; i <
m_nFull; ++i)
538 for (
int p = 0; p <
m_nFull; ++p)
545 particle_inertia[0][0] =
m_nodalMass[p] * (r[1] * r[1] + r[2] * r[2]);
546 particle_inertia[1][1] =
m_nodalMass[p] * (r[0] * r[0] + r[2] * r[2]);
547 particle_inertia[2][2] =
m_nodalMass[p] * (r[0] * r[0] + r[1] * r[1]);
549 particle_inertia[0][1] = -
m_nodalMass[p] * (r[0] * r[1]);
550 particle_inertia[0][2] = -
m_nodalMass[p] * (r[0] * r[2]);
551 particle_inertia[1][2] = -
m_nodalMass[p] * (r[1] * r[2]);
553 particle_inertia[1][0] = particle_inertia[0][1];
554 particle_inertia[2][0] = particle_inertia[0][2];
555 particle_inertia[2][1] = particle_inertia[1][2];
557 inertia_tensor += particle_inertia;
572 for (
int i = 0; i <
m_nFull; ++i)
575 nodal_disp = rotation * nodal_disp;
577 for (
int k = 0; k < 3; ++k)
579 m_modes[r][3 * i + k] = nodal_disp[k];
599 #if defined(BT_CLAMP_VELOCITY_TO) && BT_CLAMP_VELOCITY_TO > 0
607 #if defined(BT_CLAMP_VELOCITY_TO) && BT_CLAMP_VELOCITY_TO > 0
616 std::cout <<
"something went wrong...probably didn't initialize?\n";
649 for (
int i = 0; i < 3; ++i)
651 for (
int j = 0; j < 3; ++j)
666 omega_helper[r].setZero();
667 for (
int i = 0; i <
m_nFull; ++i)
671 omega_helper[r] += mi_rstar_i * rotation * s_ri;
677 for (
int i = 0; i < 3; ++i)
679 for (
int j = 0; j < 3; ++j)
683 sum_multiply_A[i][j] += omega_helper[r][i] * (
m_projPA[r][3 * n_node + j] +
m_projCq[r][3 * n_node + j]);
733 for (
int k = 0; k < 3; ++k)
735 f_ext_r[r] += (
m_projPA[r][3 * n_node + k] +
m_projCq[r][3 * n_node + k]) * f_local[k];
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
#define ATTRIBUTE_ALIGNED16(a)
static btMatrix3x3 Cross(const btVector3 &v)
static btMatrix3x3 Diagonal(btScalar x)
int size() const
return the number of elements in the array
void resize(int newsize, const T &fillData=T())
void push_back(const T &_Val)
btTransform m_interpolationWorldTransform
m_interpolationWorldTransform is used for CCD and interpolation it can be either previous or future (...
const btCollisionShape * getCollisionShape() const
virtual btScalar getMargin() const =0
The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with...
btMatrix3x3 inverse() const
Return the inverse of the matrix.
btMatrix3x3 transpose() const
Return the transpose of the matrix.
void setIdentity()
Set the matrix to the identity.
void setZero()
Set the matrix to the identity.
void applyFullSpaceNodalForce(const btVector3 &f_ext, int n_node)
btMatrix3x3 m_invInertiaTensorWorldInitial
void predictIntegratedTransform(btScalar dt, btTransform &predictedTransform)
void applyTorqueImpulse(const btVector3 &torque)
btVector3 m_angularVelocityFromReduced
const btVector3 computeNodeFullVelocity(const btTransform &ref_trans, int n_node) const
btMatrix3x3 m_interpolateInvInertiaTensorWorld
void applyInternalVelocityChanges()
btVector3 getRelativePos(int n_node)
btAlignedObjectArray< int > m_fixedNodes
btReducedDeformableBody(btSoftBodyWorldInfo *worldInfo, int node_count, const btVector3 *x, const btScalar *m)
btVector3 m_linearVelocity
btVector3 m_internalDeltaAngularVelocity
btVector3 m_internalDeltaLinearVelocity
virtual void transform(const btTransform &trs)
tDenseArray m_internalDeltaReducedVelocity
void mapToFullVelocity(const btTransform &ref_trans)
void endOfTimeStepZeroing()
const btVector3 & getAngularVelocity() const
void updateInertiaTensor()
tDenseArray m_reducedVelocityBuffer
btVector3 m_internalDeltaAngularVelocityFromReduced
btScalar m_angularDamping
void setRigidAngularVelocity(const btVector3 &omega)
btVector3 m_angularFactor
btMatrix3x3 m_invInertiaTensorWorld
void setReducedModes(int num_modes, int full_size)
void updateReducedVelocity(btScalar solverdt)
void disableReducedModes(const bool rigid_only)
const btVector3 & getLinearVelocity() const
void updateModesByRotation(const btMatrix3x3 &rotation)
virtual btMatrix3x3 getImpulseFactor(int n_node)
bool isReducedModesOFF() const
void setRigidVelocity(const btVector3 &v)
btVector3 m_angularVelocity
const btVector3 internalComputeNodeDeltaVelocity(const btTransform &ref_trans, int n_node) const
tDenseArray m_reducedVelocity
const btVector3 computeTotalAngularMomentum() const
void applyCentralImpulse(const btVector3 &impulse)
void updateExternalForceProjectMatrix(bool initialized)
void applyReducedElasticForce(const tDenseArray &reduce_dofs)
void updateLocalMomentArm()
void internalApplyFullSpaceImpulse(const btVector3 &impulse, const btVector3 &rel_pos, int n_node, btScalar dt)
void applyReducedDampingForce(const tDenseArray &reduce_vel)
void setDamping(const btScalar alpha, const btScalar beta)
void setStiffnessScale(const btScalar ks)
btMatrix3x3 m_invInertiaLocal
void setMassScale(const btScalar rho)
tDenseArray m_reducedForceExternal
void applyDamping(btScalar timeStep)
void updateInitialInertiaTensor(const btMatrix3x3 &rotation)
tDenseArray m_reducedForceDamping
tDenseArray m_reducedForceElastic
btScalar getTotalMass() const
void internalApplyRigidImpulse(const btVector3 &impulse, const btVector3 &rel_pos)
void setFixedNodes(const int n_node)
tDenseArray m_reducedDofs
void setMassProps(const tDenseArray &mass_array)
virtual void transformTo(const btTransform &trs)
virtual void scale(const btVector3 &scl)
void internalInitialization()
void applyRigidGravity(const btVector3 &gravity, btScalar dt)
void updateReducedDofs(btScalar solverdt)
btTransform m_rigidTransformWorld
void proceedToTransform(btScalar dt, bool end_of_time_step)
void mapToFullPosition(const btTransform &ref_trans)
void updateRestNodalPositions()
void updateLocalInertiaTensorFromNodes()
virtual void setTotalMass(btScalar mass, bool fromfaces=false)
btTransform & getRigidTransform()
tDenseArray m_reducedDofsBuffer
The btSoftBody is an class to simulate cloth and volumetric soft bodies.
void initializeDmInverse()
btVector3 can be used to represent 3D points and vectors.
btVector3 cross(const btVector3 &v) const
Return the cross product between this and another vector.
void setValue(const btScalar &_x, const btScalar &_y, const btScalar &_z)
static btDbvtAabbMm FromCR(const btVector3 &c, btScalar r)
void update(btDbvtNode *leaf, int lookahead=-1)