NTRT Simulator
 All Classes Files Functions Variables Typedefs Friends Pages
tgRod Class Reference

#include <tgRod.h>

Inheritance diagram for tgRod:
Collaboration diagram for tgRod:

Classes

struct  Config
 

Public Member Functions

 tgRod (btRigidBody *pRigidBody, const tgTags &tags, const double length)
 
virtual ~tgRod ()
 
virtual void teardown ()
 
virtual void onVisit (const tgModelVisitor &v) const
 
double mass () const
 
double length () const
 
btVector3 centerOfMass () const
 
virtual void setup (tgWorld &world)
 
virtual void step (double dt)
 
void addChild (tgModel *pChild)
 
virtual std::string toString (std::string prefix="") const
 
template<typename T >
std::vector< T * > find (const tgTagSearch &tagSearch)
 
template<typename T >
std::vector< T * > find (const std::string &tagSearch)
 
std::vector< tgModel * > getDescendants () const
 
void addTags (const std::string &space_separated_tags)
 
void addTags (const tgTags &tags)
 
bool hasTag (const std::string tag) const
 
bool hasAllTags (std::string tags)
 
bool hasAnyTags (const std::string tags)
 
bool hasNoTags ()
 
tgTagsgetTags ()
 
const tgTagsgetTags () const
 
void setTags (tgTags tags)
 
std::string getTagStr (std::string delim=" ") const
 

Detailed Description

A rod is a rigid body. Length is defined by nodes, radius and density are defined by config.

Definition at line 42 of file tgRod.h.

Constructor & Destructor Documentation

tgRod::~tgRod ( )
virtual

A class with a virtual memeber function requires a virtual destructor.

Definition at line 79 of file tgRod.cpp.

Member Function Documentation

void tgModel::addChild ( tgModel pChild)
inherited

Add a sub-model to this model. The model takes ownership of the child sub-model and is responsible for deallocating it.

Parameters
[in,out]pChilda pointer to a sub-model
Exceptions
std::invalid_argumentis pChild is NULL, this object, or already a descendant
Todo:
Make sure that every child appears no more than once in the tree.

Definition at line 126 of file tgModel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

btVector3 tgRod::centerOfMass ( ) const

Return the center of mass of the rod, a vector in 3-space.

Returns
the center of mass of the rod, a vector in 3-space

Definition at line 97 of file tgRod.cpp.

Here is the caller graph for this function:

template<typename T >
std::vector<T*> tgModel::find ( const tgTagSearch tagSearch)
inlineinherited

Get a vector of descendants sorted by type and a tagsearch. Useful for pulling out muscle groups, or similar.

Parameters
[in]tagSearch,atagSearch that contains the desired tags
Returns
a std::vector of pointers to members that match the tag search and typename T

Definition at line 129 of file tgModel.h.

Here is the call graph for this function:

template<typename T >
std::vector<T*> tgModel::find ( const std::string &  tagSearch)
inlineinherited

Get a vector of descendants sorted by type and a tagsearch. Useful for pulling out muscle groups, or similar.

Parameters
[in]tagSearch,astd::string& that contains the desired tags
Returns
a std::vector of pointers to members that match the tag search and typename T

Definition at line 142 of file tgModel.h.

Here is the call graph for this function:

std::vector< tgModel * > tgModel::getDescendants ( ) const
inherited

Return a std::vector of const pointers to all sub-models.

Todo:
examine whether this should be public, and perhaps create a read only version
Returns
a std::vector of const pointers all sub-models.
Todo:
Unnecessary copying can be avoided by pasing the result collection in the recursive step.

Definition at line 174 of file tgModel.cpp.

Here is the call graph for this function:

double tgRod::length ( ) const
inline

Return the rod's length in application-dependent units.

Returns
the rod's length in application-dependent units

Definition at line 104 of file tgRod.h.

double tgRod::mass ( ) const
inline

Return the rod's mass in application-dependent units.

Returns
the rod's mass in application-dependent units

Definition at line 98 of file tgRod.h.

Here is the caller graph for this function:

void tgRod::onVisit ( const tgModelVisitor r) const
virtual

Call tgModelVisitor::render() on self and all descendants.

Parameters
[in,out]ra reference to a tgModelVisitor

Reimplemented from tgModel.

Definition at line 81 of file tgRod.cpp.

Here is the call graph for this function:

void tgModel::setup ( tgWorld world)
virtualinherited

Setup takes a tgWorld and passes it to any children for their own setup functions. All subclasses should call this at the appropriate time (usually end of setup) within their own setup function.

Parameters
[in]world- the tgWorld the models will exist in.

Reimplemented in tgBaseString, NestedStructureTestModel, tgRBString, tgLinearString, PrismModel, SingleRibModel, SingleRibModel, T6Model, Hilbert2DModel, RBStringTest, ContactTestModel, StructureTestModel, BaseSpineModelLearning, ConnectorTestModel, TetraSpineLearningModel, BuildTestModel, FlemonsSpineModelLearningCL, FlemonsSpineModelLearning, RibModel, and FlemonsSpineModel.

Definition at line 62 of file tgModel.cpp.

void tgModel::step ( double  dt)
virtualinherited

Advance the simulation.

Parameters
[in]dtthe number of seconds since the previous call; std::invalid_argument is thrown if dt is not positive
Exceptions
std::invalid_argumentif dt is not positive
Note
This is not necessarily const for every child.

Reimplemented in NestedStructureTestModel, tgBaseString, ConnectorTestModel, BuildTestModel, ContactTestModel, StructureTestModel, tgLinearString, PrismModel, NestedStructureTestModel, tgRBString, T6Model, RBStringTest, BaseSpineModelLearning, TetraSpineLearningModel, FlemonsSpineModelLearningCL, FlemonsSpineModelLearning, RibModel, and FlemonsSpineModel.

Definition at line 86 of file tgModel.cpp.

Here is the call graph for this function:

void tgRod::teardown ( )
virtual

Deletes the children (undoes setup)

Reimplemented from tgModel.

Definition at line 87 of file tgRod.cpp.

Here is the call graph for this function:

std::string tgModel::toString ( std::string  prefix = "") const
virtualinherited

Returns the tag names of this model and its children

Parameters
[in]prefixa string to append to
Returns
the original string with this model and its children's tags appended

Definition at line 156 of file tgModel.cpp.

Here is the caller graph for this function:


The documentation for this class was generated from the following files: