29 #include "LinearMath/btVector3.h"
67 assertUniqueElements(
"All nodes must be unique.");
70 for(
int i = 0; i < nodes.size(); i++) {
71 addElement(
tgNode(nodes[i]));
78 assertUniqueElements(
"All nodes must be unique.");
90 void setNode(
int key,
const btVector3& node)
97 setElement(key, node);
100 std::vector<tgNode>& getNodes()
102 return getElements();
105 const std::vector<tgNode>& getNodes()
const
107 return getElements();
132 int addNode(
const btVector3& node, std::string tags) {
137 return addElement(node);
154 const btVector3 node(x, y, z);
158 int addNode(
double x,
double y,
double z, std::string tags)
160 const tgNode node(x, y, z, tags);
167 tgPair pair(
int from,
int to, std::string tags =
"");
174 void move(
const btVector3& offset)
177 std::vector<tgNode>& nodes = getElements();
178 for(
int i = 0; i < nodes.size(); i++) {
183 void moveNode(
int idx,
const btVector3 offset)
185 (*this)[idx] += offset;
188 void addRotation(
const btVector3& fixedPoint,
189 const btVector3& axis,
192 btQuaternion rotation(axis, angle);
193 addRotation(fixedPoint, rotation);
196 void addRotation(
const btVector3& fixedPoint,
197 const btVector3& fromOrientation,
198 const btVector3& toOrientation)
202 addRotation(fixedPoint, rotation);
205 void addRotation(
const btVector3& fixedPoint,
206 const btQuaternion& rotation)
208 std::vector<tgNode>& nodes = getNodes();
209 for(
int i = 0; i < nodes.size(); i++) {
210 nodes[i].addRotation(fixedPoint, rotation);
217 std::map<int, std::string> m_names;
219 void assertNodeExists(
int key)
const
222 std::stringstream ss;
224 throw std::out_of_range(
"Node at index " + ss.str() +
" does not exist");
228 void assertUniqueNodes()
const
230 assertUniqueElements(
"Nodes muse be unique.");
247 os <<
"tgNodes(" << std::endl;
248 const std::vector<tgNode>& nodes = n.getNodes();
249 for(
int i = 0; i < nodes.size(); i++) {
250 os <<
" " << nodes[i] << std::endl;
void setNode(int key, const btVector3 &node)
bool nodeExists(int key) const
tgPair pair(int from, int to, std::string tags="")
static btQuaternion getQuaternionBetween(btVector3 a, btVector3 b)
Contains the definition of class tgTaggables $Id$.
Definition of class tgNode.
int addNode(double x, double y, double z)
tgNodes(std::vector< btVector3 > &nodes)
std::ostream & operator<<(std::ostream &os, const tgNodes &n)
void move(const btVector3 &offset)
int addNode(const btVector3 &node)
bool keyExists(int key) const