NTRT Simulator
 All Classes Files Functions Variables Typedefs Friends Pages
tgRigidInfo Class Referenceabstract

#include <tgRigidInfo.h>

Inherits tgTaggable.

Inherited by tgCompoundRigidInfo, and tgRodInfo.

Collaboration diagram for tgRigidInfo:

Public Member Functions

 tgRigidInfo (tgTags tags)
 
 tgRigidInfo (const std::string &space_separated_tags)
 
virtual ~tgRigidInfo ()
 
virtual tgRigidInfocreateRigidInfo (const tgNode &node)
 
virtual tgRigidInfocreateRigidInfo (const tgPair &pair)
 
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)
 
virtual void initRigidBody (tgWorld &world)
 
virtual tgModelcreateModel (tgWorld &world)=0
 
virtual btCollisionShape * getCollisionShape (tgWorld &world) const =0
 
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)
 
virtual btTransform getTransform () const =0
 
virtual double getMass () const =0
 
virtual btVector3 getCenterOfMass () const =0
 
virtual btVector3 getConnectionPoint (const btVector3 &referencePoint, const btVector3 &destinationPoint) const =0
 
virtual btVector3 getConnectionPoint (const btVector3 &referencePoint, const btVector3 &destinationPoint, const double rotation) const
 
bool isCompound () const
 
virtual tgCompoundRigidInfogetCompound ()=0
 
virtual const tgCompoundRigidInfogetCompound () const =0
 
virtual std::set< tgRigidInfo * > getLeafRigids ()=0
 
virtual bool containsNode (const btVector3 &nodeVector) const =0
 
virtual std::set< btVector3 > getContainedNodes () const =0
 
virtual bool sharesNodesWith (const tgRigidInfo &other) const =0
 
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

A collector for keeping track of all of the necessary components of a rigid model during the build process. Information is filled in in the following order:

  1. Structural information (different for each subclass) that is necessary for subsequent steps (e.g. radius, density, and end points for a rod)
  2. m_collisionShape – the information from #1 is used to create an appropriate btCollisionShape. Note that a btCollisionShape does not have mass or placement info, it's just a shape.
  3. m_rigidGroup – this is usually filled in by a tgStructureInfo object during the groupRigids() operation that is required for auto-compounding. If the group is not set, a pointer to self is returned. If you know your rigid does not share any nodes with other rigids, you can skip setting this and things will still work.
  4. m_rigidBody – This is the actual representation of the rigid for Bullet Physics to use. We keep a pointer to it here so that tgConnectorInfo objects that point to this can be translated into tgModels.

Note: A tgRigidInfo is a tree. If it is not compound, the tree has one node.

Definition at line 75 of file tgRigidInfo.h.

Constructor & Destructor Documentation

virtual tgRigidInfo::~tgRigidInfo ( )
inlinevirtual

The destructor has nothing to do.

Definition at line 100 of file tgRigidInfo.h.

Member Function Documentation

virtual bool tgRigidInfo::containsNode ( const btVector3 &  nodeVector) const
pure virtual

Is the given vector a node anywhere in this rigid body?

Return values
trueif nodeVector is a node anywhere in this rigid body
falseif nodeVector is not a node anywhere in this rigid body

Implemented in tgRodInfo, and tgCompoundRigidInfo.

virtual btVector3 tgRigidInfo::getCenterOfMass ( ) const
pure virtual

Return the rigid body's center of mass.

Returns
the rigid body's center of mass.

Implemented in tgRodInfo, and tgCompoundRigidInfo.

Here is the caller graph for this function:

virtual btCollisionShape* tgRigidInfo::getCollisionShape ( tgWorld world) const
pure virtual

Return a pointer to the corresponding btCollisionShape.

Returns
a pointer to the corresponding btCollisionShape

Implemented in tgRodInfo, and tgCompoundRigidInfo.

Here is the caller graph for this function:

virtual tgCompoundRigidInfo* tgRigidInfo::getCompound ( )
pure virtual

If this tgRigidInfo is a tgCompoundRigidInfo, return a pointer to it; otherwise return NULL.

