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

#include <tgRodInfo.h>

Inheritance diagram for tgRodInfo:
Collaboration diagram for tgRodInfo:

Public Member Functions

 tgRodInfo (const tgRod::Config &config)
 
 tgRodInfo (const tgRod::Config &config, tgTags tags)
 
 tgRodInfo (const tgRod::Config &config, const tgPair &pair)
 
 tgRodInfo (const tgRod::Config &config, tgTags tags, const tgPair &pair)
 
virtual ~tgRodInfo ()
 
tgRigidInfocreateRigidInfo (const tgPair &pair)
 
virtual void initRigidBody (tgWorld &world)
 
tgModelcreateModel (tgWorld &world)
 
const tgRod::ConfiggetConfig () const
 
const btVector3 & getFrom () const
 
const btVector3 & getTo () const
 
virtual btCollisionShape * getCollisionShape (tgWorld &world) const
 
virtual btTransform getTransform () const
 
virtual double getMass () const
 
virtual btVector3 getCenterOfMass () const
 
virtual btVector3 getConnectionPoint (const btVector3 &referencePoint, const btVector3 &destinationPoint) const
 
virtual btVector3 getConnectionPoint (const btVector3 &referencePoint, const btVector3 &destinationPoint, const double rotation) const
 
virtual tgCompoundRigidInfogetCompound ()
 
virtual const tgCompoundRigidInfogetCompound () const
 
virtual std::set< tgRigidInfo * > getLeafRigids ()
 
virtual bool containsNode (const btVector3 &nodeVector) const
 
virtual bool sharesNodesWith (const tgRigidInfo &other) const
 
virtual std::set< btVector3 > getContainedNodes () const
 
double getLength () const
 
virtual tgRigidInfocreateRigidInfo (const tgNode &node)
 
virtual tgRigidInfocreateRigidInfo (const tgNode &node, const tgTagSearch &tagSearch)
 
virtual tgRigidInfocreateRigidInfo (const tgPair &pair, const tgTagSearch &tagSearch)
 
virtual std::vector
< tgRigidInfo * > 
createRigidInfos (const tgNodes &nodes, const tgTagSearch &tagSearch)
 
virtual std::vector
< tgRigidInfo * > 
createRigidInfos (const tgPairs &pairs, const tgTagSearch &tagSearch)
 
void setCollisionShape (btCollisionShape *p_btCollisionShape)
 
virtual tgRigidInfogetRigidInfoGroup ()
 
virtual const tgRigidInfogetRigidInfoGroup () const
 
virtual void setRigidInfoGroup (tgRigidInfo *rigidInfoGroup)
 
virtual btRigidBody * getRigidBody ()
 
virtual const btRigidBody * getRigidBody () const
 
virtual void setRigidBody (btRigidBody *rigidBody)
 
bool isCompound () 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
 

Protected Attributes

btCollisionShape * m_collisionShape
 
tgRigidInfom_rigidInfoGroup
 
btRigidBody * m_rigidBody
 

Detailed Description

Implementation of a cylinder shape as defined by a 'from' point and a 'to' point. It also has radius and density.

Definition at line 47 of file tgRodInfo.h.

Constructor & Destructor Documentation

tgRodInfo::tgRodInfo ( const tgRod::Config config)

Construct a tgRodInfo with just a config. The pair must be filled in later, or factory methods can be used to create instances with pairs.

Definition at line 42 of file tgRodInfo.cpp.

Here is the caller graph for this function:

tgRodInfo::tgRodInfo ( const tgRod::Config config,
tgTags  tags 
)

Construct a tgRodInfo with just a config and tags. The pair must be filled in later, or factory methods can be used to create instances with pairs.

Definition at line 48 of file tgRodInfo.cpp.

tgRodInfo::tgRodInfo ( const tgRod::Config config,
const tgPair pair 
)

Construct a tgRodInfo from its endpoints, radius and density.

Parameters
[in]fromone endpoint
[in]tothe other endpoint
[in]configcontains the radius and density
Todo:
: make sure that tgPairs returns references to the vectors...

Definition at line 54 of file tgRodInfo.cpp.

tgRodInfo::tgRodInfo ( const tgRod::Config config,
tgTags  tags,
const tgPair pair 
)

Construct a tgRodInfo from its endpoints, radius and density.

Parameters
[in]fromone endpoint
[in]tothe other endpoint
[in]configcontains the radius and density
Todo:
: make sure that tgPairs returns references to the vectors...

