view hilbert.h @ 37:8ed7522deaaa

Interpolation.
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Tue, 09 Apr 2013 17:14:31 +0100
parents 790939017078
children b91a1859829a
line wrap: on
line source
//
//  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:
    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 makeCode();

    void makeRotationRules();
    int rotate(int vertex, int entryPoint, int direction);
    int rotateInverse(int vertex, int entryPoint, int direction) ;
public:
    void init(int N, int P);
    vector<int> calculateParamsFromIndex(unsigned long long coord);
    unsigned long long calculateIndexFromParams(vector<int> params);

};