void ofxPolylineLoad(ofPolyline & poly, string xmlPath) { ofXml xml; bool bLoaded = xml.load(xmlPath); if(bLoaded == false) { return; } xml.setTo("poly"); bool bClosed = ofToInt(xml.getAttribute("closed")); poly.clear(); int numOfPoints = xml.getNumChildren(); for(int i=0; i<numOfPoints; i++) { xml.setToChild(i); float x = ofToFloat(xml.getAttribute("x")); float y = ofToFloat(xml.getAttribute("y")); poly.addVertex(x, y); } if(bClosed == true) { poly.close(); } }
curvedSquare::curveSquare() { x = 100; y = 100; speedX = ofRandom(-1, 1); // and random speed and direction speedY = ofRandom(-1, 1); dim = 20; myPoly.addVertex(x,y); myPoly.bezierTo(x,y,x-6,y+1,x-9, y+6); myPoly.bezierTo(x-12,y+9,x-12,y+17,x-12,y+17); myPoly.addVertex(x-12,y+44); myPoly.addVertex(x+14,y+44); myPoly.bezierTo(x+14,y+44,x+22,y+44,x+26,y+41); myPoly.bezierTo(x+30,y+38,x+30,y+32,x+30,y+32); myPoly.addVertex(x+30,y); myPoly.addVertex(x+30,y); myPoly.close(); }
void Clipper::close(ofPolyline& polyline) { polyline.close(); }