00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef NORMALIS_H
00021 #define NORMALIS_H
00022
00023 #include <stdio.h>
00024
00025 class ROW;
00026 class BLOCK;
00027
00028 class DENORM_SEG
00029 {
00030 public:
00031 DENORM_SEG() {}
00032
00033 inT32 xstart;
00034 inT32 ycoord;
00035 float scale_factor;
00036 };
00037
00038 class DENORM
00039 {
00040 public:
00041 DENORM() {
00042 source_row = NULL;
00043 x_centre = 0.0f;
00044 scale_factor = 1.0f;
00045 segments = 0;
00046 segs = NULL;
00047 base_is_row = TRUE;
00048 m = c = 0;
00049 block_ = NULL;
00050 }
00051 DENORM(
00052 float x,
00053 float scaling,
00054 ROW *src) {
00055 x_centre = x;
00056 scale_factor = scaling;
00057 source_row = src;
00058 segments = 0;
00059 segs = NULL;
00060 base_is_row = TRUE;
00061 m = c = 0;
00062 block_ = NULL;
00063 }
00064 DENORM(
00065 float x,
00066 float scaling,
00067 double line_m,
00068 double line_c,
00069 inT16 seg_count,
00070 DENORM_SEG *seg_pts,
00071 BOOL8 using_row,
00072 ROW *src);
00073 DENORM(const DENORM &);
00074 DENORM & operator= (const DENORM &);
00075 ~DENORM() {
00076 if (segments > 0)
00077 delete[]segs;
00078 }
00079
00080
00081
00082 float origin() const { return x_centre; }
00083
00084 float scale() const {
00085 return scale_factor;
00086 }
00087 ROW *row() const {
00088 return source_row;
00089 }
00090 const BLOCK* block() const {
00091 return block_;
00092 }
00093 void set_block(const BLOCK* block) {
00094 block_ = block;
00095 }
00096
00097
00098 float x(float src_x) const;
00099
00100
00101
00102 float y(float src_y, float src_x_centre) const;
00103
00104 float scale_at_x(
00105 float src_x) const;
00106 float yshift_at_x(
00107 float src_x) const;
00108
00109 private:
00110 const DENORM_SEG *binary_search_segment(float src_x) const;
00111
00112 BOOL8 base_is_row;
00113 inT16 segments;
00114 double c, m;
00115 float x_centre;
00116 float scale_factor;
00117 ROW *source_row;
00118 DENORM_SEG *segs;
00119 const BLOCK* block_;
00120 };
00121 #endif