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.1.2.1 2006/02/02 09:00:00 martius 00024 * axis type 00025 * 00026 * 00027 ***************************************************************************/ 00028 #ifndef __AXIS_H 00029 #define __AXIS_H 00030 00031 #include <osg/Vec3> 00032 #include <osg/Vec4> 00033 #include <ode/ode.h> 00034 #include <iostream> 00035 00036 namespace lpzrobots{ 00037 00038 // class for axis. This is a internally a 4 dimensional vector (homogenenous) with last component = 0 00039 // meaning it is a direction not a point 00040 class Axis : public osg::Vec4 { 00041 public: 00042 Axis () : osg::Vec4() {} 00043 Axis (float x, float y, float z) : osg::Vec4(x, y, z, 0) {} 00044 Axis (const osg::Vec4& v) : osg::Vec4(v) { w() =0; } 00045 Axis (const osg::Vec3& v) : osg::Vec4(v,0) {} 00046 Axis (const dReal v[3]) : osg::Vec4(v[0], v[1], v[2], 0) {} 00047 00048 osg::Vec3 vec3() const { return osg::Vec3( x(), y(), z()); } 00049 00050 void print(){ 00051 std::cout << '(' << x() << ',' << y() << ',' << z() << ')' << std::endl; 00052 } 00053 }; 00054 00055 } 00056 00057 #endif