ccstruct/normalis.h

Go to the documentation of this file.
00001 
00020 #ifndef           NORMALIS_H
00021 #define           NORMALIS_H
00022 
00023 #include          <stdio.h>
00024 
00025 class ROW;                       //forward decl
00026 
00033 class DENORM_SEG
00034 {
00035   public:
00036     DENORM_SEG() { 
00037     }                            //empty
00038 
00040     INT32 xstart;
00042     INT32 ycoord;
00044     float scale_factor;
00045 };
00046 
00053 class DENORM
00054 {
00055   public:
00056     DENORM() {  //constructor
00057       source_row = NULL;
00058       x_centre = 0.0f;
00059       scale_factor = 1.0f;
00060       segments = 0;
00061       segs = NULL;
00062       base_is_row = TRUE;
00063       m = c = 0;
00064     }
00065     DENORM(          //constructor
00066            float x,  //from same pieces
00067            float scaling,
00068            ROW *src) {
00069       x_centre = x;              //just copy
00070       scale_factor = scaling;
00071       source_row = src;
00072       segments = 0;
00073       segs = NULL;
00074       base_is_row = TRUE;
00075       m = c = 0;
00076     }
00077     DENORM(                      //constructor
00078            float x,              //from same pieces
00079            float scaling,
00080            double line_m,        //default line //no of segments
00081            double line_c,
00082            INT16 seg_count,
00083            DENORM_SEG *seg_pts,  //actual segments
00084            BOOL8 using_row,      //as baseline
00085            ROW *src);
00086     DENORM(const DENORM &); 
00087     DENORM & operator= (const DENORM &);
00088     ~DENORM () {
00089       if (segments > 0)
00090         delete[]segs;
00091     }
00092 
00093     float origin() const {  //get x centre
00094       return x_centre;
00095     }
00096     float scale() const {  //get scale
00097       return scale_factor;
00098     }
00099     ROW *row() const {  //get row
00100       return source_row;
00101     }
00102     float x(  //convert an xcoord
00103             float src_x) const;
00104     float y(                    //convert a ycoord
00105             float src_y,        //coord to convert
00106             float src_centre) const;  //normed x centre
00107     float scale_at_x(  // Return scaling at this coord.
00108             float src_x) const;
00109     float yshift_at_x(  // Return yshift at this coord.
00110             float src_x) const;
00111 
00112   private:
00113     const DENORM_SEG *binary_search_segment(float src_x) const;
00114 
00116     BOOL8 base_is_row;
00118     INT16 segments;
00120     double c;
00122     double m;
00124     float x_centre;
00126     float scale_factor;
00128     ROW *source_row;
00130     DENORM_SEG *segs;
00131 };
00132 #endif

Generated on Wed Feb 28 19:49:08 2007 for Tesseract by  doxygen 1.5.1