Simbody
3.7
|
A linear spring between two points, specified as a station on each of two bodies. More...
Public Member Functions | |
TwoPointLinearSpring (GeneralForceSubsystem &forces, const MobilizedBody &body1, const Vec3 &station1, const MobilizedBody &body2, const Vec3 &station2, Real k, Real x0) | |
Create a TwoPointLinearSpring. More... | |
TwoPointLinearSpring () | |
Default constructor creates an empty handle. More... | |
SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS (TwoPointLinearSpring, TwoPointLinearSpringImpl, Force) | |
Public Member Functions inherited from SimTK::Force | |
void | disable (State &) const |
Disable this force element, effectively removing it from the System for computational purposes (it is still using its ForceIndex, however). More... | |
void | enable (State &) const |
Enable this force element if it was previously disabled. More... | |
bool | isDisabled (const State &) const |
Test whether this force element is currently disabled in the supplied State. More... | |
void | setDisabledByDefault (bool shouldBeDisabled) |
Normally force elements are enabled when defined and can be disabled later. More... | |
bool | isDisabledByDefault () const |
Test whether this force element is disabled by default in which case it must be explicitly enabled before it will take effect. More... | |
void | calcForceContribution (const State &state, Vector_< SpatialVec > &bodyForces, Vector_< Vec3 > &particleForces, Vector &mobilityForces) const |
Calculate the force that would be applied by this force element if the given state were realized to Dynamics stage. More... | |
Real | calcPotentialEnergyContribution (const State &state) const |
Calculate the potential energy contribution that is made by this force element at the given state. More... | |
Force () | |
Default constructor for Force handle base class does nothing. More... | |
operator ForceIndex () const | |
Implicit conversion to ForceIndex when needed. More... | |
const GeneralForceSubsystem & | getForceSubsystem () const |
Get the GeneralForceSubsystem of which this Force is an element. More... | |
ForceIndex | getForceIndex () const |
Get the index of this force element within its parent force subsystem. More... | |
Public Member Functions inherited from SimTK::PIMPLHandle< Force, ForceImpl, true > | |
bool | isEmptyHandle () const |
Returns true if this handle is empty, that is, does not refer to any implementation object. More... | |
bool | isOwnerHandle () const |
Returns true if this handle is the owner of the implementation object to which it refers. More... | |
bool | isSameHandle (const Force &other) const |
Determine whether the supplied handle is the same object as "this" PIMPLHandle. More... | |
void | disown (Force &newOwner) |
Give up ownership of the implementation to an empty handle. More... | |
PIMPLHandle & | referenceAssign (const Force &source) |
"Copy" assignment but with shallow (pointer) semantics. More... | |
PIMPLHandle & | copyAssign (const Force &source) |
This is real copy assignment, with ordinary C++ object ("value") semantics. More... | |
void | clearHandle () |
Make this an empty handle, deleting the implementation object if this handle is the owner of it. More... | |
const ForceImpl & | getImpl () const |
Get a const reference to the implementation associated with this Handle. More... | |
ForceImpl & | updImpl () |
Get a writable reference to the implementation associated with this Handle. More... | |
int | getImplHandleCount () const |
Return the number of handles the implementation believes are referencing it. More... | |
Additional Inherited Members | |
Public Types inherited from SimTK::PIMPLHandle< Force, ForceImpl, true > | |
typedef PIMPLHandle< Force, ForceImpl, PTR > | HandleBase |
typedef HandleBase | ParentHandle |
Protected Member Functions inherited from SimTK::Force | |
Force (ForceImpl *r) | |
Use this in a derived Force handle class constructor to supply the concrete implementation object to be stored in the handle base. More... | |
Protected Member Functions inherited from SimTK::PIMPLHandle< Force, ForceImpl, true > | |
PIMPLHandle () | |
The default constructor makes this an empty handle. More... | |
PIMPLHandle (ForceImpl *p) | |
This provides consruction of a handle referencing an existing implementation object. More... | |
PIMPLHandle (const PIMPLHandle &source) | |
The copy constructor makes either a deep (value) or shallow (reference) copy of the supplied source PIMPL object, based on whether this is a "pointer
semantics" (PTR=true) or "object (value) semantics" (PTR=false, default) class. More... | |
~PIMPLHandle () | |
Note that the destructor is non-virtual. More... | |
PIMPLHandle & | operator= (const PIMPLHandle &source) |
Copy assignment makes the current handle either a deep (value) or shallow (reference) copy of the supplied source PIMPL object, based on whether this is a "pointer sematics" (PTR=true) or "object (value) semantics" (PTR=false, default) class. More... | |
void | setImpl (ForceImpl *p) |
Set the implementation for this empty handle. More... | |
bool | hasSameImplementation (const Force &other) const |
Determine whether the supplied handle is a reference to the same implementation object as is referenced by "this" PIMPLHandle. More... | |
A linear spring between two points, specified as a station on each of two bodies.
The stiffness k and unstretched length x0 are provided. Then if d is the unit vector from point1 to point2, and x the current separation, we have f = k(x-x0) and we apply a force f*d to point1 and -f*d to point2. This contributes to potential energy: pe = 1/2 k (x-x0)^2. It is an error if the two points become coincident, since we are unable to determine a direction for the force in that case.
SimTK::Force::TwoPointLinearSpring::TwoPointLinearSpring | ( | GeneralForceSubsystem & | forces, |
const MobilizedBody & | body1, | ||
const Vec3 & | station1, | ||
const MobilizedBody & | body2, | ||
const Vec3 & | station2, | ||
Real | k, | ||
Real | x0 | ||
) |
Create a TwoPointLinearSpring.
forces | the subsystem to which this force should be added |
body1 | the first body to which the force should be applied |
station1 | the location on the first body at which the force should be applied |
body2 | the second body to which the force should be applied |
station2 | the location on the second body at which the force should be applied |
k | the spring constant |
x0 | the distance at which the force is 0 |
Default constructor creates an empty handle.
SimTK::Force::TwoPointLinearSpring::SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS | ( | TwoPointLinearSpring | , |
TwoPointLinearSpringImpl | , | ||
Force | |||
) |