Definition at line 60 of file tgRodInfo.cpp.

virtual tgRodInfo::~tgRodInfo ( )
inlinevirtual

World will destroy the rigid body

Definition at line 85 of file tgRodInfo.h.

Member Function Documentation

virtual bool tgRodInfo::containsNode ( const btVector3 &  nodeVector) const
inlinevirtual

Is the given vector either of the endpoints?

Return values
trueif nodeVector is either endpoint
falseif nodeVector is neither endpoint

Implements tgRigidInfo.

Definition at line 197 of file tgRodInfo.h.

Here is the call graph for this function:

tgRigidInfo * tgRodInfo::createRigidInfo ( const tgPair pair)
virtual

Create a tgRigidInfo* from a tgPair

Reimplemented from tgRigidInfo.

Definition at line 66 of file tgRodInfo.cpp.

Here is the call graph for this function:

virtual btVector3 tgRodInfo::getCenterOfMass ( ) const
inlinevirtual

Return the rod's center of mass. The center of mass is a point halfway between the endpoints.

Returns
the rod's center of mass

Implements tgRigidInfo.

Definition at line 140 of file tgRodInfo.h.

Here is the call graph for this function:

btCollisionShape * tgRodInfo::getCollisionShape ( tgWorld world) const
virtual

Return a pointer to the corresponding btCollisionShape, lazily creating it if it does not exist.

Implements tgRigidInfo.

Definition at line 98 of file tgRodInfo.cpp.

virtual tgCompoundRigidInfo* tgRodInfo::getCompound ( )
inlinevirtual

Since a rod is not a compound shape, there is no compound shape object to return.

Return values
NULL

Implements tgRigidInfo.

Definition at line 175 of file tgRodInfo.h.

virtual const tgCompoundRigidInfo* tgRodInfo::getCompound ( ) const
inlinevirtual

Since a rod is not a compound shape, there is no compound shape object to return.

Return values
NULL

Implements tgRigidInfo.

Definition at line 182 of file tgRodInfo.h.

const tgRod::Config& tgRodInfo::getConfig ( ) const
inline

Return a const reference to the container of the radius and density.

Returns
a const reference to the container of the radius and density

Definition at line 106 of file tgRodInfo.h.

btVector3 tgRodInfo::getConnectionPoint ( const btVector3 &  referencePoint,
const btVector3 &  destinationPoint 
) const
virtual

Return the surface point closest to the reference point in the direction of the destination point.

Parameters
[in]referencePointa btVector
[in]destinationPointa btVector
Returns
the surface point closest to the reference point in the direction of the destination point

Implements tgRigidInfo.

Definition at line 125 of file tgRodInfo.cpp.

btVector3 tgRodInfo::getConnectionPoint ( const btVector3 &  referencePoint,
const btVector3 &  destinationPoint,
const double  rotation 
) const
virtual

Return the surface point closest to the reference point in the direction of the destination point.

Parameters
[in]referencePointa btVector
[in]destinationPointa btVector
Returns
the surface point closest to the reference point in the direction of the destination point

Reimplemented from tgRigidInfo.

Definition at line 132 of file tgRodInfo.cpp.

Here is the call graph for this function:

std::set< btVector3 > tgRodInfo::getContainedNodes ( ) const
virtual

Return a set contiaining the two endpoints.

Returns
a set contiaining the two endpoints

Implements tgRigidInfo.

Definition at line 210 of file tgRodInfo.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

const btVector3& tgRodInfo::getFrom ( ) const
inline

Return a const reference to the first endpoint.

Definition at line 109 of file tgRodInfo.h.

Here is the call graph for this function:

std::set< tgRigidInfo * > tgRodInfo::getLeafRigids ( )
virtual

Return a set containing only a pointer to this rod.

Return values
aset containing only a pointer to this rod
Todo:
This function can't be const unless the return value is std::set<const tgRigidInfo*>.

Implements tgRigidInfo.

Definition at line 178 of file tgRodInfo.cpp.

double tgRodInfo::getLength ( ) const
inline

Return the distance between the two endpoints.

Returns
the distance between the two endpoints

Definition at line 221 of file tgRodInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

double tgRodInfo::getMass ( ) const
virtual

Return the rod's mass. The mass is the volume times the density.

Returns
the mass of the rod

Implements tgRigidInfo.

Definition at line 115 of file tgRodInfo.cpp.

Here is the call graph for this function:

