1 /********************************************************** 2 * Version $Id$ 3 *********************************************************/ 4 /* diverses.h */ 5 6 #ifndef __DIVERSES_H 7 #define __DIVERSES_H 8 9 #include "grid_bsl.h" 10 #include <vector> 11 /* 12 class I_Vec : public C_Vec2 13 { 14 public: 15 I_Vec(double x = 0.0, double y = 0.0); 16 I_Vec(const C_Vec2& V); 17 ~I_Vec(); 18 19 int X(void) const; 20 int Y(void) const; 21 double X_binary(void) const; 22 double Y_binary(void) const; 23 void adjust(void); 24 int operator ==(const I_Vec& V); 25 int operator ==(const I_Vec& V) const; 26 }; 27 */ 28 29 class I_Vec 30 { 31 public: 32 // I_Vec(double x = 0.0, double y = 0.0); x(xx)33 I_Vec(int xx = 0, int yy = 0) : x(xx), y(yy) {}; I_Vec(const C_Vec2 & V)34 I_Vec(const C_Vec2& V) { x = (int)V.X(); y = (int)V.Y(); }; ~I_Vec()35 ~I_Vec() {}; 36 X(void)37 inline int X(void) const {return x; }; Y(void)38 inline int Y(void) const {return y; }; 39 // void adjust(void); 40 int operator ==(const I_Vec& V) {return x == V.X() && y == V.Y(); }; 41 int operator ==(const I_Vec& V) const {return x == V.X() && y == V.Y(); }; 42 inline I_Vec operator+(const I_Vec& v) const {return I_Vec(x+v.X(), y+v.Y());}; 43 inline I_Vec operator-(const I_Vec& v) const {return I_Vec(x-v.X(), y-v.Y());}; 44 inline I_Vec& operator = (const I_Vec& v) {x = v.X(); y = v.Y(); return *this;}; 45 inline I_Vec& operator += (const I_Vec& v) { x += v.X(); y += v.Y(); return *this;}; 46 inline I_Vec& operator -= (const I_Vec& v) { x -= v.X(); y -= v.Y(); return *this;}; 47 Length(void)48 inline double Length(void) { return double(sqrt((double)(x*x+y*y))); }; 49 protected: 50 int x, y; 51 }; 52 53 54 /*class IVecWerte 55 { 56 public: 57 IVecWerte( GridWerte& G) : Grid(G) {}; 58 ~IVecWerte() {}; 59 60 inline double& operator [] ( I_Vec& I) 61 { 62 return Grid(int(I.X()),int(I.Y())); 63 } 64 65 const GridWerte& operator () () const 66 { 67 return Grid; 68 } 69 protected: 70 const GridWerte& Grid; 71 }; 72 */ 73 /* 74 class IVecWerteInt 75 { 76 public: 77 IVecWerteInt(GridWerteInt& G) : Grid(G) {}; 78 ~IVecWerteInt() {}; 79 80 inline int& operator [] (const I_Vec& I) const 81 { 82 return Grid.Z[I.Y()][I.X()]; 83 } 84 85 GridWerteInt& operator () () const 86 { 87 return Grid; 88 } 89 protected: 90 GridWerteInt& Grid; 91 }; 92 */ 93 94 bool Rand(int x, int y, const GridWerte& W, int abstand = 0); 95 //int Rand(const I_Vec& I, const IVecWerte& W, int abstand = 0); 96 //int Rand(const I_Vec& I, const GridWerte& W, int abstand = 0); 97 //int innerhalb(const I_Vec& I, const GridWerte& W); 98 //int innerhalb(const I_Vec& I, const IVecWerte& W); 99 int innerhalb(int x, int y, const GridWerte& W); 100 //int isRandPunkt(const I_Vec iv, const GridWerte& G); 101 102 void normieren(C_Vec2& G); 103 //double WinkelDiff(double x, double y); 104 105 double max3(double x, double y, double z); 106 double min3(double x, double y, double z); 107 108 109 110 void 111 LinRand( GridWerte& G, GridWerte& Erg); 112 /* Speicher: Erg.getMem */ 113 114 115 116 117 void DGMGlatt(const GridWerte& G, GridWerte& Erg); 118 /* Speicher: Erg.getMem */ 119 120 void copyGrid(GridWerte& Dest, GridWerte& Source, bool newmem = true); 121 122 void calcExpoAbweichung4erFeld(GridWerte& Erg, GridWerte& Hoehe); 123 /* Speicher: Erg.getMem */ 124 125 void calcExpoAbweichung(GridWerte& Erg, GridWerte& Expo); 126 /* Speicher: Erg.getMem */ 127 128 129 130 131 #endif 132 133 /* End of file */ 134