// Dartmouth CS 2, Winter 2009, Chris Bailey-Kellogg // Notes 6 | Sketch 2 // Vertices of a shape int maxVertices = 100; float[] x = new float[maxVertices], y = new float[maxVertices]; // Which vertex is next to add int v = 0; // Which vertex is being dragged (-1 if none) int dragging = -1; // Curve tightness int tight=0; void setup() { size(400,400); background(0); smooth(); textFont(loadFont("LucidaSans-24.vlw")); curveTightness(tight); println("T/t: increase/decrease tightness"); println("p: print Processing commands"); } void draw() { background(0); noFill(); stroke(255); // Create a shape from the current vertices beginShape(); for (int i=0; i0) { // Interior points (on curve) fill(0,255,0); noStroke(); for (int i=1; i= 0) { x[dragging] = mouseX; y[dragging] = mouseY; } } void mouseReleased() { dragging = -1; } void keyPressed() { if (key=='p') { // Print vertices for (int i=0; i