NTRT Simulator
 All Classes Files Functions Variables Typedefs Friends Pages
tgStructure.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2012, United States Government, as represented by the
3  * Administrator of the National Aeronautics and Space Administration.
4  * All rights reserved.
5  *
6  * The NASA Tensegrity Robotics Toolkit (NTRT) v1 platform is licensed
7  * under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * http://www.apache.org/licenses/LICENSE-2.0.
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15  * either express or implied. See the License for the specific language
16  * governing permissions and limitations under the License.
17 */
18 
19 #ifndef TG_STRUCTURE_H
20 #define TG_STRUCTURE_H
21 
29 // This library
30 #include "tgNodes.h"
31 #include "tgPairs.h"
32 // The NTRT Core Library
33 #include "core/tgTaggable.h"
34 // The C++ Standard Library
35 #include <string>
36 #include <vector>
37 
38 // Forward declarations
39 class btQuaternion;
40 class btVector3;
41 class tgNode;
42 class tgTags;
43 
52 class tgStructure : public tgTaggable
53 {
54 public:
55 
56  tgStructure();
57 
58  tgStructure(const tgTags& tags);
59 
60  tgStructure(const std::string& space_separated_tags);
61 
62  virtual ~tgStructure();
63 
67  void addNode(double x, double y, double z, std::string tags = "");
68 
73  void addNode(tgNode& newNode);
74 
78  void addPair(int fromNodeIdx, int toNodeIdx, std::string tags = "");
79 
83  void addPair(const btVector3& from, const btVector3& to, std::string tags = "");
84 
85  void move(const btVector3& offset);
86 
90  void addRotation(const btVector3& fixedPoint,
91  const btVector3& axis,
92  double angle);
93 
94  void addRotation(const btVector3& fixedPoint,
95  const btVector3& fromOrientation,
96  const btVector3& toOrientation);
97 
98  void addRotation(const btVector3& fixedPoint,
99  const btQuaternion& rotation);
100 
105  void addChild(tgStructure* child);
106 
112  const tgNodes& getNodes() const
113  {
114  return m_nodes;
115  }
116 
122  const tgPairs& getPairs() const
123  {
124  return m_pairs;
125  }
126 
130  const std::vector<tgStructure*>& getChildren() const
131  {
132  return m_children;
133  }
134 
135 private:
136 
137  tgNodes m_nodes;
138 
139  tgPairs m_pairs;
140 
141  // we own these
142  std::vector<tgStructure*> m_children;
143 
144 };
145 
146 
147 #endif
const std::vector< tgStructure * > & getChildren() const
Definition: tgStructure.h:130
void addChild(tgStructure *child)
const tgNodes & getNodes() const
Definition: tgStructure.h:112
Definition of class tgPairs.
void addPair(int fromNodeIdx, int toNodeIdx, std::string tags="")
Definition: tgStructure.cpp:65
const tgPairs & getPairs() const
Definition: tgStructure.h:122
Definition of class tgNodes.
void addRotation(const btVector3 &fixedPoint, const btVector3 &axis, double angle)
Definition: tgStructure.cpp:98
Definition: tgNode.h:43
Contains the definition of class tgTaggable $Id$.
Definition: tgTags.h:43
void addNode(double x, double y, double z, std::string tags="")
Definition: tgStructure.cpp:55