NTRT Simulator  Version: Master
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
tgSpringCableAnchor.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_TGSPRINGCABLEANCHOR_H_
20 #define SRC_CORE_TGSPRINGCABLEANCHOR_H_
21 
30 // The Bullet Physics library
31 #include "LinearMath/btScalar.h"
32 #include "LinearMath/btVector3.h"
33 // The C++ Standard Library
34 
35 #include <utility> //std::pair
36 
37 
43 {
44 public:
45 
57  tgSpringCableAnchor(btVector3 pos,
58  btVector3 cn = btVector3(0.0, 0.0, 0.0),
59  bool perm = true,
60  bool slide = false) :
61  permanent(perm),
62  sliding(slide),
63  force(0.0, 0.0, 0.0)
64  {
65  // Suppress unused variables, since these require btTransforms to be stored properly
66  (void) pos;
67  (void) cn;
68  }
69 
73  virtual ~tgSpringCableAnchor() { }
74 
78  virtual btVector3 getWorldPosition() const = 0;
79 
87  virtual bool setWorldPosition(btVector3& newPos) = 0;
88 
93  virtual btVector3 getRelativePosition() const = 0;
94 
101  virtual btVector3 getContactNormal() const = 0;
102 
107  const btVector3& getForce() const
108  {
109  return force;
110  }
111 
116  const bool permanent;
117 
124  const bool sliding;
125 
126 protected:
127 
132  btVector3 force;
133 
134 };
135 
136 #endif // SRC_CORE_TGSPRINGCABLEANCHOR_H_
virtual btVector3 getWorldPosition() const =0
virtual btVector3 getContactNormal() const =0
virtual bool setWorldPosition(btVector3 &newPos)=0
virtual btVector3 getRelativePosition() const =0
const btVector3 & getForce() const
tgSpringCableAnchor(btVector3 pos, btVector3 cn=btVector3(0.0, 0.0, 0.0), bool perm=true, bool slide=false)