NTRT Simulator  Version: Master
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
tgGhostModel.cpp
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 
26 // This module
27 #include "tgGhostModel.h"
28 #include "core/tgModelVisitor.h"
29 // The Bullet Physics library
30 #include "BulletCollision/CollisionDispatch/btGhostObject.h"
31 #include "btBulletDynamicsCommon.h"
32 // The C++ Standard Library
33 #include <cassert>
34 #include <stdexcept>
35 
36 tgGhostModel::tgGhostModel(btPairCachingGhostObject* pCollisionObject,
37  const tgTags& tags) :
38  tgModel(tags),
39  m_pCollisionObject(pCollisionObject)
40 {
41  if (pCollisionObject == NULL)
42  {
43  throw std::invalid_argument("Pointer to ghostObject is NULL");
44  }
45 
46  // Postcondition
47  assert(invariant());
48  assert(m_pCollisionObject == pCollisionObject);
49 }
50 
52 
54 {
55  v.render(*this);
56 
57 }
58 
60 {
61  // This does not appear to be called
62 
63  // Postcondition
64  // This does not preserve the invariant
65 }
66 
67 bool tgGhostModel::invariant() const
68 {
69  return
70  (m_pCollisionObject != NULL);
71 }
virtual void onVisit(const tgModelVisitor &v) const
Like tgBaseRigid, but uses btPairCachingGhostObject instead.
btPairCachingGhostObject * m_pCollisionObject
Definition: tgGhostModel.h:77
virtual void render(const tgRod &rod) const
Contains the definition of interface class tgModelVisitor.
virtual void teardown()
virtual ~tgGhostModel()
Definition: tgTags.h:44