NTRT Simulator
 All Classes Files Functions Variables Typedefs Friends Pages
tgPair.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 #include "tgPair.h"
27 
28 #include "tgUtil.h"
29 
30 
31 tgPair::tgPair() : tgTaggable() {}
32 
39 tgPair::tgPair(btVector3 from, btVector3 to) : m_pair(from, to), tgTaggable()
40 {}
41 
42 tgPair::tgPair(btVector3 from, btVector3 to, std::string tags) : m_pair(from, to), tgTaggable(tags)
43 {}
44 
51 btVector3& tgPair::getFrom()
52 {
53  assert(m_pair.first != NULL);
54  return m_pair.first;
55 }
56 
57 const btVector3& tgPair::getFrom() const
58 {
59  assert(m_pair.first != NULL);
60  return m_pair.first;
61 }
62 
67 void tgPair::setFrom(btVector3 from) { m_pair.first = from; }
68 
75 btVector3& tgPair::getTo()
76 {
77  assert(m_pair.second != NULL);
78  return m_pair.second;
79 }
80 
81 const btVector3& tgPair::getTo() const
82 {
83  assert(m_pair.second != NULL);
84  return m_pair.second;
85 }
86 
91 void tgPair::setTo(btVector3 to)
92 {
93  m_pair.second = to;
94 }
95 
96 void tgPair::addRotation(const btVector3& fixedPoint,
97  const btVector3& axis,
98  double angle)
99 {
100  tgUtil::addRotation(getFrom(), fixedPoint, axis, angle);
101  tgUtil::addRotation(getTo(), fixedPoint, axis, angle);
102 }
103 
104 void tgPair::addRotation(const btVector3& fixedPoint,
105  const btVector3& fromOrientation,
106  const btVector3& toOrientation)
107 {
108  tgUtil::addRotation(getFrom(), fixedPoint, fromOrientation, toOrientation);
109  tgUtil::addRotation(getTo(), fixedPoint, fromOrientation, toOrientation);
110 }
111 
112 void tgPair::addRotation(const btVector3& fixedPoint,
113  const btQuaternion& rotation)
114 {
115  tgUtil::addRotation(getFrom(), fixedPoint, rotation);
116  tgUtil::addRotation(getTo(), fixedPoint, rotation);
117 }
118 
119 void tgPair::move(const btVector3& offset)
120 {
121  m_pair.first += offset;
122  m_pair.second += offset;
123 }
124 
std::pair< btVector3, btVector3 > m_pair
Definition: tgPair.h:119
Definition of class tgPair.
void setFrom(btVector3 from)
Definition: tgPair.cpp:67
Contains the definition of class tgUtil and overloaded operator<<() free functions.
static void addRotation(btVector3 &v, const btVector3 &fixedPoint, const btVector3 &axis, double angle)
Definition: tgUtil.h:230
btVector3 & getTo()
Definition: tgPair.cpp:75
btVector3 & getFrom()
Definition: tgPair.cpp:51
void setTo(btVector3 to)
Definition: tgPair.cpp:91