NTRT Simulator  v1.1
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
tgBulletSpringCableAnchor.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 SRC_CORE_TG_BULLET_SPRING_CABLE_ANCHOR_H_
20 #define SRC_CORE_TG_BULLET_SPRING_CABLE_ANCHOR_H_
21 
30 // This library
32 
33 // The Bullet Physics library
34 #include "LinearMath/btScalar.h"
35 #include "LinearMath/btVector3.h"
36 // The C++ Standard Library
37 #include <string>
38 #include <utility> //std::pair
39 
40 // Forward References
41 class btRigidBody;
42 class btPersistentManifold;
44 
54 {
55 public:
56  // tgBulletContactSpringCable needs to scale the forces
57  friend class tgBulletContactSpringCable;
58 
71  tgBulletSpringCableAnchor(btRigidBody *body,
72  btVector3 pos,
73  btVector3 cn = btVector3(0.0, 0.0, 0.0),
74  bool perm = true,
75  bool slide = false,
76  btPersistentManifold* m = NULL);
77 
82 
88  virtual btVector3 getWorldPosition() const;
89 
97  virtual bool setWorldPosition(btVector3& newPos);
98 
103  virtual btVector3 getRelativePosition() const;
104 
111  virtual btVector3 getContactNormal() const;
112 
120  bool updateManifold(btPersistentManifold* m);
121 
126  btPersistentManifold* getManifold() const
127  {
128  return manifold;
129  }
130 
137  btRigidBody * const attachedBody;
138 
145  std::pair<btScalar, btVector3> getManifoldDistance(btPersistentManifold* m) const;
146 
147 private:
148 
153  btVector3 attachedRelativeOriginalPosition;
154 
160  btVector3 contactNormal;
161 
167  btPersistentManifold* manifold;
168 
169 };
170 
171 #endif // SRC_CORE_TG_BULLET_SPRING_CABLE_ANCHOR_H_
tgBulletSpringCableAnchor(btRigidBody *body, btVector3 pos, btVector3 cn=btVector3(0.0, 0.0, 0.0), bool perm=true, bool slide=false, btPersistentManifold *m=NULL)
btPersistentManifold * getManifold() const
virtual btVector3 getWorldPosition() const
bool updateManifold(btPersistentManifold *m)
std::pair< btScalar, btVector3 > getManifoldDistance(btPersistentManifold *m) const
Definitions of class tgSpringCableAnchor.
virtual btVector3 getContactNormal() const
virtual btVector3 getRelativePosition() const
virtual bool setWorldPosition(btVector3 &newPos)