NTRT Simulator  Version: Master
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
tgBoxMoreAnchorsInfo.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 BTEN_BOX_MORE_ANCHORS_H
20 #define BTEN_BOX_MORE_ANCHORS_H
21 
30 // This library
31 #include "tgPairs.h"
32 //#include "tgRigidInfo.h"
33 #include "tgBoxInfo.h"
34 // The NTRT Core Library
35 #include "tgUtil.h"
36 //#include "core/tgBox.h"
37 #include "core/tgBoxMoreAnchors.h"
38 
39 // The Bullet Physics library
40 #include "btBulletDynamicsCommon.h"
41 
42 class btVector3;
43 
44 // @todo: Need to take tags into account...
45 
64 public:
65 
74  tgBoxMoreAnchorsInfo(const tgBox::Config& config);
75 
81  tgBoxMoreAnchorsInfo(const tgBox::Config& config, tgTags tags);
82 
90  tgBoxMoreAnchorsInfo(const tgBox::Config& config, const tgPair& pair);
91 
99  tgBoxMoreAnchorsInfo(const tgBox::Config& config, tgTags tags,
100  const tgPair& pair);
101 
105  virtual ~tgBoxMoreAnchorsInfo() {}
106 
112  tgRigidInfo* createRigidInfo(const tgPair& pair);
113 
118  virtual tgModel* createModel(tgWorld& world);
119 
146  virtual std::set<tgRigidInfo*> getLeafRigids();
147 
153  virtual bool containsNode(const btVector3& nodeVector) const;
154 
162  // virtual std::set<btVector3> getContainedNodes() const;
163 
164 protected:
165 
176  bool isNodeOnBoxSurface(const btVector3& nodeVector) const;
177 
190  btVector3 getHalfExtents() const;
191 
198  std::string getBoxOrientation() const;
199 
205  btVector3 getHalfExtentsOrientedX() const;
206  btVector3 getHalfExtentsOrientedY() const;
207  btVector3 getHalfExtentsOrientedZ() const;
208 
209 private:
210 
213 
215  tgBoxMoreAnchorsInfo& operator=(const tgBoxMoreAnchorsInfo&);
216 
217  // The following variable is used in the half extents checking.
218  // This "SIMD_EPSILON" is what btVector3 uses in its fuzzyZero method,
219  // which motivates its use here.
220  // @TODO: will this not work sometimes??
221  double tgEpsilon = SIMD_EPSILON * 10;
222 
223  // note that tgBoxInfo has the following two private variables:
224  //const tgPair m_pair;
225  //const tgBox::Config m_config;
226 
227 };
228 
235 inline std::ostream& operator<<(std::ostream& os, const tgBoxMoreAnchorsInfo& box)
236 {
237  os << "tgBoxMoreAnchorsInfo(" << box.getFrom() << ", " << box.getTo() <<")";
238  return os;
239 }
240 
241 #endif
std::ostream & operator<<(std::ostream &os, const tgBoxMoreAnchorsInfo &box)
tgBoxMoreAnchorsInfo(const tgBox::Config &config)
const btVector3 & getFrom() const
Definition: tgBoxInfo.h:110
Definition of class tgPairs.
tgRigidInfo * createRigidInfo(const tgPair &pair)
Class that interfaces with Bullet to build the boxes.
btVector3 getHalfExtents() const
const btVector3 & getTo() const
Definition: tgBoxInfo.h:113
std::string getBoxOrientation() const
btVector3 getHalfExtentsOrientedX() const
virtual tgModel * createModel(tgWorld &world)
Definition: tgPair.h:48
bool isNodeOnBoxSurface(const btVector3 &nodeVector) const
Rand seeding simular to the evolution and terrain classes.
virtual std::set< tgRigidInfo * > getLeafRigids()
Create a box shape. This class supports more than two anchor points.
Definition: tgTags.h:44
virtual bool containsNode(const btVector3 &nodeVector) const