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