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

#include <tgStructure.h>

Inheritance diagram for tgStructure:
Collaboration diagram for tgStructure:

Public Member Functions

 tgStructure (const tgStructure &orig)
 
 tgStructure (const tgTags &tags)
 
 tgStructure (const std::string &space_separated_tags)
 
void addNode (double x, double y, double z, std::string tags="")
 
void addNode (tgNode &newNode)
 
void addPair (int fromNodeIdx, int toNodeIdx, std::string tags="")
 
void addPair (const btVector3 &from, const btVector3 &to, std::string tags="")
 
void removePair (const tgPair &pair)
 
void move (const btVector3 &offset)
 
void addRotation (const btVector3 &fixedPoint, const btVector3 &axis, double angle)
 
void addRotation (const btVector3 &fixedPoint, const btVector3 &fromOrientation, const btVector3 &toOrientation)
 
void addRotation (const btVector3 &fixedPoint, const btQuaternion &rotation)
 
void scale (double scaleFactor)
 
void scale (const btVector3 &referencePoint, double scaleFactor)
 
void addChild (tgStructure *child)
 
void addChild (const tgStructure &child)
 
const tgNodesgetNodes () const
 
tgNodefindNode (const std::string &name)
 
btVector3 getCentroid () const
 
const tgPairsgetPairs () const
 
tgPairfindPair (const btVector3 &from, const btVector3 &to)
 
const std::vector< tgStructure * > & getChildren () const
 
tgStructurefindChild (const std::string &name)
 
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

Representation of a geometric structure containing nodes (points), pairs of nodes, and child structures. Note that nodes, pairs, and structures are all taggable and searchable by tags. Further tools in the chain are used to create physical representations of the structures with rods, muscles, etc. Note that tags can be anything you want – you'll specify the tags that you want to use to build things like rods or muscles during the build phase.

Definition at line 54 of file tgStructure.h.

Constructor & Destructor Documentation

tgStructure::tgStructure ( const tgStructure orig)

Copy constructor

Definition at line 44 of file tgStructure.cpp.

Member Function Documentation

void tgStructure::addChild ( tgStructure child)

Add a child structure. Note that this will be copied rather than being a reference or a pointer.

Todo:
: check to make sure we don't already have one of these structures (what does that mean?)
Note
: We only want to check that pairs are the same at build time, since one structure may build the pairs, while another may not depending on its tags.

Definition at line 167 of file tgStructure.cpp.

void tgStructure::addNode ( double  x,
double  y,
double  z,
std::string  tags = "" 
)

Add a node using x, y, and z (just for convenience)

Definition at line 70 of file tgStructure.cpp.

Here is the call graph for this function:

void tgStructure::addNode ( tgNode newNode)

Add a node using a node - since keeping track of nodes seems more useful than pairs for string attachments

Definition at line 75 of file tgStructure.cpp.

Here is the call graph for this function:

void tgStructure::addPair ( int  fromNodeIdx,
int  toNodeIdx,
std::string  tags = "" 
)

Add a pair that connects two of our nodes together

Definition at line 80 of file tgStructure.cpp.

Here is the call graph for this function:

void tgStructure::addPair ( const btVector3 &  from,
const btVector3 &  to,
std::string  tags = "" 
)

Add a pair that connects any two vector3s

Definition at line 85 of file tgStructure.cpp.

void tgStructure::addRotation ( const btVector3 &  fixedPoint,
const btVector3 &  axis,
double  angle 
)
Todo:
add rotate functionality

Definition at line 120 of file tgStructure.cpp.

tgStructure & tgStructure::findChild ( const std::string &  name)

Looks through children we own and those that belong to our children (using BFS) and returns the first child with a matching name. Throws an error if a child is not a found with a matching name. (added to accommodate structures encoded in YAML)

Parameters
[in]namethe name of the structure to find and return
Returns
a reference to the structure that was found

Definition at line 249 of file tgStructure.cpp.

tgNode & tgStructure::findNode ( const std::string &  name)

Looks through nodes that we own and those that belong to child nodes (using BFS) and returns the first node with a matching name. Throws an error if a node is not a found with a matching name. (added to accommodate structures encoded in YAML)

Parameters
[in]namethe name of the node to find and return
Returns
a reference to the node that was found

Definition at line 206 of file tgStructure.cpp.

tgPair & tgStructure::findPair ( const btVector3 &  from,
const btVector3 &  to 
)

Looks through pairs that we own and those that belong to child nodes (using BFS) and returns the first pair with matching endpoint coordinates. Throws an error if a pair is not a found. (added to accommodate structures encoded in YAML)

Parameters
[in]fromthe vector on one end of the pair to find and return
[in]tothe vector on the other end of the pair to find and return
Returns
a reference to the pair that was found

Definition at line 226 of file tgStructure.cpp.

btVector3 tgStructure::getCentroid ( ) const

Returns the mean position of the nodes in the structure (including children) (added to accommodate structures encoded in YAML)

Returns
a btVector3 that represents the centroid of the structure

Definition at line 185 of file tgStructure.cpp.

const std::vector<tgStructure*>& tgStructure::getChildren ( ) const
inline

Return our child structures

Definition at line 184 of file tgStructure.h.

const tgNodes& tgStructure::getNodes ( ) const
inline

Get all of our nodes Note: This only includes nodes owned by this structure. use 'findNodes' to search child nodes as well.

Definition at line 138 of file tgStructure.h.

Here is the caller graph for this function:

const tgPairs& tgStructure::getPairs ( ) const
inline

Get all of our pairs Note: This only includes nodes owned by this structure. Use 'findPairs' to search child nodes as well.

Definition at line 165 of file tgStructure.h.

Here is the caller graph for this function:


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