summaryrefslogtreecommitdiff
path: root/polyTest/src/ofApp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'polyTest/src/ofApp.cpp')
-rw-r--r--polyTest/src/ofApp.cpp132
1 files changed, 132 insertions, 0 deletions
diff --git a/polyTest/src/ofApp.cpp b/polyTest/src/ofApp.cpp
new file mode 100644
index 0000000..1553666
--- /dev/null
+++ b/polyTest/src/ofApp.cpp
@@ -0,0 +1,132 @@
+#include "ofApp.h"
+#include "glew.h"
+
+
+//--------------------------------------------------------------
+void ofApp::setup(){
+
+}
+
+
+
+//--------------------------------------------------------------
+void ofApp::update(){
+
+
+}
+
+ofPolyline ofApp::polyLineTransform(const ofPolyline& poly, ofMatrix4x4 xform){
+ ofPolyline tempPoly;
+ for (auto& p:poly){
+ tempPoly.addVertex(ofVec3f(p)*xform);
+ }
+ return tempPoly;
+}
+
+ofPolyline makePolygon(int num,float diam){
+ ofPolyline poly;
+ float step=PI*2/num;
+ for (int i=0;i<=num;i++){
+ poly.addVertex(cos(step*i)*diam,sin(step*i)*diam);
+ }
+ return poly;
+}
+
+void drawPoly(ofPolyline poly,float x,float y){
+ glPushMatrix();
+ ofTranslate(x,y);
+ poly.draw();
+ for (int i=0;i<poly.size();i++){
+ ofDrawBitmapString(poly.getDegreesAtIndex(i),poly[i].x+10,poly[i].y+10,0);
+ }
+ glPopMatrix();
+}
+
+
+//--------------------------------------------------------------
+void ofApp::draw(){
+ ofBackground(0,0,0);
+ ofSetColor(255,255,255);
+
+ ofTranslate(ofGetWidth()/2,ofGetHeight()/2);
+ ofRotate(0,0,1,ofGetElapsedTimef()*50);
+ drawPoly(makePolygon(4,200),200,200);
+ drawPoly(makePolygon(5,200),-200,200);
+ drawPoly(makePolygon(6,200),-200,-200);
+
+
+
+
+}
+
+
+//--------------------------------------------------------------
+void ofApp::exit() {
+
+}
+
+
+
+//--------------------------------------------------------------
+void ofApp::keyPressed(ofKeyEventArgs &args){
+
+
+
+}
+
+
+//--------------------------------------------------------------
+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::outputWindowResized(ofResizeEventArgs &resizeargs){
+
+}
+
+//--------------------------------------------------------------
+void ofApp::gotMessage(ofMessage msg){
+
+}
+
+//--------------------------------------------------------------
+void ofApp::dragEvent(ofDragInfo dragInfo){
+
+
+}