NTRT Simulator  Version: Master
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
tgRigidAutoCompound Class Reference

#include <tgRigidAutoCompound.h>

Public Member Functions

 tgRigidAutoCompound (std::vector< tgRigidInfo * > rigids)
 
 tgRigidAutoCompound (std::deque< tgRigidInfo * > rigids)
 
std::vector< tgRigidInfo * > execute ()
 

Protected Member Functions

void setRigidBodyForGroup (btCollisionObject *body, std::deque< tgRigidInfo * > &group)
 
void setRigidInfoForGroup (tgRigidInfo *rigidInfo, std::deque< tgRigidInfo * > &group)
 
void groupRigids ()
 
std::deque< tgRigidInfo * > findGroup (tgRigidInfo *rigid, std::deque< tgRigidInfo * > &ungrouped)
 
void createCompounds ()
 
tgRigidInfocreateCompound (std::deque< tgRigidInfo * > rigids)
 
bool rigidBelongsIn (tgRigidInfo *rigid, std::deque< tgRigidInfo * > group)
 
std::string random_tag_hash ()
 

Protected Attributes

std::deque< tgRigidInfo * > m_rigids
 
std::vector< std::deque
< tgRigidInfo * > > 
m_groups
 
std::vector< tgRigidInfo * > m_compounded
 

Detailed Description

Rigids that share nodes should automatically be compounded before initializing. This automatically compounds shapes that rigids that share nodes while maintaining the original mapping for later transformation back into the original list (but with the RigidBody being a compound object that multiple tgRigidInfos may point to).

Definition at line 46 of file tgRigidAutoCompound.h.

Member Function Documentation

void tgRigidAutoCompound::createCompounds ( )
protected

Creates tgCompoundRigidInfos for compounded bodies. Also, adds tags to each of the consitutent tgRigidInfos that designate what compound each of the models will belong to. These tags are in the form "compound_h8A0k2", where the second part is a random 6-digit alphanumeric hash via random_tag_hash().

Definition at line 133 of file tgRigidAutoCompound.cpp.

std::string tgRigidAutoCompound::random_tag_hash ( )
protected

For adding tags to compounded rigid bodies. This function generates a 6-digit alphanumeric hash.

Returns
a 6-character string of random alphanumberic characters.

Many thanks to StackOverflow users Ates Goral and Mehrdad Afshari for a framework for this function. http://stackoverflow.com/questions/440133/how-do-i-create-a-random-alpha-numeric-string-in-c

This function should generate a random string with a uniform distribution over the characters in the 'alphanum' char array below.

Definition at line 168 of file tgRigidAutoCompound.cpp.


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