NTRT Simulator  Version: Master
 All Classes Namespaces 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 
30 #include "tgRigidInfo.h"
32 // @todo: do we just need the btCompoundShape here?
33 #include "btBulletDynamicsCommon.h"
34 #include <vector>
35 
37 {
38  public:
39 
47 
48  tgModel* createModel(tgWorld& world);
49 
57  {
58  }
59 
68  void addRigid(tgRigidInfo& rigid);
69 
79  virtual btVector3 getCenterOfMass() const;
80 
86  btCompoundShape* createCompoundShape(tgWorld& world) const;
87 
92  virtual btCollisionShape* getCollisionShape(tgWorld& world) const;
93 
98  virtual btTransform getTransform() const;
99 
107  virtual double getMass() const;
108 
113  virtual btRigidBody* getRigidBody();
114 
119  virtual const btRigidBody* getRigidBody() const;
120 
125  virtual void setRigidBody(btRigidBody* const rigidBody);
126 
131  virtual btCollisionObject* getCollisionObject()
132  {
133  return m_collisionObject;
134  }
135 
140  virtual const btCollisionObject* getCollisionObject() const
141  {
142  return m_collisionObject;
143  }
144 
149  virtual void setCollisionObject(btCollisionObject* collisionObject);
150 
156  virtual btVector3
157  getConnectionPoint(const btVector3& referencePoint,
158  const btVector3& /* destinationPoint */) const
159  {
160  // @todo: make this work...
161  return referencePoint;
162  }
163 
169  virtual tgCompoundRigidInfo * getCompound() { return this; }
170 
177  virtual const tgCompoundRigidInfo * getCompound() const { return this; }
178 
183  virtual std::set<tgRigidInfo*> getLeafRigids();
184 
190  virtual bool containsNode(const btVector3& nodeVector) const;
191 
196  virtual bool sharesNodesWith(const tgRigidInfo& other) const;
197 
202  std::set<btVector3> getContainedNodes() const;
203 
204 protected:
205 
211  /* const */ std::vector<tgRigidInfo*> m_rigids;
212 
216  mutable btCompoundShape * m_compoundShape;
217 
218 };
219 
220 
221 #endif
Definition of abstract class tgRigidInfo.
std::vector< tgRigidInfo * > m_rigids
virtual bool containsNode(const btVector3 &nodeVector) const
virtual btRigidBody * getRigidBody()
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 btCollisionObject * getCollisionObject()
virtual btVector3 getCenterOfMass() const
virtual void setCollisionObject(btCollisionObject *collisionObject)
virtual btTransform getTransform() const
btCollisionObject * m_collisionObject
Definition: tgRigidInfo.h:347
virtual void setRigidBody(btRigidBody *const rigidBody)
virtual std::set< tgRigidInfo * > getLeafRigids()
void addRigid(tgRigidInfo &rigid)
virtual const btCollisionObject * getCollisionObject() const
virtual tgCompoundRigidInfo * getCompound()
btCompoundShape * m_compoundShape
virtual btCollisionShape * getCollisionShape(tgWorld &world) const
btCompoundShape * createCompoundShape(tgWorld &world) const