狠狠撸

狠狠撸Share a Scribd company logo
正弦波と極座標 
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++; 
}
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 * 30)), 20, 20); 
} 
theta++; 
}
Processing資料(5) 正弦波と極座標
極座標 
θ 
r 
(谤*肠辞蝉(θ),谤*蝉颈苍(θ))
円运动
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++; 
}

More Related Content

Processing資料(5) 正弦波と極座標

  • 3. 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++; }
  • 4. 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++; }
  • 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 + 50*sin(radians(theta + i * 10)), 20, 20); } theta++; }
  • 7. 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++; }
  • 8. 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++; }
  • 10. 極座標 θ r (谤*肠辞蝉(θ),谤*蝉颈苍(θ))
  • 12. 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++; }