Last active
May 3, 2016 01:31
-
-
Save unohee/ffe579cda046df5473c94039a865f5ba to your computer and use it in GitHub Desktop.
snippet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void InfinityMatrix::init(int start_val, int interval, int size){ | |
//This is the Pool of Scale. in initialization, it creates multiple Infinity series which will be sonified and visualized. | |
if(size > 0){ | |
series.resize(size); | |
int level = 0; | |
do{ | |
if(level==0){ | |
//first, generate origin series. | |
series[0].generate(start_val,interval,size); | |
}else{ | |
series[level].generate(series[0].get_val(level), interval, size); | |
} | |
level++; | |
}while(level < size); | |
lengthOfSeq = size; | |
length = size; | |
}else{ | |
lengthOfSeq = 0; | |
length = 0; | |
} | |
} | |
void InfinityMatrix::generate(){ | |
int level = 0; //points the level of rows | |
bool hasValue; //if function has enough values it's true. | |
//populate 2D array first | |
if(lengthOfSeq > 0){ | |
hasValue = true; | |
matrix.resize(lengthOfSeq); | |
for(int i = 0;i < lengthOfSeq;i++){ | |
matrix[i].resize(lengthOfSeq); | |
} | |
}else{ | |
hasValue = false; | |
} | |
if(hasValue == true){ | |
do{ | |
if(level==0){ | |
for(int i = 0; i < lengthOfSeq;i++){ | |
matrix[i][0] = series[0].get_val(i); | |
//cout<<matrix[i][level]<<" "; | |
} | |
}else{ | |
for(int i = 0; i < lengthOfSeq; i++){ | |
matrix[i][level] = series[level].get_val(i); | |
//cout<<matrix[i][level]<<" "; | |
} | |
} | |
//cout<<"Level : "<<level<<endl; | |
level ++; | |
}while(level < matrix.size()); | |
matrixW = matrix.size(); | |
matrixH = matrix[matrix.size()-1].size(); //and its row. | |
// cout << "Matrix : "<<matrixW<<"x"<<matrixH<<" "<<endl; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment