NTRT Simulator  Version: Master
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
tgCompoundRigidInfo Class Reference
Inheritance diagram for tgCompoundRigidInfo:
Collaboration diagram for tgCompoundRigidInfo:

Public Member Functions

 tgCompoundRigidInfo ()
 
tgModelcreateModel (tgWorld &world)
 
virtual ~tgCompoundRigidInfo ()
 
void addRigid (tgRigidInfo &rigid)
 
virtual btVector3 getCenterOfMass () const
 
btCompoundShape * createCompoundShape (tgWorld &world) const
 
virtual btCollisionShape * getCollisionShape (tgWorld &world) const
 
virtual btTransform getTransform () const
 
virtual double getMass () const
 
virtual btRigidBody * getRigidBody ()
 
virtual const btRigidBody * getRigidBody () const
 
virtual void setRigidBody (btRigidBody *const rigidBody)
 
virtual btCollisionObject * getCollisionObject ()
 
virtual const btCollisionObject * getCollisionObject () const
 
virtual void setCollisionObject (btCollisionObject *collisionObject)
 
virtual btVector3 getConnectionPoint (const btVector3 &referencePoint, const btVector3 &) 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
 
std::set< btVector3 > getContainedNodes () const
 
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)
 
void setCollisionShape (btCollisionShape *p_btCollisionShape)
 
virtual tgRigidInfogetRigidInfoGroup ()
 
virtual const tgRigidInfogetRigidInfoGroup () const
 
virtual void setRigidInfoGroup (tgRigidInfo *rigidInfoGroup)
 
virtual btVector3 getConnectionPoint (const btVector3 &referencePoint, const btVector3 &destinationPoint, const double rotation) const
 
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

std::vector< tgRigidInfo * > m_rigids
 
btCompoundShape * m_compoundShape
 
btCollisionShape * m_collisionShape
 
tgRigidInfom_rigidInfoGroup
 
btCollisionObject * m_collisionObject
 

Detailed Description

Definition at line 36 of file tgCompoundRigidInfo.h.

Constructor & Destructor Documentation

tgCompoundRigidInfo::tgCompoundRigidInfo ( )

The null constructor is the default constructor.

Todo:
Require both m_rigidBody and m_rigids to be supplied in the constructor. Initialize m_compoundShape, store mass and center of mass in member variables.

Definition at line 28 of file tgCompoundRigidInfo.cpp.

virtual tgCompoundRigidInfo::~tgCompoundRigidInfo ( )
inlinevirtual

The destructor does not own the btRigidBody objects and must not deallocate them. Additionally, collision shapes cannot be deallocated until the world is deleted

Definition at line 56 of file tgCompoundRigidInfo.h.

Member Function Documentation

void tgCompoundRigidInfo::addRigid ( tgRigidInfo rigid)

Insert a pointer to the supplied tgRigidInfo into a container. The tgCompoundRigidInfo does not assume ownership of the tgRigidInfo, and must not deallocate it.

Parameters
[in,out]rigita tgRigidInfo
Todo:
Get rid of this. Require all m_rigids to be supplied in the constructor.

Definition at line 42 of file tgCompoundRigidInfo.cpp.

bool tgCompoundRigidInfo::containsNode ( const btVector3 &  nodeVector) const
virtual

Is the given vector a node anywhere in this compound?

Return values
trueif nodeVector is a node anywhere in this compound
falseif nodeVector is not a node anywhere in this compound
Todo:
Use std::find_if()

Implements tgRigidInfo.

Definition at line 167 of file tgCompoundRigidInfo.cpp.

btCompoundShape * tgCompoundRigidInfo::createCompoundShape ( tgWorld world) const

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

Returns
a pointer to the corresponding btCollisionShape

Definition at line 61 of file tgCompoundRigidInfo.cpp.

Here is the caller graph for this function:

btVector3 tgCompoundRigidInfo::getCenterOfMass ( ) const
virtual

Return the center of mass of all the tgRigidInfo objects in the tree.

Returns
the center of mass of all the tgRigidInfo objects in the tree
Return values
azero vector if the mass is zero
Todo:

Make this const here and in all base classes and derived classes.

Make rigid const when tgCompoundRigidInfo::getCenterOfMass() is const.

If all m_rigids are supplied in the constructor, this can be calculated in the constructor and cashed as a const member variable.

Implements tgRigidInfo.

Definition at line 47 of file tgCompoundRigidInfo.cpp.

Here is the caller graph for this function:

virtual btCollisionObject* tgCompoundRigidInfo::getCollisionObject ( )
inlinevirtual

Return a pointer to the collisionObject without upcasting

Returns
a pointer to the corresponding btCollisionObject

Reimplemented from tgRigidInfo.

Definition at line 131 of file tgCompoundRigidInfo.h.

virtual const btCollisionObject* tgCompoundRigidInfo::getCollisionObject ( ) const
inlinevirtual

Return a pointer to the collisionObject without upcasting

Returns
a pointer to the corresponding btCollisionObject

Reimplemented from tgRigidInfo.

Definition at line 140 of file tgCompoundRigidInfo.h.

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

Return a pointer to the corresponding btCollisionShape.

Returns
a pointer to the corresponding btCollisionShape

Implements tgRigidInfo.

Definition at line 86 of file tgCompoundRigidInfo.cpp.

Here is the call graph for this function:

virtual tgCompoundRigidInfo* tgCompoundRigidInfo::getCompound ( )
inlinevirtual

Return a non-const pointer to this object.

Todo:
What is the purpose? The caller must already have the object, a reference or a pointer to be able to call this.

Implements tgRigidInfo.

Definition at line 169 of file tgCompoundRigidInfo.h.

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

Return a const pointer to this object.

Todo:

What is the purpose? The caller must already have the object, a reference or a pointer to be able to call this.

Add this to the base classes and derived classes.

Implements tgRigidInfo.

Definition at line 177 of file tgCompoundRigidInfo.h.

virtual btVector3 tgCompoundRigidInfo::getConnectionPoint ( const btVector3 &  referencePoint,
const btVector3 &   
) const
inlinevirtual

By default this should look for the object that has the closest connectionPoint to the destination or something. That may change, or we might provide a strategy-based object here?

Implements tgRigidInfo.

Definition at line 157 of file tgCompoundRigidInfo.h.

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

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

Reimplemented in tgBoxInfo, tgRodInfo, and tgSphereInfo.

Definition at line 260 of file tgRigidInfo.h.

Here is the call graph for this function:

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

Return a set of the nodes contained anywhere in this compound.

Returns
a set of the nodes contained anywhere in this compound
Todo:
Use std::accumulate()

Implements tgRigidInfo.

Definition at line 192 of file tgCompoundRigidInfo.cpp.

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

Implements tgRigidInfo.

Definition at line 147 of file tgCompoundRigidInfo.cpp.

Here is the call graph for this function:

double tgCompoundRigidInfo::getMass ( ) const
virtual

Return the compound's mass. The mass is the sum of the masses of all the tgRigidInfo objects in the compound.

Todo:
Do this in the constructor and cache the result as a member variable.
Todo:
Use std::accumulate()

Implements tgRigidInfo.

Definition at line 103 of file tgCompoundRigidInfo.cpp.

Here is the caller graph for this function:

btRigidBody * tgCompoundRigidInfo::getRigidBody ( )
virtual

Return a pointer to the corresponding btRigidBody.

Returns
a pointer to the corresponding btRigidBody

Reimplemented from tgRigidInfo.

Definition at line 114 of file tgCompoundRigidInfo.cpp.

const btRigidBody * tgCompoundRigidInfo::getRigidBody ( ) const
virtual

Return a const pointer to the corresponding btRigidBody.

Returns
a pointer to the corresponding btRigidBody

Reimplemented from tgRigidInfo.

Definition at line 120 of file tgCompoundRigidInfo.cpp.

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 149 of file tgRigidInfo.h.

Here is the caller graph for this function:

btTransform tgCompoundRigidInfo::getTransform ( ) const
virtual

Return an identity btTransform with the origin being the center of mass.

Returns
an identity btTransform with the origin being the center of mass

Implements tgRigidInfo.

Definition at line 95 of file tgCompoundRigidInfo.cpp.

Here is the call graph for this function:

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 273 of file tgRigidInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void tgCompoundRigidInfo::setCollisionObject ( btCollisionObject *  collisionObject)
virtual

Set the collision object to a new collision object

Returns
a pointer to the corresponding btCollisionObject
Todo:
Use std::for_each()

Reimplemented from tgRigidInfo.

Definition at line 136 of file tgCompoundRigidInfo.cpp.

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 137 of file tgRigidInfo.h.

void tgCompoundRigidInfo::setRigidBody ( btRigidBody *const  rigidBody)
virtual

Set the corresponding btRigidBody.

Parameters
[in,out]apointer to a btRigidBody
Todo:
Use std::for_each()

Reimplemented from tgRigidInfo.

Definition at line 126 of file tgCompoundRigidInfo.cpp.

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 163 of file tgRigidInfo.h.

bool tgCompoundRigidInfo::sharesNodesWith ( const tgRigidInfo other) const
virtual
Todo:

Make this const in all base classes and all derived classes.

Make other const in all base classes and all derived classes.

Todo:
Use std::find_if()

Reimplemented from tgRigidInfo.

Definition at line 180 of file tgCompoundRigidInfo.cpp.

Member Data Documentation

btCollisionObject* tgRigidInfo::m_collisionObject
mutableprotectedinherited

A pointer to the corresponding btCollisionObject. Typically a btRigidBody, but can also be a btGhostObject

Definition at line 347 of file tgRigidInfo.h.

btCollisionShape* tgRigidInfo::m_collisionShape
mutableprotectedinherited

A pointer to the corresponding btCollisionShape.

Definition at line 332 of file tgRigidInfo.h.

btCompoundShape* tgCompoundRigidInfo::m_compoundShape
mutableprotected

The btCompoundShape that represents this compound to Bullet.

Definition at line 216 of file tgCompoundRigidInfo.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 341 of file tgRigidInfo.h.

std::vector<tgRigidInfo*> tgCompoundRigidInfo::m_rigids
protected

A collection of tgRigidInfo pointers, each supplied by the client.

Todo:

Change this to std::set to prevent duplication.

Make this const and initialize it in the constructor.

Definition at line 211 of file tgCompoundRigidInfo.h.


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