NTRT Simulator
Version: Master
|
#include <tgBulletSpringCable.h>
Public Member Functions | |
tgBulletSpringCable (const std::vector< tgBulletSpringCableAnchor * > &anchors, double coefK, double dampingCoefficient, double pretension=0.0) | |
virtual | ~tgBulletSpringCable () |
virtual void | step (double dt) |
virtual const double | getActualLength () const |
virtual const double | getTension () const |
virtual const std::vector < const tgSpringCableAnchor * > | getAnchors () const |
virtual const double | getRestLength () const |
virtual void | setRestLength (const double newRestLength) |
virtual const double | getCoefK () const |
virtual const double | getCoefD () const |
virtual const double | getVelocity () const |
virtual const double | getDamping () const |
Protected Attributes | |
std::vector < tgBulletSpringCableAnchor * > | m_anchors |
tgBulletSpringCableAnchor *const | anchor1 |
tgBulletSpringCableAnchor *const | anchor2 |
double | m_damping |
double | m_velocity |
const double | m_coefK |
const double | m_dampingCoefficient |
double | m_restLength |
double | m_prevLength |
This class defines the passive dynamics of a spring-cable system in the Bullet physics engine Formerly known as Muscle2P
Definition at line 47 of file tgBulletSpringCable.h.
tgBulletSpringCable::tgBulletSpringCable | ( | const std::vector< tgBulletSpringCableAnchor * > & | anchors, |
double | coefK, | ||
double | dampingCoefficient, | ||
double | pretension = 0.0 |
||
) |
The only constructor. Takes a list of anchors, a coefficient of stiffness, a coefficent of damping, and optionally the amount of pretension in the cable
[in] | anchors | - a list of this spring cable's attachements |
[in] | coefK | - the stiffness of the spring. Must be positive |
[in] | dampingCoefficient | - the damping in the spring. Must be non-negative |
[in] | pretension | - must be small enough to keep the rest length positive |
Definition at line 35 of file tgBulletSpringCable.cpp.
|
virtual |
The virtual destructor. Deletes all of the anchors including anchor1 and anchor2
Definition at line 51 of file tgBulletSpringCable.cpp.
|
virtual |
Finds the distance between anchor1 and anchor2, and returns the length between them
Implements tgSpringCable.
Reimplemented in tgBulletContactSpringCable.
Definition at line 143 of file tgBulletSpringCable.cpp.
|
virtual |
Returns a const vector of const anchors. Currently casts from tgBulletSpringCableAnchors, which makes it impossible to return a reference
Implements tgSpringCable.
Definition at line 157 of file tgBulletSpringCable.cpp.
|
inlinevirtualinherited |
Get the coefficent of damping
Definition at line 103 of file tgSpringCable.h.
|
inlinevirtualinherited |
Get the coefficent of stiffness
Definition at line 95 of file tgSpringCable.h.
|
inlinevirtualinherited |
Get the last value of the damping force
Definition at line 119 of file tgSpringCable.h.
|
virtualinherited |
Returns m_restLength
Definition at line 66 of file tgSpringCable.cpp.
|
virtual |
Returns the tension currently in the string by multiplying the difference between the actual length and the rest length by the stiffness coefficient
Implements tgSpringCable.
Definition at line 150 of file tgBulletSpringCable.cpp.
|
inlinevirtualinherited |
Get the last change in length / time
Definition at line 111 of file tgSpringCable.h.
|
virtualinherited |
Sets m_restLength to newRestLength.
[in] | newRestLength,must | be non-negative |
Definition at line 71 of file tgSpringCable.cpp.
|
virtual |
Updates this object. Calls calculateAndApplyForce(dt)
[in] | dt,must | be positive |
Implements tgSpringCable.
Reimplemented in tgBulletContactSpringCable.
Definition at line 79 of file tgBulletSpringCable.cpp.
|
protected |
The first attachement point for this spring cable. Storing it seperately makes a number of functions easier
Definition at line 111 of file tgBulletSpringCable.h.
|
protected |
The other permanent attachment for this spring cable.
Definition at line 116 of file tgBulletSpringCable.h.
|
protected |
The list of contact points. tgBulletSpringCable typically has two whereas tgBulletContactSpringCable will have more. Needs to be stored here for consistent rendering. Vector has the convienence of tgCast functions, and we used to need a random iterator to sort
Definition at line 105 of file tgBulletSpringCable.h.
|
protectedinherited |
The stiffness coefficient Units of mass / sec ^2 Must be positive
Definition at line 149 of file tgSpringCable.h.
|
protectedinherited |
The previous value of the damping force. Stored so we can get it without passing a dt
Definition at line 136 of file tgSpringCable.h.
|
protectedinherited |
The damping coefficient. Units of mass / sec. Must be non-negative
Definition at line 156 of file tgSpringCable.h.
|
protectedinherited |
The previous actual length of the string. Used when calculating force and velocity
Definition at line 168 of file tgSpringCable.h.
|
protectedinherited |
The rest length of the string. Must be non negative
Definition at line 162 of file tgSpringCable.h.
|
protectedinherited |
The velocity of the string at the last update step. Stored so we can get it without passing a dt
Definition at line 142 of file tgSpringCable.h.