NTRT Simulator  v1.1
 All Classes Namespaces 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 
30 // This library
31 #include "tgNodes.h"
32 #include "tgPairs.h"
33 // The NTRT Core Library
34 #include "core/tgTaggable.h"
35 // The C++ Standard Library
36 #include <string>
37 #include <vector>
38 
39 // Forward declarations
40 class btQuaternion;
41 class btVector3;
42 class tgNode;
43 class tgTags;
44 
53 class tgStructure : public tgTaggable
54 {
55 public:
56 
57  tgStructure();
58 
59  tgStructure(const tgTags& tags);
60 
61  tgStructure(const std::string& space_separated_tags);
62 
63  virtual ~tgStructure();
64 
68  void addNode(double x, double y, double z, std::string tags = "");
69 
74  void addNode(tgNode& newNode);
75 
79  void addPair(int fromNodeIdx, int toNodeIdx, std::string tags = "");
80 
84  void addPair(const btVector3& from, const btVector3& to, std::string tags = "");
85 
86  void move(const btVector3& offset);
87 
91  void addRotation(const btVector3& fixedPoint,
92  const btVector3& axis,
93  double angle);
94 
95  void addRotation(const btVector3& fixedPoint,
96  const btVector3& fromOrientation,
97  const btVector3& toOrientation);
98 
99  void addRotation(const btVector3& fixedPoint,
100  const btQuaternion& rotation);
101 
106  void addChild(tgStructure* child);
107 
113  const tgNodes& getNodes() const
114  {
115  return m_nodes;
116  }
117 
123  const tgPairs& getPairs() const
124  {
125  return m_pairs;
126  }
127 
131  const std::vector<tgStructure*>& getChildren() const
132  {
133  return m_children;
134  }
135 
136 private:
137 
138  tgNodes m_nodes;
139 
140  tgPairs m_pairs;
141 
142  // we own these
143  std::vector<tgStructure*> m_children;
144 
145 };
146 
147 
148 #endif
const std::vector< tgStructure * > & getChildren() const
Definition: tgStructure.h:131
void addChild(tgStructure *child)
const tgNodes & getNodes() const
Definition: tgStructure.h:113
Definition of class tgPairs.
void addPair(int fromNodeIdx, int toNodeIdx, std::string tags="")
Definition: tgStructure.cpp:66
const tgPairs & getPairs() const
Definition: tgStructure.h:123
Definition of class tgNodes.
void addRotation(const btVector3 &fixedPoint, const btVector3 &axis, double angle)
Definition: tgStructure.cpp:99
Definition: tgNode.h:45
Contains the definition of class tgTaggable.
Definition: tgTags.h:44
void addNode(double x, double y, double z, std::string tags="")
Definition: tgStructure.cpp:56