#include "ofApp.h" int MAX_POINTS=20000; int LASER_INTENSITY=37; //-------------------------------------------------------------- void testApp::setup(){ laser.set_pts(MAX_POINTS); laser.set_intensity(LASER_INTENSITY); } //-------------------------------------------------------------- void testApp::update(){ } ofPolyline 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 testApp::draw(){ ofBackground(0); ofSetColor(255,255,255); ofMatrix4x4 m = ofMatrix4x4::newIdentityMatrix(); m.rotateRad(ofGetElapsedTimef(),0,0,1); m.translate(ofGetWidth()/2,ofGetHeight()/2,0); ofPolyline square=polyLineTransform(makePolygon(4,200),m); square.draw(); int num = laser.draw(square); if (num>0){ ofSetWindowTitle(ofToString(ofGetFrameRate(), 2)+" fps laser points: "+ofToString(num)); } else { ofSetWindowTitle("laser error "); } } //-------------------------------------------------------------- void testApp::keyPressed(int key){ } //-------------------------------------------------------------- void testApp::keyReleased(int key){ } //-------------------------------------------------------------- void testApp::mouseMoved(int x, int y ){ /// int i = 1; /// while ( i