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

#include <tgNodes.h>

Inheritance diagram for tgNodes:
Collaboration diagram for tgNodes:

Public Member Functions

 tgNodes ()
 
 tgNodes (std::vector< btVector3 > &nodes)
 
 tgNodes (std::vector< tgNode > &nodes)
 
 ~tgNodes ()
 
void setNode (int key, const btVector3 &node)
 
void setNode (int key, const tgNode &node)
 
std::vector< tgNode > & getNodes ()
 
const std::vector< tgNode > & getNodes () const
 
bool nodeExists (int key) const
 
int addNode (const btVector3 &node)
 
int addNode (const btVector3 &node, std::string tags)
 
int addNode (const tgNode &node)
 
int addNode (double x, double y, double z)
 
int addNode (double x, double y, double z, std::string tags)
 
tgPair pair (int from, int to, std::string tags="")
 
void move (const btVector3 &offset)
 
void moveNode (int idx, 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 (const btVector3 &referencePoint, double scaleFactor)
 
std::vector< tgNode * > find (std::string tags)
 
int size () const
 
std::vector< tgNode * > findAll ()
 
std::vector< tgNode * > findUntagged ()
 
bool contains (const tgNode &needle) const
 
tgNodeoperator[] (int key)
 
const tgNodeoperator[] (int key) const
 
tgNodeoperator-= (const tgNode &other)
 
tgNodeoperator-= (const std::vector< tgNode * > other)
 
tgNodeoperator+= (const tgNode &other)
 
tgNodeoperator+= (const std::vector< tgNode * > other)
 

Static Public Member Functions

static bool contains (std::vector< tgNode * > haystack, const tgNode *needle)
 

Protected Member Functions

void assertNodeExists (int key) const
 
void assertUniqueNodes () const
 
int addElement (tgNodeelement)
 
void addElements (std::vector< tgNode * > elements)
 
void setElement (int key, tgNodeelement)
 
std::vector< tgNode > & getElements ()
 
const std::vector< tgNode > & getElements () const
 
void removeElement (const tgNode &element)
 
void removeElement (const tgNode *element)
 
void removeElements (const std::vector< tgNode > &elements)
 
void removeElements (const std::vector< tgNode * > &elements)
 
tgNodegetElement (int key)
 
const tgNodegetElement (int key) const
 
bool keyExists (int key) const
 
bool elementExists (const tgNode &element) const
 
void assertKeyExists (int key, std::string message="Element at index does not exist") const
 
void assertUnique (tgNode &element, std::string message="Taggable elements must be unique.")
 
void assertUniqueElements (std::string message="Taggable elements must be unique.") const
 
tgTaggable_taggable (tgNode *obj)
 

Protected Attributes

std::map< int, std::string > m_names
 

Detailed Description

A node is an attachment point. The client identifies nodes with an integer index or selects them using tags (see tgTaggable). : add error checking

Todo:
: move operator[] out of tgTaggables into here

Definition at line 49 of file tgNodes.h.

Constructor & Destructor Documentation

tgNodes::tgNodes ( )
inline

Create an empty set of nodes.

Definition at line 55 of file tgNodes.h.

tgNodes::tgNodes ( std::vector< btVector3 > &  nodes)
inline

Create a set of nodes given a vector of btVector3.

Parameters
[in]nodesa vector of btVector3; the elements must be unique
Author
Lee Brownston
Date
Wed 26 Feb 2014

Definition at line 65 of file tgNodes.h.

tgNodes::~tgNodes ( )
inline

The destructor has nothing to do.

Definition at line 84 of file tgNodes.h.

Member Function Documentation

int tgNodes::addNode ( const btVector3 &  node)
inline

Add a node and return the created index.

Parameters
[in]nodea btVector3
Returns
the key under which btVector3 is stored
Todo:
If node is already a value in the map, return its key.

Definition at line 129 of file tgNodes.h.

int tgNodes::addNode ( double  x,
double  y,
double  z 
)
inline

Add a node specified by its coordinates and return the created index.

Parameters
[in]xthe x coordinate of the btVector3
[in]ythe y coordinate of the btVector3
[in]zthe z coordinate of the btVector3
Returns
the key under which btVector3 is stored : Do we need this really? It complicates things like named nodes...
Todo:
If node is already a value in the map, return its index.

Definition at line 153 of file tgNodes.h.

Here is the call graph for this function:

std::vector<tgNode *> tgTaggables< tgNode >::find ( std::string  tags)
inlineinherited

Return a vector of pointers to Ts that have all of the specified tags.

Definition at line 64 of file tgTaggables.h.

bool tgTaggables< tgNode >::keyExists ( int  key) const
inlineprotectedinherited

Is the index within range.

Parameters
[in]keyan int
Return values
trueif key is within range
falseif key is not within range

Definition at line 229 of file tgTaggables.h.

Here is the caller graph for this function:

void tgNodes::move ( const btVector3 &  offset)
inline

Add the given btVector3 to all btVector3 objects in elements.

Parameters
[in]offseta btVector3 to add to all the btVector3 objects in m_nodes
Todo:
use std::for_each()

Definition at line 175 of file tgNodes.h.

bool tgNodes::nodeExists ( int  key) const
inline

Is the index within range.

Parameters
[in]keyan int
Return values
trueif key is within range
falseif key is not within range

Definition at line 118 of file tgNodes.h.

Here is the call graph for this function:

tgNode & tgTaggables< tgNode >::operator-= ( const tgNode other)
inlineinherited

Remove the elements contained in 'other' from this object

Definition at line 136 of file tgTaggables.h.

tgNode & tgTaggables< tgNode >::operator[] ( int  key)
inlineinherited

Return a non-const reference to the element that is indexed by the int key. It must be in m_elements.

Parameters
[in]keythe key of the element to retrieve a const reference to the element that is indexed by idx

Definition at line 123 of file tgTaggables.h.

tgPair tgNodes::pair ( int  from,
int  to,
std::string  tags = "" 
)

Create a tgPair by connecting two contained nodes

Definition at line 30 of file tgNodes.cpp.

Here is the caller graph for this function:

void tgNodes::setNode ( int  key,
const btVector3 &  node 
)
inline

Assign the given vector to the given key.

Parameters
[in]nodea btVector3
idx]the integer by which the btVector3 is indexed

Definition at line 91 of file tgNodes.h.


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