Blender V4.3
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
9#include "FixedObject.hpp"
10
11namespace iTaSC{
12
13
15 m_finalized(false), m_nframe(0)
16{
17}
18
20{
21 m_frameArray.clear();
22}
23
24int 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
41int 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
55{
56 if (m_finalized)
57 return true;
58 initialize(0, m_nframe);
59 m_finalized = true;
60 return true;
61}
62
63const 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}
void initialize()
represents a frame transformation in 3D space (rotation + translation)
Definition frames.hpp:526
int addFrame(const std::string &name, const Frame &frame)
virtual bool finalize()
virtual const Frame & getPose(const unsigned int frameIndex)
virtual int addEndEffector(const std::string &name)
const Frame F_identity