-
Notifications
You must be signed in to change notification settings - Fork 0
/
hand.cc
143 lines (120 loc) · 3.33 KB
/
hand.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
// Copyright (C) 2012 by Antonio El Khoury.
//
// This file is part of the ard-rbdl.
//
// ard-rbdl is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// ard-rbdl is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with ard-rbdl. If not, see
// <http://www.gnu.org/licenses/>.
/// \file src/model/hand.cc
/// \brief Implementation of Hand.
#include <stdexcept>
#include <ard/rbdl/tools/util.hh>
#include <ard/rbdl/model/hand.hh>
namespace ard
{
namespace rbdl
{
Hand::Hand () :
boost::enable_shared_from_this<Hand> (),
wristJoint_ (),
center_ (),
thumbAxis_ (),
foreFingerAxis_ (),
palmNormal_ ()
{
}
Hand::Hand (const to_pointer<CjrlJoint>::type& wrist) :
wristJoint_ (),
center_ (),
thumbAxis_ (),
foreFingerAxis_ (),
palmNormal_ ()
{
getPtrFromBase (wristJoint_, wrist);
}
Hand::Hand (const jointShPtr_t& wrist) :
boost::enable_shared_from_this<Hand> (),
wristJoint_ (wrist),
center_ (),
thumbAxis_ (),
foreFingerAxis_ (),
palmNormal_ ()
{
}
Hand::Hand (const Hand& hand) :
boost::enable_shared_from_this<Hand> ()
{
hand.associatedWrist (wristJoint_);
hand.getCenter (center_);
hand.getThumbAxis (thumbAxis_);
hand.getForeFingerAxis (foreFingerAxis_);
hand.getPalmNormal (palmNormal_);
}
Hand Hand::operator= (const Hand& hand)
{
hand.associatedWrist (wristJoint_);
hand.getCenter (center_);
hand.getThumbAxis (thumbAxis_);
hand.getForeFingerAxis (foreFingerAxis_);
hand.getPalmNormal (palmNormal_);
return *this;
}
Hand::~Hand ()
{
}
to_pointer<CjrlJoint>::type Hand::associatedWrist () const
{
return getSharedPointer (wristJoint_);
}
void Hand::setAssociatedWrist (to_pointer<CjrlJoint>::type joint)
{
return getPtrFromBase (wristJoint_, joint);
}
void Hand::getCenter (vector3d& center) const
{
center = center_;
}
void Hand::setCenter (const vector3d& center)
{
center_ = center;
}
void Hand::getThumbAxis (vector3d& thumbAxis) const
{
thumbAxis = thumbAxis_;
}
void Hand::setThumbAxis (const vector3d& thumbAxis)
{
thumbAxis_ = thumbAxis;
}
void Hand::getForeFingerAxis (vector3d& foreFingerAxis) const
{
foreFingerAxis = foreFingerAxis_;
}
void Hand::setForeFingerAxis (const vector3d& foreFingerAxis)
{
foreFingerAxis_ = foreFingerAxis;
}
void Hand::getPalmNormal (vector3d& palmNormal) const
{
palmNormal = palmNormal_;
}
void Hand::setPalmNormal (const vector3d& palmNormal)
{
palmNormal_ = palmNormal;
}
void Hand::associatedWrist (jointWkPtr_t& wrist) const
{
wrist = wristJoint_;
}
} // end of namespace rbdl.
} // end of namespace ard.