00001
00020 #ifndef NORMALIS_H
00021 #define NORMALIS_H
00022
00023 #include <stdio.h>
00024
00025 class ROW;
00026
00033 class DENORM_SEG
00034 {
00035 public:
00036 DENORM_SEG() {
00037 }
00038
00040 INT32 xstart;
00042 INT32 ycoord;
00044 float scale_factor;
00045 };
00046
00053 class DENORM
00054 {
00055 public:
00056 DENORM() {
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(
00066 float x,
00067 float scaling,
00068 ROW *src) {
00069 x_centre = x;
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(
00078 float x,
00079 float scaling,
00080 double line_m,
00081 double line_c,
00082 INT16 seg_count,
00083 DENORM_SEG *seg_pts,
00084 BOOL8 using_row,
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 {
00094 return x_centre;
00095 }
00096 float scale() const {
00097 return scale_factor;
00098 }
00099 ROW *row() const {
00100 return source_row;
00101 }
00102 float x(
00103 float src_x) const;
00104 float y(
00105 float src_y,
00106 float src_centre) const;
00107 float scale_at_x(
00108 float src_x) const;
00109 float yshift_at_x(
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