view hilbert.h @ 49:178642d134a7 tip

xtra files
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Wed, 01 May 2013 17:34:33 +0100
parents 0d3a993405e4
children
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"




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;
    vector<unsigned int> theEntryVertices;
    vector<unsigned int> theRotations;
    
    void makeCode();

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

};


#endif /* defined(__sonicZoom__hilbert__) */