Circle.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 SHAPE_CIRCLE_H
00010 #define SHAPE_CIRCLE_H
00011 
00012 #include <shape/ShapeInterface.hpp>
00013 #include <shape/DiscretizableShapeInterface.hpp>
00014 
00015 namespace imaging
00016 {
00022   class Circle : public ShapeInterface, public DiscretizableShapeInterface<2>
00023   {
00024     ublas::fixed_vector<float_t, 2> _center;
00025     float_t _radius;
00026 
00027     class Discretizer;
00028     
00029   public:
00030     const static size_t SHAPE_DIMENSION = 2;    
00031 
00032     Circle() : _center(0.0, 0.0), _radius(1.0) {}
00033     
00035     Circle(const ublas::fixed_vector<float_t, 2> & center, float_t radius) : _center(center), _radius(radius) {}
00036     
00038     Circle(const Circle & source) : _center(source._center), _radius(source._radius) {}
00039 
00041     const Circle & operator=(const Circle & source);
00042     
00043     virtual std::auto_ptr< BoundaryDiscretizer<2> > boundary_discretizer(size_t n_points) const;
00044 
00046     void set_center(const ublas::fixed_vector<float_t, 2> & center);
00047     
00049     void set_radius(float_t radius);
00050     
00052     const ublas::fixed_vector<float_t, 2> & center() const { return _center; }
00053     
00055     float_t radius() const { return _radius; }
00056 
00057     void exponential(const ublas::vector<float_t> & vector, ShapeInterface & shape) const;
00058 
00059     void logarithm(const ShapeInterface & shape, ublas::vector<float_t> & vector) const;
00060     
00061     size_t dimension() const { return 3; }
00062   };
00063   
00065   class Circle::Discretizer : public BoundaryDiscretizer<2>
00066   {
00067     float_t _step_size;
00068     const Circle & _circle;
00069 
00070   public:
00071     Discretizer(const Circle & circle, size_t n_points);
00072 
00073     void evaluate (size_t i, ublas::fixed_vector<float_t, SHAPE_DIMENSION> & point, ublas::fixed_vector<float_t, SHAPE_DIMENSION> & normal, float_t & curvature) const;
00074   };
00076 }
00077 
00078 
00079 #endif

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