pos.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __POS_H
00025 #define __POS_H
00026
00027 #include <iostream>
00028
00029 #include <osg/Vec3>
00030 #include <osg/Vec4>
00031 #include <ode-dbl/ode.h>
00032 #include <selforg/position.h>
00033
00034 namespace lpzrobots{
00035
00036 class Pos : public osg::Vec3 {
00037 public:
00038 Pos () : osg::Vec3 () {};
00039 Pos (float x, float y, float z) : osg::Vec3(x, y, z) {}
00040 Pos (const osg::Vec3& v) : osg::Vec3(v) {}
00041 Pos (const osg::Vec4& v) : osg::Vec3(v.x(),v.y(),v.z()) {}
00042 Pos (const Position& p) : osg::Vec3(p.x, p.y, p.z) {}
00043 Pos (const dReal v[3]) : osg::Vec3(v[0], v[1], v[2]) {}
00044
00045
00046 Pos operator*(double f) const { return Pos(x()*f,y()*f,z()*f);}
00047
00048 double operator*(const Pos& p) const { return p.x()*x() + p.y()*y() + p.z()*z();}
00049
00050 Pos operator&(const Pos& p) const { return Pos(p.x()*x(), p.y()*y(), p.z()*z());}
00051
00052 Position toPosition(){
00053 return Position(x(), y(), z());
00054 }
00055
00056 void print() const {
00057 std::cout << '(' << x() << ',' << y() << ',' << z() << ')' << std::endl;
00058 }
00059 };
00060
00061 }
00062
00063 #endif