Blender
V5.0
intern
itasc
FixedObject.cpp
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2009 Benoit Bolsee
2
*
3
* SPDX-License-Identifier: LGPL-2.1-or-later */
4
8
9
#include "
FixedObject.hpp
"
10
11
namespace
iTaSC
{
12
13
14
FixedObject::FixedObject
():
UncontrolledObject
(),
15
m_finalized(
false
), m_nframe(0)
16
{
17
}
18
19
FixedObject::~FixedObject
()
20
{
21
m_frameArray.clear();
22
}
23
24
int
FixedObject::addFrame
(
const
std::string&
name
,
const
Frame
& frame)
25
{
26
if
(m_finalized)
27
return
-1;
28
FrameList::iterator it;
29
unsigned
int
i
;
30
for
(
i
=0, it=m_frameArray.begin();
i
<m_nframe;
i
++, it++) {
31
if
(it->first ==
name
) {
32
// this frame will replace the old frame
33
it->second = frame;
34
return
i
;
35
}
36
}
37
m_frameArray.push_back(FrameList::value_type(
name
,frame));
38
return
m_nframe++;
39
}
40
41
int
FixedObject::addEndEffector
(
const
std::string&
name
)
42
{
43
// verify that this frame name exist
44
FrameList::iterator it;
45
unsigned
int
i
;
46
for
(
i
=0, it=m_frameArray.begin();
i
<m_nframe;
i
++, it++) {
47
if
(it->first ==
name
) {
48
return
i
;
49
}
50
}
51
return
-1;
52
}
53
54
bool
FixedObject::finalize
()
55
{
56
if
(m_finalized)
57
return
true
;
58
initialize
(0, m_nframe);
59
m_finalized =
true
;
60
return
true
;
61
}
62
63
const
Frame
&
FixedObject::getPose
(
const
unsigned
int
frameIndex)
64
{
65
if
(frameIndex < m_nframe) {
66
return
m_frameArray[frameIndex].second;
67
}
else
{
68
return
F_identity
;
69
}
70
}
71
72
}
FixedObject.hpp
false
return false
Definition
bmesh_operator_api_inline.hh:198
initialize
void initialize()
KDL::Frame
represents a frame transformation in 3D space (rotation + translation)
Definition
frames.hpp:526
iTaSC::FixedObject::FixedObject
FixedObject()
Definition
FixedObject.cpp:14
iTaSC::FixedObject::~FixedObject
virtual ~FixedObject()
Definition
FixedObject.cpp:19
iTaSC::FixedObject::addFrame
int addFrame(const std::string &name, const Frame &frame)
Definition
FixedObject.cpp:24
iTaSC::FixedObject::finalize
virtual bool finalize()
Definition
FixedObject.cpp:54
iTaSC::FixedObject::getPose
virtual const Frame & getPose(const unsigned int frameIndex)
Definition
FixedObject.cpp:63
iTaSC::FixedObject::addEndEffector
virtual int addEndEffector(const std::string &name)
Definition
FixedObject.cpp:41
iTaSC::UncontrolledObject::UncontrolledObject
UncontrolledObject()
Definition
UncontrolledObject.cpp:13
iTaSC
Definition
Armature.cpp:14
iTaSC::F_identity
const Frame F_identity
name
const char * name
Definition
python_compat.hh:32
i
i
Definition
text_draw.cc:230
Generated on
for Blender by
doxygen
1.16.1