Skip to content

Instantly share code, notes, and snippets.

@takuma7
Created August 22, 2011 16:52
Show Gist options
  • Save takuma7/1162883 to your computer and use it in GitHub Desktop.
Save takuma7/1162883 to your computer and use it in GitHub Desktop.
コマ大数学科2011/8/23
float ra=200;
float rb=ra/2;
float rc=ra/3;
float xa,ya,xb,yb,xc,yc;
float px, py;
float omega;
float t;
float vb, vc;
float phib, phic;
void setup(){
size(800,800);
background(255);
xa = width/2;
ya = height/2;
omega = 1;
t=0;
vb = 7;
vc = -17;
phib = PI/3;
phic = 0;
smooth();
}
void draw(){
//fill(255, 255, 255, 80);
//rect(0, 0, width, height);
translate(width/2, height/2);
xa = ra*cos(omega*t);
ya = ra*sin(omega*t);
//stroke(255, 0, 0);
//line(0, 0, xa, ya);
//line(0, 0, xa, ya);
xb = xa + rb*cos(omega*vb*t+phib);
yb = ya + rb*sin(omega*vb*t+phib);
//stroke(0, 255, 0);
//line(xb, yb, xa, ya);
xc = xb + rc*cos(omega*vc*t+phic);
yc = yb + rc*sin(omega*vc*t+phic);
//stroke(0, 0, 255);
//line(xb, yb, xc, yc);
fill(0);
strokeWeight(3);
stroke(0);
if(t!=0)
line(px, py, xc, yc);
px = xc;
py = yc;
t+=0.01;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment