rt300@34: // rt300@34: // hilbert.h rt300@34: // sonicZoom rt300@34: // rt300@34: // Created by Robert Tubb on 04/04/2013. rt300@34: // rt300@34: // Handles the hilbert curve stuff rt300@34: rt300@34: #ifndef __sonicZoom__hilbert__ rt300@34: #define __sonicZoom__hilbert__ rt300@34: rt300@34: #include rt300@34: #include rt300@34: #include "ofMain.h" rt300@34: #include "rot_rules.h" rt300@34: #endif /* defined(__sonicZoom__hilbert__) */ rt300@34: rt300@34: rt300@34: rt300@34: class Hilbert{ rt300@34: private: rt300@34: rt300@34: public: rt300@34: int P; // dimensionas of high D space rt300@34: int N; // number of resolution bits rt300@34: int codeLength; rt300@34: vector > cubeStartVertices; rt300@34: vector cubeRotations; rt300@34: vector > theGrayCode; rt300@34: vector theGrayCodeD; rt300@34: rt300@34: void init(int N, int P); rt300@34: void makeCode(); rt300@34: vector calculateParamsFromIndex(unsigned long long coord); rt300@34: long long calculateIndexFromParams(vector params); rt300@34: void makeRotationRules(); rt300@34: int rotate(int vertex, int entryPoint, int direction); rt300@34: int rotateInverse(int vertex, int entryPoint, int direction) ; rt300@34: }; rt300@34: rt300@34: rt300@34: