// Dartmouth CS 2, Winter 2009, Chris Bailey-Kellogg // Notes 7 | Sketch 4 // Simplified version of Greenberg, Appendix B - 1 // Current position along the circle/line int angle = 0; // Bunch of layout stuff: // Center and radius of the circle, length of the line float xa=100, ya=150, r=50, pts=200; // Start of the line, computed relative to the circle float xs=xa+2*r, ys=ya-1.5*r; float xc=xa+2*r, yc=ya+1.5*r; void setup() { // Have to hard-code the size to make the applet happy // size(ceil(xs+pts)+10, ceil(yc+r)+10); size(410,285); background(127); smooth(); textFont(loadFont("Verdana-24.vlw")); } void draw() { background(127); noStroke(); // The circle fill(255); noStroke(); ellipse(xa,ya,2*r,2*r); stroke(0); line(xa-r,ya,xa+r,ya); line(xa,ya-r,xa,ya+r); fill(0); text("0",xa+r,ya); text("90",xa,ya+r+24); text("180",xa-r-2*24,ya); text("270",xa,ya-r); // The sine and cosine curves stroke(255); for (int i=0; i