virtual btRigidBody* tgRigidInfo::getRigidBody ( )
inlinevirtualinherited

Return a pointer to the corresponding btRigidBody.

Returns
a pointer to the corresponding btRigidBody

Reimplemented in tgCompoundRigidInfo.

Definition at line 174 of file tgRigidInfo.h.

Here is the caller graph for this function:

virtual const btRigidBody* tgRigidInfo::getRigidBody ( ) const
inlinevirtualinherited

Return a const pointer to the corresponding btRigidBody.

Returns
a pointer to the corresponding btRigidBody

Reimplemented in tgCompoundRigidInfo.

Definition at line 183 of file tgRigidInfo.h.

virtual tgRigidInfo* tgRigidInfo::getRigidInfoGroup ( )
inlinevirtualinherited

Get the tgRigidInfo that represents the compound rigid that this rigid belongs to. If it doesn't share nodes with any other rigids (determined during auto-compounding), it will point to itself.

Definition at line 151 of file tgRigidInfo.h.

Here is the caller graph for this function:

const btVector3& tgRodInfo::getTo ( ) const
inline

Return a const reference to the second endpoint.

Definition at line 112 of file tgRodInfo.h.

Here is the call graph for this function:

virtual btTransform tgRodInfo::getTransform ( ) const
inlinevirtual

Return a btTransform that maps the from endpoint to the to endpoint

Returns
a btTransform that maps the from endpoint to the to endpoint

Implements tgRigidInfo.

Definition at line 124 of file tgRodInfo.h.

void tgRodInfo::initRigidBody ( tgWorld world)
virtual

Call tgRigidInfo init rigid, then apply config to the rigid body.

Todo:
come up with a general solution in tgRigidInfo::initRigidBody Currently very difficult to pass around the config file in tgRigidInfo, since

Reimplemented from tgRigidInfo.

Definition at line 71 of file tgRodInfo.cpp.

bool tgRigidInfo::isCompound ( ) const
inlineinherited

Is this tgRigidInfo a compound?

Return values
trueif this tgRigidInfo is a compound
falseif this tgRigidInfo is not a compound
Todo:
Is this necessary?

Definition at line 256 of file tgRigidInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void tgRigidInfo::setCollisionShape ( btCollisionShape *  p_btCollisionShape)
inlineinherited

Set the corresponding btCollisionShape.

Parameters
[in,out]apointer to a btCollisionShape
Todo:
Does this leak any previous value of m_collisionShape?

Definition at line 139 of file tgRigidInfo.h.

virtual void tgRigidInfo::setRigidBody ( btRigidBody *  rigidBody)
inlinevirtualinherited

Set the corresponding btRigidBody.

Parameters
[in,out]apointer to a btRigidBody
Todo:
Does this leak any previous value of m_rigidBody?

Reimplemented in tgCompoundRigidInfo.

Definition at line 191 of file tgRigidInfo.h.

virtual void tgRigidInfo::setRigidInfoGroup ( tgRigidInfo rigidInfoGroup)
inlinevirtualinherited

Set the tgRigidInfo that represents the compound rigid that this may belong to. This will be set during auto-compounding.

Definition at line 165 of file tgRigidInfo.h.

bool tgRodInfo::sharesNodesWith ( const tgRigidInfo other) const
virtual
Todo:
: Move this to tgRigidInfo Does this rod have any nodes in common with the given tgRigidInfo object?
Parameters
in]other a reference to a tgRigidInfo object
Return values
trueif any node in this rod is also in other
falseif no node in this rod is also in other

Implements tgRigidInfo.

Definition at line 185 of file tgRodInfo.cpp.

Here is the call graph for this function:

Member Data Documentation

btCollisionShape* tgRigidInfo::m_collisionShape
mutableprotectedinherited

A pointer to the corresponding btCollisionShape.

Definition at line 316 of file tgRigidInfo.h.

btRigidBody* tgRigidInfo::m_rigidBody
mutableprotectedinherited

A pointer to the corresponding btRigidBody.

Definition at line 330 of file tgRigidInfo.h.

tgRigidInfo* tgRigidInfo::m_rigidInfoGroup
mutableprotectedinherited

A pointer to a group of rigids to which this rigid belongs. This is set during the rigid grouping step by a StructureInfo. If this is not set, getRigidGroup() will return a pointer to this (effectively, "I'm in my own group")

Definition at line 325 of file tgRigidInfo.h.


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