pol_model.h

Go to the documentation of this file.
00001 #ifndef POL_MODEL_H
00002 #define POL_MODEL_H
00003 
00004 #include <boost/numeric/ublas/vector.hpp>
00005 #include <boost/shared_ptr.hpp>
00006 #include <list>
00007 #include <cmath>
00008 #include "line.h"
00009 #include "pol.h"
00010 
00011 namespace mimas {
00022 class pol_line_info
00023 {
00024     public:
00025   typedef boost::numeric::ublas::vector< double > Vector;
00026   line_ptr line;  
00027   double    len;  
00028      Vector unitv;  
00029      Vector midpoint;
00030   
00031        pol_line_info(): unitv(2),midpoint(2)
00032     {
00033     }
00034 };
00035 
00036 typedef boost::shared_ptr< pol_line_info > pol_line_info_ptr;
00037 typedef std::list< pol_line_info_ptr > pol_line_info_ptr_list;
00038 
00039 
00040 class   pol_locator;
00041 
00042 
00049 class pol_model : public pol
00050 {
00051  public:
00052   typedef boost::numeric::ublas::vector< double > Vector;
00053 private:
00054     //internal types:
00055     class linepair
00056     {
00057   public:
00058    typedef boost::numeric::ublas::vector< double > Vector;
00059   pol_line_info_ptr linfo1, linfo2;
00060   double      dist1,dist2;
00061   Vector intersection;
00062         //point of intersection of the two lines
00063 
00064   linepair(): intersection(2) {
00065      //linfo1=linfo2=0;
00066    }
00067   // ~linepair(){ delete linfo1; delete linfo2; }
00068     };
00069 
00070     typedef boost::shared_ptr< linepair > linepair_ptr;
00071     typedef std::list< linepair_ptr > linepair_ptr_list;
00072   typedef boost::shared_array< linepair_ptr_list > linepair_ptr_list_array;
00073 
00074     //internal vars
00075     linepair_ptr_list_array hash_bin; 
00076     line_ptr_list model_lines;  
00077 
00078     double    loc_thres;  
00079     double    radius;   
00080     int     num_lps;  
00081     bool    scale_inv;  
00082 
00083     //private funcs
00089     public:
00090     void    createFromLines( line_ptr_list &slaps );
00091 
00092 public:
00093   pol_model(): 
00094     hash_bin( new linepair_ptr_list[num_abins] )
00095     {
00096   loc_thres=0;
00097   num_lps=0;
00098   radius=0;
00099   scale_inv=false;
00100     }
00101 //     ~pol_model()
00102 //     {
00103 //       linepair_ptr_list::iterator  lpi;
00104     
00105 //  for(int i=0;i<num_abins;i++)
00106 //  {
00107 //      for(lpi=hash_bin[i].begin();lpi!=hash_bin[i].end();++lpi)
00108 //      {
00109 //    delete *lpi;
00110 //      }
00111 //      hash_bin[i].clear();
00112 //  }
00113 //  delete[] hash_bin;
00114   
00115 //     }
00116 
00122     void  createFromImageFile( const char* fn );
00123     
00129     void  match( pol_locator& locate, const pol_line_info &l1_orig, 
00130                       const pol_line_info &l2_orig );
00136     Vector getIntersectionAngle( const pol_line_info &l1,
00137               const pol_line_info &l2,
00138               angle *retval);
00139 
00141     double  getThreshold() { return loc_thres; }
00142     double  getRadius() { return radius; }
00143     void  setRadius(double r) { radius=r; }
00144     bool  scaleInvariant();
00145     void  setScaleInvariance( bool r ) {scale_inv=r; }
00146     line_ptr_list getModelLines();
00147 };
00148 
00149 }
00150 #endif

[GNU/Linux] [Qt] [Mesa] [STL] [Lapack] [Boost] [Magick++] [Xalan-C and Xerces-C] [doxygen] [graphviz] [FFTW] [popt] [xine] [Gnuplot] [gnu-arch] [gcc] [gstreamer] [autoconf/automake/make] [freshmeat.net] [opensource.org] [sourceforge.net] [MMVL]
mimas 2.1 - Copyright Mon Oct 30 11:31:17 2006, Bala Amavasai, Stuart Meikle, Arul Selvan, Fabio Caparrelli, Jan Wedekind, Manuel Boissenin, ...