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