axis.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005 by Robot Group Leipzig                             *
00003  *    martius@informatik.uni-leipzig.de                                    *
00004  *    fhesse@informatik.uni-leipzig.de                                     *
00005  *    der@informatik.uni-leipzig.de                                        *
00006  *                                                                         *
00007  *   This program is free software; you can redistribute it and/or modify  *
00008  *   it under the terms of the GNU General Public License as published by  *
00009  *   the Free Software Foundation; either version 2 of the License, or     *
00010  *   (at your option) any later version.                                   *
00011  *                                                                         *
00012  *   This program is distributed in the hope that it will be useful,       *
00013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00015  *   GNU General Public License for more details.                          *
00016  *                                                                         *
00017  *   You should have received a copy of the GNU General Public License     *
00018  *   along with this program; if not, write to the                         *
00019  *   Free Software Foundation, Inc.,                                       *
00020  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00021  *                                                                         *
00022  *   $Log: axis.h,v $
00023  *   Revision 1.2  2006/07/14 12:23:55  martius
00024  *   selforg becomes HEAD
00025  *
00026  *   Revision 1.1.2.1  2006/02/02 09:00:00  martius
00027  *   axis type
00028  *
00029  *
00030  ***************************************************************************/
00031 #ifndef __AXIS_H
00032 #define __AXIS_H
00033 
00034 #include <osg/Vec3>
00035 #include <osg/Vec4>
00036 #include <ode/ode.h>
00037 #include <iostream>
00038 
00039 namespace lpzrobots{
00040 
00041   // class for axis. This is a internally a 4 dimensional vector (homogenenous) with last component = 0 
00042   //   meaning it is a direction not a point
00043   class Axis : public osg::Vec4 {
00044   public:
00045     Axis () : osg::Vec4() {}
00046     Axis (float x, float y, float z) : osg::Vec4(x, y, z, 0) {}
00047     Axis (const osg::Vec4& v) : osg::Vec4(v) { w() =0; }
00048     Axis (const osg::Vec3& v) : osg::Vec4(v,0) {}
00049     Axis (const dReal v[3]) : osg::Vec4(v[0], v[1], v[2], 0) {}
00050 
00051     osg::Vec3 vec3() const { return osg::Vec3( x(), y(), z()); }
00052 
00053     void print(){
00054       std::cout << '(' << x() << ',' << y() << ',' << z() << ')' << std::endl;
00055     }
00056   };
00057   
00058 }
00059 
00060 #endif

Generated on Fri Oct 30 16:29:01 2009 for Robot Simulator of the Robotics Group for Self-Organization of Control by  doxygen 1.4.7