00001
00002
00003
00004
00005
00006
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
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
00065 }
00066
00067 size_t dimension() const { return 2; }
00068 size_t dimension_without_rotation() const { return 1; }
00069 };
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083 }
00084
00085
00086
00087 #endif