Created
October 21, 2016 00:31
-
-
Save stephanschulz/91a8a4b351723126cd02b1858e142077 to your computer and use it in GitHub Desktop.
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
| #include "ofApp.h" | |
| float theta,theta2; | |
| //-------------------------------------------------------------- | |
| void ofApp::setup(){ | |
| theta = 0; | |
| theta2 = PI/2; | |
| } | |
| //-------------------------------------------------------------- | |
| void ofApp::update(){ | |
| } | |
| //-------------------------------------------------------------- | |
| void ofApp::draw(){ | |
| ofPushMatrix(); | |
| ofTranslate(ofGetWidth()/2, ofGetHeight()/2); | |
| float _beginAngle = ofRadToDeg(theta); | |
| float _endAngle = ofRadToDeg(theta2); | |
| float _radius = 80; | |
| float _thickness = 10; | |
| // Increase the angle over time | |
| theta += 0.02; | |
| theta2 += 0.02; | |
| //draw section arc | |
| ofPath inner_pLine; | |
| // inner_pLine.setMode(ofPath::POLYLINES); | |
| inner_pLine.setCircleResolution(200); | |
| inner_pLine.arc( 0, 0, _radius, _radius, _beginAngle, _endAngle); | |
| inner_pLine.close(); | |
| inner_pLine.arc( 0, 0, _radius+_thickness, _radius+_thickness,_beginAngle,_endAngle); | |
| inner_pLine.close(); | |
| inner_pLine.setColor(ofColor(255,0,0)); | |
| inner_pLine.draw(); | |
| float _midAngle = _beginAngle + (_endAngle-_beginAngle)/2; | |
| float x = _radius * cos(ofDegToRad(_midAngle)); | |
| float y = _radius * sin(ofDegToRad(_midAngle)); | |
| ofSetColor(255); | |
| ofDrawBitmapString("a", x, y); | |
| ofPopMatrix(); | |
| ofDrawBitmapStringHighlight("theta "+ofToString(theta)+" , deg "+ofToString(_beginAngle),20,20); | |
| ofDrawBitmapStringHighlight("theta2 "+ofToString(theta)+" , deg "+ofToString(_endAngle),20,40); | |
| } | |
| //-------------------------------------------------------------- | |
| void ofApp::keyPressed(int key){ | |
| if(key == '-'){ | |
| theta -= 0.02; | |
| theta2 -= 0.02; | |
| } | |
| if(key == '='){ | |
| theta += 0.02; | |
| theta2 += 0.02; | |
| } | |
| } | |
| //-------------------------------------------------------------- | |
| void ofApp::keyReleased(int key){ | |
| } | |
| //-------------------------------------------------------------- | |
| void ofApp::mouseMoved(int x, int y){ | |
| } | |
| //-------------------------------------------------------------- | |
| void ofApp::mouseDragged(int x, int y, int button){ | |
| } | |
| //-------------------------------------------------------------- | |
| void ofApp::mousePressed(int x, int y, int button){ | |
| } | |
| //-------------------------------------------------------------- | |
| void ofApp::mouseReleased(int x, int y, int button){ | |
| } | |
| //-------------------------------------------------------------- | |
| void ofApp::mouseEntered(int x, int y){ | |
| } | |
| //-------------------------------------------------------------- | |
| void ofApp::mouseExited(int x, int y){ | |
| } | |
| //-------------------------------------------------------------- | |
| void ofApp::windowResized(int w, int h){ | |
| } | |
| //-------------------------------------------------------------- | |
| void ofApp::gotMessage(ofMessage msg){ | |
| } | |
| //-------------------------------------------------------------- | |
| void ofApp::dragEvent(ofDragInfo dragInfo){ | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment