Translation.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 __TRANSLATION_H__
00020 #define __TRANSLATION_H__
00021 #include "mathlib.h"
00022 
00023 
00027 class Translation {
00028 protected:
00029   CVector3_t trans;     
00030   float eps_tr;         
00031   float base_eps_tr;    
00033 public:
00034   Translation();
00035   virtual ~Translation(){};
00036   void SetRate(float e){base_eps_tr=eps_tr=e;};
00037   void ScaleRate(float f){eps_tr=f>0?f*base_eps_tr:eps_tr;};
00038   void SetTranslation(const CVector3_t t){v_copy(t,trans);};
00039   void GetTranslation(CVector3_t tr)const {v_copy(trans,tr)};
00040   void GetInverseTranslation(CVector3_t tr)const {v_scale(trans,-1,tr)};
00041   float const * GetTranslation()const{return trans;};
00042 
00043   void Transform(const CVector3_t in, CVector3_t out){v_add(in,trans,out);};
00044   void InverseTransform(const CVector3_t in, CVector3_t out){v_sub(in,trans,out);};
00045   
00051   void Update(CVector3_t v, CVector3_t v_tr);
00052   void Add(CVector3_t dtrans);
00053   void Invert(){v_scale(trans,-1,trans);}
00054   void Copy(const Translation& t){t.GetTranslation(trans);};
00055   void Scale(float f){v_scale(trans,f,trans);}
00056 
00057 };
00058 
00059 ostream&  operator<<(ostream& out, const Translation& t);
00060 istream& operator>>(istream& in,Translation& t);
00061 
00062 #endif
 All Data Structures Functions Variables

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