comparison grid.h @ 37:8ed7522deaaa

Interpolation.
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Tue, 09 Apr 2013 17:14:31 +0100
parents 790939017078
children 0dfe9e0c01aa
comparison
equal deleted inserted replaced
36:a42903c61558 37:8ed7522deaaa
13 #include "2dvector.h" 13 #include "2dvector.h"
14 #include "ofMain.h" 14 #include "ofMain.h"
15 #include "eventLogger.h" 15 #include "eventLogger.h"
16 #include "presetManager.h" 16 #include "presetManager.h"
17 #include "hilbert.h" 17 #include "hilbert.h"
18
18 using namespace std; 19 using namespace std;
19 class Preset; 20 class Preset;
21
22
20 23
21 class Grid { 24 class Grid {
22 25
23 public: 26 public:
24 bool snapped; 27 bool snapped;
28 ~Grid(); 31 ~Grid();
29 void init(); 32 void init();
30 void move(TwoVector moveP); // shift view by pixels 33 void move(TwoVector moveP); // shift view by pixels
31 void zoom(float factor); 34 void zoom(float factor);
32 35
33 36 typedef enum{NO_INTERPOLATION, INTERPOLATE_GRID, INTERPOLATE_PRESET} interpolateModeType;
37 interpolateModeType interpolateMode;
34 void snapCheck(); 38 void snapCheck();
35 void shiftCentreToSnapped(); 39 void shiftCentreToSnapped();
36 void draw(); // draw lines 40 void draw();
37 41 void drawGridLines();
38 void update(); // change according to zoom 42 void update(); // change according to zoom
39 43 int interpLevel;
44 int smallestGridSpacing; // number of pixels when small grid dissappears from view
40 vector<int> getParams(); 45 vector<int> getParams();
41 TwoVector getCoord(); 46 TwoVector getCoord();
42 void setMinZoom(); 47 void setMinZoom();
43 void setMaxZoom(); 48 void setMaxZoom();
44 49
45 // HILBERT now does each coord for this 50 // HILBERT now does each coord for this
46 vector<int> calculateParamsFromCoord(TwoVector coord) const; 51 vector<int> calculateParamsFromCoord(TwoVector coord);
47 TwoVector calculateCoordFromParams(vector<int> params) const; 52 TwoVector calculateCoordFromParams(vector<int> params);
48 53 vector<int> calculateInterpolatedParamsFromCoord(TwoVector coord);
49 TwoVector coordToPixel(TwoVector coord); 54 TwoVector coordToPixel(TwoVector coord);
50 55
51 // the inverse stuff 56 // the inverse stuff
52 void setParams(vector<int>); 57 void setParams(vector<int>);
53 58
108 void drawPresets(); 113 void drawPresets();
109 114
110 void setCoord(TwoVector coord); 115 void setCoord(TwoVector coord);
111 void drawCrossHairs(); 116 void drawCrossHairs();
112 117
113 118 int calculateInterpolateLevel();
114 119 vector<int> interpVector(vector<int> upper, vector<int> lower, float frac);
115 120
116 121
117 122
118 }; 123 };
119 124