NTRT Simulator
 All Classes Files Functions Variables Typedefs Friends Pages
tgCompoundRigidInfo.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_COMPOUND_RIGID_INFO_H
20 #define TG_COMPOUND_RIGID_INFO_H
21 
29 #include "tgRigidInfo.h"
31 // @todo: do we just need the btCompoundShape here?
32 #include "btBulletDynamicsCommon.h"
33 #include <vector>
34 
36 {
37  public:
38 
46 
47  tgModel* createModel(tgWorld& world);
48 
56  {
57  }
58 
67  void addRigid(tgRigidInfo& rigid);
68 
78  virtual btVector3 getCenterOfMass() const;
79 
85  btCompoundShape* createCompoundShape(tgWorld& world) const;
86 
91  virtual btCollisionShape* getCollisionShape(tgWorld& world) const;
92 
97  virtual btTransform getTransform() const;
98 
106  virtual double getMass() const;
107 
112  virtual btRigidBody* getRigidBody()
113  {
114  return m_rigidBody;
115  }
116 
121  virtual const btRigidBody* getRigidBody() const
122  {
123  return m_rigidBody;
124  }
125 
131  virtual void setRigidBody(btRigidBody* const rigidBody);
132 
138  virtual btVector3
139  getConnectionPoint(const btVector3& referencePoint,
140  const btVector3& /* destinationPoint */) const
141  {
142  // @todo: make this work...
143  return referencePoint;
144  }
145 
151  virtual tgCompoundRigidInfo * getCompound() { return this; }
152 
159  virtual const tgCompoundRigidInfo * getCompound() const { return this; }
160 
165  virtual std::set<tgRigidInfo*> getLeafRigids();
166 
172  virtual bool containsNode(const btVector3& nodeVector) const;
173 
178  virtual bool sharesNodesWith(const tgRigidInfo& other) const;
179 
184  std::set<btVector3> getContainedNodes() const;
185 
186 protected:
187 
193  /* const */ std::vector<tgRigidInfo*> m_rigids;
194 
198  mutable btCompoundShape * m_compoundShape;
199 
203  btRigidBody * m_rigidBody;
204 
205 };
206 
207 
208 #endif
Definition of abstract class tgRigidInfo.
virtual btRigidBody * getRigidBody()
std::vector< tgRigidInfo * > m_rigids
virtual bool containsNode(const btVector3 &nodeVector) const
virtual const btRigidBody * getRigidBody() const
virtual bool sharesNodesWith(const tgRigidInfo &other) const
Contains the definition of class tgWorldBulletPhysicsImpl.
virtual btVector3 getConnectionPoint(const btVector3 &referencePoint, const btVector3 &) const
virtual const tgCompoundRigidInfo * getCompound() const
virtual double getMass() const
std::set< btVector3 > getContainedNodes() const
virtual btVector3 getCenterOfMass() const
virtual btTransform getTransform() const
virtual void setRigidBody(btRigidBody *const rigidBody)
virtual std::set< tgRigidInfo * > getLeafRigids()
void addRigid(tgRigidInfo &rigid)
virtual tgCompoundRigidInfo * getCompound()
btCompoundShape * m_compoundShape
virtual btCollisionShape * getCollisionShape(tgWorld &world) const
btCompoundShape * createCompoundShape(tgWorld &world) const