Robot Simulator of the Robotics Group for Self-Organization of Control  0.8.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
pos.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2011 LpzRobots development team *
3  * Georg Martius <georg dot martius at web dot de> *
4  * Frank Guettler <guettler at informatik dot uni-leipzig dot de *
5  * Frank Hesse <frank at nld dot ds dot mpg dot de> *
6  * Ralf Der <ralfder at mis dot mpg dot de> *
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this program; if not, write to the *
20  * Free Software Foundation, Inc., *
21  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
22  * *
23  ***************************************************************************/
24 #ifndef __POS_H
25 #define __POS_H
26 
27 #include <iostream>
28 
29 #include <osg/Vec3>
30 #include <osg/Vec4>
31 #include <ode-dbl/ode.h>
32 #include <selforg/position.h>
33 
34 namespace lpzrobots{
35 
36  class Pos : public osg::Vec3 {
37  public:
38  Pos () : osg::Vec3 () {};
39  Pos (float x, float y, float z) : osg::Vec3(x, y, z) {}
40  Pos (const osg::Vec3& v) : osg::Vec3(v) {}
41  Pos (const osg::Vec4& v) : osg::Vec3(v.x(),v.y(),v.z()) {}
42  Pos (const Position& p) : osg::Vec3(p.x, p.y, p.z) {}
43  Pos (const dReal v[3]) : osg::Vec3(v[0], v[1], v[2]) {}
44 
45  /// scaling
46  Pos operator*(double f) const { return Pos(x()*f,y()*f,z()*f);}
47  /// scalar product
48  double operator*(const Pos& p) const { return p.x()*x() + p.y()*y() + p.z()*z();}
49  /// componentwise product
50  Pos operator&(const Pos& p) const { return Pos(p.x()*x(), p.y()*y(), p.z()*z());}
51 
53  return Position(x(), y(), z());
54  }
55 
56  void print() const {
57  std::cout << '(' << x() << ',' << y() << ',' << z() << ')' << std::endl;
58  }
59  };
60 
61 }
62 
63 #endif
Pos operator*(double f) const
scaling
Definition: pos.h:46
Position toPosition()
Definition: pos.h:52
Pos(const Position &p)
Definition: pos.h:42
Definition: pos.h:36
Definition: position.h:30
Pos(const osg::Vec3 &v)
Definition: pos.h:40
Vec3f Vec3
Definition: osgforwarddecl.h:42
double operator*(const Pos &p) const
scalar product
Definition: pos.h:48
Pos(float x, float y, float z)
Definition: pos.h:39
void print() const
Definition: pos.h:56
Pos(const osg::Vec4 &v)
Definition: pos.h:41
Pos()
Definition: pos.h:38
Pos operator&(const Pos &p) const
componentwise product
Definition: pos.h:50
Vec4f Vec4
Definition: osgforwarddecl.h:44
Pos(const dReal v[3])
Definition: pos.h:43