Last active
May 2, 2016 23:57
-
-
Save unohee/fadeb3ba86009af0b3fade7ac58604c3 to your computer and use it in GitHub Desktop.
Polygonal Mesh for Euclidean Sequencer 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 ofApp::update(){ | |
| vector<ofPoint>steps; | |
| ofMesh innerPoly; | |
| ofPolyline clock; | |
| centre = ofVec2f(posX, posY);//set the centre position of all vertices | |
| //updating all position of steps | |
| for(int i = 0; i < seq_len; i++){ //do iteration for all elements of sequence(seq_len) | |
| steps.insert(steps.begin()+i, ofVec2f(centre.x + radius * cos(angle*i*PI/180),centre.y + radius * sin(angle*i*PI/180))); | |
| //gets circles coordinates | |
| } | |
| vector<ofVec3f> polyOutline; | |
| //updating vertices of all sequence's step | |
| for(int i = 0; i < seq_len; i++){ | |
| if(slots.size() > 0){ | |
| if(slots.at(i)== true){//if sequence has 1. it adds vertex below. | |
| //updating inner mesh | |
| innerPoly.addVertex(steps.at(i)); //front vertices | |
| innerPoly.setupIndicesAuto(); | |
| innerPoly.addColor(ofFloatColor(1,1,1)); | |
| polyOutline.push_back(steps.at(i));//add to | |
| } | |
| } | |
| } | |
| } | |
| void ofApp::draw(){ | |
| innerPoly.draw(); | |
| innerPoly.clear(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment