30 #include "LinearMath/btVector3.h"
68 assertUniqueElements(
"All nodes must be unique.");
71 for(
int i = 0; i < nodes.size(); i++) {
72 addElement(
tgNode(nodes[i]));
79 assertUniqueElements(
"All nodes must be unique.");
91 void setNode(
int key,
const btVector3& node)
98 setElement(key, node);
101 std::vector<tgNode>& getNodes()
103 return getElements();
106 const std::vector<tgNode>& getNodes()
const
108 return getElements();
133 int addNode(
const btVector3& node, std::string tags) {
138 return addElement(node);
155 const btVector3 node(x, y, z);
159 int addNode(
double x,
double y,
double z, std::string tags)
161 const tgNode node(x, y, z, tags);
168 tgPair pair(
int from,
int to, std::string tags =
"");
175 void move(
const btVector3& offset)
178 std::vector<tgNode>& nodes = getElements();
179 for(
int i = 0; i < nodes.size(); i++) {
184 void moveNode(
int idx,
const btVector3 offset)
186 (*this)[idx] += offset;
189 void addRotation(
const btVector3& fixedPoint,
190 const btVector3& axis,
193 btQuaternion rotation(axis, angle);
194 addRotation(fixedPoint, rotation);
197 void addRotation(
const btVector3& fixedPoint,
198 const btVector3& fromOrientation,
199 const btVector3& toOrientation)
203 addRotation(fixedPoint, rotation);
206 void addRotation(
const btVector3& fixedPoint,
207 const btQuaternion& rotation)
209 std::vector<tgNode>& nodes = getNodes();
210 for(
int i = 0; i < nodes.size(); i++) {
211 nodes[i].addRotation(fixedPoint, rotation);
218 std::map<int, std::string> m_names;
220 void assertNodeExists(
int key)
const
223 std::stringstream ss;
225 throw std::out_of_range(
"Node at index " + ss.str() +
" does not exist");
229 void assertUniqueNodes()
const
231 assertUniqueElements(
"Nodes muse be unique.");
248 os <<
"tgNodes(" << std::endl;
249 const std::vector<tgNode>& nodes = n.getNodes();
250 for(
int i = 0; i < nodes.size(); i++) {
251 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.
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