Fawkes API  Fawkes Development Version
hom_coord.h
00001 
00002 /***************************************************************************
00003  *  hom_coord.h - Homogeneous coordinates
00004  *
00005  *  Created: Thu Sep 27 16:07:00 2007
00006  *  Copyright  2007-2008  Daniel Beck
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version. A runtime exception applies to
00014  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00015  *
00016  *  This program is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *  GNU Library General Public License for more details.
00020  *
00021  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00022  */
00023 
00024 #ifndef __GEOMETRY_HOM_COORD_H_
00025 #define __GEOMETRY_HOM_COORD_H_
00026 
00027 #include <geometry/printable.h>
00028 
00029 namespace fawkes {
00030 
00031 class Vector;
00032 class HomTransform;
00033 
00034 class HomCoord : public Printable
00035 {
00036  public:
00037   HomCoord(const HomCoord& c);
00038 
00039   virtual ~HomCoord();
00040 
00041   virtual float  x() const;
00042   virtual float& x();
00043   virtual HomCoord& x(float x);
00044 
00045   virtual float  y() const;
00046   virtual float& y();
00047   virtual HomCoord& y(float y);
00048 
00049   virtual float  z() const;
00050   virtual float& z();
00051   virtual HomCoord& z(float z);
00052 
00053   virtual float  w() const;
00054   virtual float& w();
00055   virtual HomCoord& w(float w);
00056 
00057   virtual HomCoord& rotate_x(float rad);
00058   virtual HomCoord& rotate_y(float rad);
00059   virtual HomCoord& rotate_z(float rad);
00060 
00061   HomCoord& transform(const HomTransform& t);
00062 
00063   virtual HomCoord  operator-(const HomCoord& h) const;
00064   virtual HomCoord& operator-=(const HomCoord& h);
00065 
00066   virtual HomCoord  operator+(const HomCoord& h) const;
00067   virtual HomCoord& operator+=(const HomCoord& h);
00068                 
00069   virtual float operator*(const HomCoord& h) const;
00070 
00071   virtual HomCoord  operator*(const float s) const;
00072   virtual HomCoord& operator*=(const float s);
00073                 
00074   virtual HomCoord& operator=(const HomCoord& h);
00075 
00076   virtual bool operator==(const HomCoord& h) const;
00077   virtual bool operator!=(const HomCoord& h) const;
00078 
00079  protected:
00080   HomCoord(float x = 0.0, float y = 0.0, float z = 0.0, float w = 0.0);
00081   HomCoord(const Vector& v);
00082 
00083   virtual std::ostream& print(std::ostream& stream) const;
00084 
00085   Vector* m_vector;
00086 };
00087 
00088 } // end namespace fawkes
00089 
00090 #endif /* __GEOMETRY_HOM_COORD_H_ */