Geometry.h

00001 // -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
00002 /* 
00003  * Copyright (C) 2008 Micha Hersch, EPFL
00004  * RobotCub Consortium, European Commission FP6 Project IST-004370
00005  * email:   micha.hersch@robotcub.org
00006  * website: www.robotcub.org
00007  * Permission is granted to copy, distribute, and/or modify this program
00008  * under the terms of the GNU General Public License, version 2 or any
00009  * later version published by the Free Software Foundation.
00010  *
00011  * A copy of the license can be found at
00012  * http://www.robotcub.org/icub/license/gpl.txt
00013  *
00014  * This program is distributed in the hope that it will be useful, but
00015  * WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
00017  * Public License for more details
00018  */
00019 #ifndef __GEOMETRY_H__
00020 #define __GEOMETRY_H__
00021 
00022 #include <vector>
00023 using namespace std;
00024 
00025 #include "mathlib.h"
00026 
00027 //#define KINEMATIC_TREE_VIEW
00028 
00029 /*typedef struct{
00030     vec3_t  v;
00031 } CVector3_ext_t;
00032   */
00033 union CVector3_ext_t{
00034   vec3_t  v;
00035   vec3_t m_Vector;
00036 };
00037 
00038 typedef vector<CVector3_ext_t> CVector3_List_t;
00039 
00040 
00041 class CRef;
00042 typedef CRef CRef_t, *pCRef_t;
00043 
00044 class CRef
00045 {
00046 public:
00047   // Up referential
00048         pCRef_t             m_absRef;
00049 
00050   // Self origin
00051   CVector3_t    m_origin;
00052   // Self orientation
00053   CMatrix4_t    m_orient;
00054 
00055   // Self Referential
00056   CMatrix4_t    m_result;
00057 
00058   // Absolute referential
00059   CMatrix4_t    m_absResult;
00060 
00061   // Absolute referential without orientation
00062   CMatrix4_t    m_absResultPos;
00063 public:
00064   CRef();
00065   virtual ~CRef();
00066 
00067   virtual void  Update();
00068   
00069   void          Identity();
00070   CMatrix4_t*   GetRef();
00071   CMatrix4_t*   GetAbsRef();
00072   CMatrix4_t*   GetAbsRefPos();
00073 
00074   CVector3_t*   GetOrigin();
00075   void          SetOrigin(float x, float y, float z);
00076   void          SetOrigin(CVector3_t origin);
00077 
00078   CMatrix4_t*   GetOrient();
00079   void          SetOrient(CMatrix4_t orient);
00080 
00081   void Copy(CRef_t *src);
00082 };
00083 
00084 /*
00085 
00086 class JointDOF
00087 {
00088 public:
00089   float       m_Value;
00090   float       m_dValue;
00091   float       m_Cost;
00092   pCRef_t     m_Ref;
00093   CVector3_t  m_Axis;
00094 
00095 public:
00096   JointDOF(){
00097     m_Value   = 0.0f;
00098     m_dValue  = 0.0f;
00099     m_Cost    = 0.0f;
00100     m_Ref     = NULL;
00101 
00102     v_set(0,0,0,m_Axis);
00103   }
00104 
00105   void              Apply(){
00106     CMatrix_t RotMat,tmp;
00107     m_rotation_v(m_dValue,m_Axis,RotMat);
00108     m_copy(m_Ref->m_orient,tmp);  
00109     m_multiply(tmp,RotMat,m_Ref.m_orient);
00110   }
00111   virtual float     UpdateValue(){
00112     m_Value = 0.0f;
00113     return m_Value;
00114   }
00115   virtual float     UpdateCost(){
00116     m_Cost  = 0.0f;
00117     return m_Cost;
00118   }
00119 
00120   void              AddValue(float dStep){
00121     m_dValue = dStep;
00122     Apply();
00123   }
00124 
00125 };
00126 */
00127 #endif
 All Data Structures Functions Variables

Generated on Wed Sep 22 16:51:25 2010 for Body_Schema_Learning by  doxygen 1.6.1