Upload
reona396
View
367
Download
4
Embed Size (px)
Citation preview
正弦波と極座標
Processing資料(5)
正弦波
float theta;
void setup() { size(580, 350); background(255);}
void draw() { background(255);
for (int i = 0; i < 30; i++) { ellipse(i*20, height/2 + 100*sin(radians(theta + i * 10)), 20, 20); }
theta++;}
float theta;
void setup() { size(580, 350); background(255);}
void draw() { background(255);
for (int i = 0; i < 30; i++) { ellipse(i*20, height/2 + 100*sin(radians(theta + i * 10)), 20, 20); }
theta++;}
float theta;
void setup() { size(580, 350); background(255);}
void draw() { background(255);
for (int i = 0; i < 30; i++) { ellipse(i*20, height/2 + 50*sin(radians(theta + i * 10)), 20, 20); }
theta++;}
float theta;
void setup() { size(580, 350); background(255);}
void draw() { background(255);
for (int i = 0; i < 30; i++) { ellipse(i*20, height/2 + 100*sin(radians(theta + i * 10)), 20, 20); }
theta++;}
float theta;
void setup() { size(580, 350); background(255);}
void draw() { background(255);
for (int i = 0; i < 30; i++) { ellipse(i*20, height/2 + 100*sin(radians(theta + i * 30)), 20, 20); }
theta++;}
極座標
θ
r
(r*cos(θ),r*sin(θ))
円運動
int r = 150;
float x;float y;int theta;
void setup() { size(400, 400); background(255);}
void draw() { fill(255, 30); noStroke(); rect(0, 0, width, height);
x = width/2 + r * cos(radians(theta)); y = height/2 + r * sin(radians(theta));
fill(0); ellipse(x, y, 30, 30);
theta++;}