From d60cc2aa2994f9e63d9570bea4fac8b8a9949b43 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Tue, 30 Jan 2018 00:35:30 +0000 Subject: much progress --- polyTest/src/main.cpp | 24 +++++++++ polyTest/src/ofApp.cpp | 132 +++++++++++++++++++++++++++++++++++++++++++++++++ polyTest/src/ofApp.h | 35 +++++++++++++ 3 files changed, 191 insertions(+) create mode 100644 polyTest/src/main.cpp create mode 100644 polyTest/src/ofApp.cpp create mode 100644 polyTest/src/ofApp.h (limited to 'polyTest/src') diff --git a/polyTest/src/main.cpp b/polyTest/src/main.cpp new file mode 100644 index 0000000..02b6b14 --- /dev/null +++ b/polyTest/src/main.cpp @@ -0,0 +1,24 @@ +#include "ofMain.h" +#include "ofApp.h" + + +//======================================================================== +int main(int argc, char *argv[]){ + + + ofGLFWWindowSettings settings; + + + settings.width = 1200; + settings.height = 900; + + //1200 = 13.2° = 42898 pts theoretical + + shared_ptr mainWindow = ofCreateWindow(settings); + + shared_ptr mainApp(new ofApp); + + ofRunApp(mainWindow, mainApp); + ofRunMainLoop(); +} + \ No newline at end of file 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