//***************************************************************************** // CURVE TWEENING, Jarek Rossignac, 2008 //***************************************************************************** void actions() {strokeWeight(1); if (mousePressed&&mouseIsInWindow()) if (keyPressed) { if (key=='c') C.translateBy(MouseDrag()); if ((key=='x')||(key=='t')) C.rotateBy( angle( V(C.P[C.p],Mouse()) , V(C.P[C.p],Pmouse()) ) ); if ((key=='x')||(key=='z')) C.scaleBy(1.-d(C.P[C.p],Mouse()) / d(C.P[C.p],Pmouse()) ); if (key=='s') C.localSmooth(); if (key=='v') C.localPull(); if (key=='i') C.dragVertex(mouseDrag()); } else { if ((mousePressed)&&(Mouse().isInWindow())&&(!keyPressed)) C.dragVertex(MouseDrag());}; if(showCurve) { strokeWeight(1); stroke(blue); C.drawCurve(); if(showEnds) {strokeWeight(2); stroke(yellow); C.drawEnds();}; if(showVertices) {strokeWeight(5); stroke(dblue); C.drawPoints(); strokeWeight(1); if (showVertexIds) {fill(dblue); C.drawVertexIDs(); };}; noStroke(); fill(yellow); C.P[C.m[0]].show(2); fill(cyan); C.P[C.m[1]].show(2); fill(orange); C.P[C.m[2]].show(2); noFill(); stroke(magenta); strokeWeight(1); C.P[C.p].show(3); noStroke(); noFill(); }; strokeWeight(2); if(global) { ops=0; stroke(dgreen); if(throughEnds) C.addEnds(); C.subdivideGlobal(); if(throughEnds) C.chopEnds(); gops=ops;}; if(spans) { ops=0;stroke(dblue); if(throughEnds) C.addEnds(); C.subdivideSpans(); if(throughEnds) C.chopEnds(); sops=ops;}; if(rings) {ops=0; stroke(dred); if(throughEnds) C.addEnds(); if(recursive) C.rollRing(); else C.ringRoll(); if(throughEnds) C.chopEnds(); rops=ops;}; strokeWeight(1); } // end actions