Return values
NULLif this tgRigidInfo is not a tgCompoundRigidInfo
thethis pointer if this tgRigidInfo is a tgCompoundRigidInfo
Todo:
Is this necessary?

Implemented in tgRodInfo, and tgCompoundRigidInfo.

Here is the caller graph for this function:

virtual const tgCompoundRigidInfo* tgRigidInfo::getCompound ( ) const
pure virtual

If this tgRigidInfo is a tgCompoundRigidInfo, return a pointer to it; otherwise return NULL.

Return values
NULLif this tgRigidInfo is not a tgCompoundRigidInfo
thethis pointer if this tgRigidInfo is a tgCompoundRigidInfo
Todo:
Is this necessary?

Implemented in tgRodInfo, and tgCompoundRigidInfo.

virtual btVector3 tgRigidInfo::getConnectionPoint ( const btVector3 &  referencePoint,
const btVector3 &  destinationPoint 
) const
pure virtual

Add this (for determining, for instance, an edge connection point for a cylinder, a surface point on a ball, etc.) Usually the referencePoint is something like the node at the end of a cylinder or the center point of a sphere, and the destinationPoint is a point on the other object that we'll be connecting to. In the case of a cylinder, this function might return the edge point closest to the destinationPoint.

Or for an irregular surface (or any shape for that matter), you could keep a list of surface points and have this function select the closest one to the destination.

Todo:

: For the generic tgRigidInfo implementation, allow people to provide a delegate object to find the connection point.

: Should this return a reference instead of a value? Possibility of change indicates a reference, but do we want to allow this to be changeable?

Implemented in tgRodInfo, and tgCompoundRigidInfo.

Here is the caller graph for this function:

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

Virtual version of getConnectionPoint quietly ignores rotation information for non-rod objects

Reimplemented in tgRodInfo.

Definition at line 243 of file tgRigidInfo.h.

Here is the call graph for this function:

virtual std::set<btVector3> tgRigidInfo::getContainedNodes ( ) const
pure virtual

Return the set of nodes contained anywhere in the rigid body. For instance, a tgRod would return a set containing its 'from' and 'to' points.

Implemented in tgRodInfo, and tgCompoundRigidInfo.

Here is the caller graph for this function:

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

Return a set of all non-compound tgRigidInfo objects in the tgRigidInfo tree.

Todo:
This function can't be const unless the return value is std::set<const tgRigidInfo*>.

Implemented in tgRodInfo, and tgCompoundRigidInfo.

Here is the caller graph for this function:

virtual double tgRigidInfo::getMass ( ) const
pure virtual

Return the rigid body's mass.

Returns
the rigid bddy's mass

Implemented in tgRodInfo, and tgCompoundRigidInfo.

Here is the caller graph for this function:

virtual btRigidBody* tgRigidInfo::getRigidBody ( )
inlinevirtual

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
inlinevirtual

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 ( )
inlinevirtual

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:

virtual btTransform tgRigidInfo::getTransform ( ) const
pure virtual

Return a btTransform.

Returns
a btTransform

Implemented in tgRodInfo, and tgCompoundRigidInfo.

Here is the caller graph for this function:

bool tgRigidInfo::isCompound ( ) const
inline

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)
inline

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)
inlinevirtual

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)
inlinevirtual

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.

virtual bool tgRigidInfo::sharesNodesWith ( const tgRigidInfo other) const
pure virtual

Does this tgRigidInfo 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 rigid body is also in other
falseif no node in this rigid body is also in other

Implemented in tgRodInfo, and tgCompoundRigidInfo.

Member Data Documentation

btCollisionShape* tgRigidInfo::m_collisionShape
mutableprotected

A pointer to the corresponding btCollisionShape.

Definition at line 316 of file tgRigidInfo.h.

btRigidBody* tgRigidInfo::m_rigidBody
mutableprotected

A pointer to the corresponding btRigidBody.

Definition at line 330 of file tgRigidInfo.h.

tgRigidInfo* tgRigidInfo::m_rigidInfoGroup
mutableprotected

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: