Mercurial > hg > soniczoomios
diff hilbert.h @ 34:94df2cd72d7b
New hilbert code - does rotations!
author | Robert Tubb <rt300@eecs.qmul.ac.uk> |
---|---|
date | Mon, 08 Apr 2013 12:58:21 +0100 |
parents | |
children | 790939017078 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hilbert.h Mon Apr 08 12:58:21 2013 +0100 @@ -0,0 +1,42 @@ +// +// hilbert.h +// sonicZoom +// +// Created by Robert Tubb on 04/04/2013. +// +// Handles the hilbert curve stuff + +#ifndef __sonicZoom__hilbert__ +#define __sonicZoom__hilbert__ + +#include <iostream> +#include <vector.h> +#include "ofMain.h" +#include "rot_rules.h" +#endif /* defined(__sonicZoom__hilbert__) */ + + + +class Hilbert{ +private: + +public: + int P; // dimensionas of high D space + int N; // number of resolution bits + int codeLength; + vector<vector <bool> > cubeStartVertices; + vector<int> cubeRotations; + vector<vector <bool> > theGrayCode; + vector<unsigned int> theGrayCodeD; + + void init(int N, int P); + void makeCode(); + vector<int> calculateParamsFromIndex(unsigned long long coord); + long long calculateIndexFromParams(vector<int> params); + void makeRotationRules(); + int rotate(int vertex, int entryPoint, int direction); + int rotateInverse(int vertex, int entryPoint, int direction) ; +}; + + +