#include <dof.h>
Public Member Functions | |
virtual bool | accumulateMove (double q1, double *jointVals, int *stoppedJoints) |
Any stopped joint stops all joints of this DOF. | |
virtual void | buildDynamicCouplingConstraints (std::map< Body *, int > &islandIndices, int numBodies, double *Nu, double *eps, int &ncn) |
Rigid coupling constraints ensure all joints move together. | |
virtual void | buildDynamicLimitConstraints (std::map< Body *, int > &islandIndices, int numBodies, double *H, double *g, int &hcn) |
Only one, applied to first joint in the DOF. | |
virtual bool | computeStaticJointTorques (double *, double) |
Zero everywhere, no static torques. | |
virtual void | getJointValues (double *jointVals) const |
Each joint only depepends on dof value. | |
virtual int | getNumCouplingConstraints () |
Rigid coupling constraints ensure all joints move together. | |
virtual int | getNumLimitConstraints () |
At most one, if any of the joints is close or outside limit. | |
virtual double | getStaticRatio (Joint *j) const |
For a rigid DOF, the coupling ratio decides the ratio of movement, since the coupling is rigid. | |
Type | getType () const |
Returns the type of this DOF. | |
virtual void | reset () |
This is empty for the rigid DOF which is entirely state-less, nothing to reset. | |
RigidDOF (RigidDOF *original) | |
RigidDOF () | |
virtual void | setForce (double f) |
Only sets force to first joint, coupling constraints should take care of rest. | |
virtual void | updateFromJointValues (const double *jointVals=NULL) |
Sets based on first joint in the list. | |
virtual void | updateVal (double q1) |
Nothing special to do here. | |
Private Member Functions | |
double | getClosestJointLimit (int *direction) |
Checks the most that any of the joints is outside of its legal range by. |
The RigidDOF is the simplest form of DOF. All of its joints are rigidly connected, so if one stops, all stop.
Definition at line 267 of file dof.h.
bool RigidDOF::accumulateMove | ( | double | q1, | |
double * | jointVals, | |||
int * | stoppedJoints | |||
) | [virtual] |
void RigidDOF::buildDynamicCouplingConstraints | ( | std::map< Body *, int > & | islandIndices, | |
int | numBodies, | |||
double * | Nu, | |||
double * | eps, | |||
int & | ncn | |||
) | [virtual] |
void RigidDOF::buildDynamicLimitConstraints | ( | std::map< Body *, int > & | islandIndices, | |
int | numBodies, | |||
double * | H, | |||
double * | g, | |||
int & | hcn | |||
) | [virtual] |
virtual bool RigidDOF::computeStaticJointTorques | ( | double * | , | |
double | ||||
) | [inline, virtual] |
Zero everywhere, no static torques.
In the RigidDOF there is never any excess force applied at any joint. All joints are rigidly connected to the DOF, so once a joint is stopped the DOF can not advance any more so no more force is applied.
Implements DOF.
Reimplemented in BreakAwayDOF.
double RigidDOF::getClosestJointLimit | ( | int * | direction | ) | [private] |
Checks the most that any of the joints is outside of its legal range by.
Returns how far this dof is from exceeding one of it's joint limits. The return value is the distance between the current value and the joint limit, positive if the joint is inside its limit or negative if the joint has already exceeded its limit. direction is set to +1 if the limit is a positive one, or -1 if the limit is a negative one.
void RigidDOF::getJointValues | ( | double * | jointVals | ) | const [virtual] |
virtual int RigidDOF::getNumCouplingConstraints | ( | ) | [inline, virtual] |
int RigidDOF::getNumLimitConstraints | ( | ) | [virtual] |
double RigidDOF::getStaticRatio | ( | Joint * | j | ) | const [virtual] |
Type RigidDOF::getType | ( | ) | const [inline, virtual] |
virtual void RigidDOF::reset | ( | ) | [inline, virtual] |
This is empty for the rigid DOF which is entirely state-less, nothing to reset.
Implements DOF.
Reimplemented in BreakAwayDOF.
void RigidDOF::setForce | ( | double | f | ) | [virtual] |
void RigidDOF::updateFromJointValues | ( | const double * | jointVals = NULL |
) | [virtual] |
Sets based on first joint in the list.
In the RigidDOF all joint values behave the same way (either they are all stopped or they all move based on the DOF ratios. Therefore it is enough to look at a single joint in the list (such as the first one) to know what the DOF value should be.
Implements DOF.
Reimplemented in BreakAwayDOF.
virtual void RigidDOF::updateVal | ( | double | q1 | ) | [inline, virtual] |