Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Bolsee <benoit.bolsee@online.be>2009-09-25 01:22:24 +0400
committerBenoit Bolsee <benoit.bolsee@online.be>2009-09-25 01:22:24 +0400
commit1483fafd1372a3d3e025d08634e798adb7da512f (patch)
tree9191765749e29866339f4c31d892603f5f8b334d /intern/itasc/FixedObject.cpp
parentc995c605f640d8d688e6e58e0fe247ca83f91696 (diff)
parent222fe6b1a5d49f67177cbb762f55a0e482145f5d (diff)
Merge of itasc branch. Project files, scons and cmake should be working. Makefile updated but not tested. Comes with Eigen2 2.0.6 C++ matrix library.
Diffstat (limited to 'intern/itasc/FixedObject.cpp')
-rw-r--r--intern/itasc/FixedObject.cpp70
1 files changed, 70 insertions, 0 deletions
diff --git a/intern/itasc/FixedObject.cpp b/intern/itasc/FixedObject.cpp
new file mode 100644
index 00000000000..1360c3c152b
--- /dev/null
+++ b/intern/itasc/FixedObject.cpp
@@ -0,0 +1,70 @@
+/* $Id: FixedObject.cpp 19905 2009-04-23 13:29:54Z ben2610 $
+ * FixedObject.cpp
+ *
+ * Created on: Feb 10, 2009
+ * Author: benoitbolsee
+ */
+
+#include "FixedObject.hpp"
+
+namespace iTaSC{
+
+
+FixedObject::FixedObject():UncontrolledObject(),
+ m_finalized(false), m_nframe(0)
+{
+}
+
+FixedObject::~FixedObject()
+{
+ m_frameArray.clear();
+}
+
+int FixedObject::addFrame(const std::string& name, const Frame& frame)
+{
+ if (m_finalized)
+ return -1;
+ FrameList::iterator it;
+ unsigned int i;
+ for (i=0, it=m_frameArray.begin(); i<m_nframe; i++, it++) {
+ if (it->first == name) {
+ // this frame will replace the old frame
+ it->second = frame;
+ return i;
+ }
+ }
+ m_frameArray.push_back(FrameList::value_type(name,frame));
+ return m_nframe++;
+}
+
+int FixedObject::addEndEffector(const std::string& name)
+{
+ // verify that this frame name exist
+ FrameList::iterator it;
+ unsigned int i;
+ for (i=0, it=m_frameArray.begin(); i<m_nframe; i++, it++) {
+ if (it->first == name) {
+ return i;
+ }
+ }
+ return -1;
+}
+
+void FixedObject::finalize()
+{
+ if (m_finalized)
+ return;
+ initialize(0, m_nframe);
+ m_finalized = true;
+}
+
+const Frame& FixedObject::getPose(const unsigned int frameIndex)
+{
+ if (frameIndex < m_nframe) {
+ return m_frameArray[frameIndex].second;
+ } else {
+ return F_identity;
+ }
+}
+
+}