MrepConnection.hpp

00001 // This file is part of the imaging2 class library.
00002 //
00003 // University of Innsbruck, Infmath Imaging, 2009.
00004 // http://infmath.uibk.ac.at
00005 //
00006 // All rights reserved.
00007 
00008 
00009 #ifndef MREPCONNECTION_H
00010 #define MREPCONNECTION_H
00011 
00012 
00013 
00014 namespace imaging
00015 {
00017   template<size_t N>
00018   class MrepConnection
00019     { };
00020 
00022   template<>
00023   class MrepConnection<2>
00024   {
00025     float_t _rotation;
00026     float_t _radius;
00027 
00028   public:
00029     static const size_t DIMENSION = 2;
00030 
00031     MrepConnection<2>() : _rotation(0.0), _radius(1.0) {}
00032 
00033     MrepConnection<2>(float_t rotation, float_t radius) : _rotation(rotation), _radius(radius) {}
00034 
00035     void assign(float_t rotation, float_t radius) { _rotation = rotation, _radius = radius; }
00036 
00037     float_t radius() const { return _radius; }
00038     float_t rotation() const { return _rotation; }
00039     
00040     void set_radius(float_t radius) { _radius = radius; }
00041     void set_rotation(float_t rotation) { _rotation = rotation; }
00042 
00043     void exponential(ublas::vector<float_t>::const_iterator & vector, MrepConnection<2> & shape) const
00044     {
00045       shape._rotation = _rotation + *vector; ++vector;
00046       exponential_without_rotation(vector, shape);
00047     }
00048 
00049     void logarithm(const MrepConnection<2> & shape, ublas::vector<float_t>::iterator & vector) const
00050     {
00051       *vector = shape._rotation - _rotation; ++vector;
00052       logarithm_without_rotation(shape, vector);
00053     }
00054 
00055     void exponential_without_rotation(ublas::vector<float_t>::const_iterator & vector, MrepConnection<2> & shape) const
00056     {
00057       shape._radius = _radius * exp(*vector); ++vector;
00058       // shape._radius = _radius + *vector; ++vector;
00059     }
00060 
00061     void logarithm_without_rotation(const MrepConnection<2> & shape, ublas::vector<float_t>::iterator & vector) const
00062     {
00063       *vector = log( shape._radius /_radius ); ++vector;
00064       // *vector = shape._radius - _radius; ++vector;
00065     }
00066 
00067     size_t dimension() const { return 2; }
00068     size_t dimension_without_rotation() const { return 1; }
00069   };
00070 
00071   //   template <class S>
00072   //   std::ostream& operator<<(std::ostream & os, const MRepConnection<S> & connection)
00073   //   {
00074   //     os << "MRepConnection";
00075   //     os << "\n";
00076   //
00077   //     os << "  rotation: " <<  connection.get_rotation()<< "\n";
00078   //     os << "  distance: " << connection.get_distance() << "\n";
00079   //     os << std::endl;
00080   //
00081   //     return os;
00082   //   }
00083 }
00084 
00085 
00086 
00087 #endif

Generated on Tue Feb 10 10:01:30 2009 for imaging2 by  doxygen 1.5.5