diff 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
line wrap: on
line diff
--- a/grid.h	Tue Apr 09 13:22:28 2013 +0100
+++ b/grid.h	Tue Apr 09 17:14:31 2013 +0100
@@ -15,9 +15,12 @@
 #include "eventLogger.h"
 #include "presetManager.h"
 #include "hilbert.h"
+
 using namespace std;
 class Preset;
 
+
+
 class Grid {
     
 public:
@@ -30,22 +33,24 @@
     void move(TwoVector moveP); // shift view by pixels
     void zoom(float factor);
 
-    
+    typedef enum{NO_INTERPOLATION, INTERPOLATE_GRID, INTERPOLATE_PRESET} interpolateModeType;
+    interpolateModeType interpolateMode;
     void snapCheck();
     void shiftCentreToSnapped();
-    void draw();    // draw lines
-    
+    void draw();  
+    void drawGridLines();
     void update(); // change according to zoom
-    
+    int interpLevel;
+    int smallestGridSpacing; // number of pixels when small grid dissappears from view
     vector<int> getParams();
     TwoVector getCoord();
     void setMinZoom();
     void setMaxZoom();
     
     // HILBERT now does each coord for this
-    vector<int> calculateParamsFromCoord(TwoVector coord) const;
-    TwoVector calculateCoordFromParams(vector<int> params) const;
-
+    vector<int> calculateParamsFromCoord(TwoVector coord);
+    TwoVector calculateCoordFromParams(vector<int> params);
+    vector<int> calculateInterpolatedParamsFromCoord(TwoVector coord);
     TwoVector coordToPixel(TwoVector coord);
  
     // the inverse stuff
@@ -110,8 +115,8 @@
     void setCoord(TwoVector coord);
     void drawCrossHairs();
     
-
-    
+    int calculateInterpolateLevel();
+    vector<int> interpVector(vector<int> upper, vector<int> lower, float frac);