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/ofApp.cpp | 132 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 polyTest/src/ofApp.cpp (limited to 'polyTest/src/ofApp.cpp') 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