転がる円を描きます。 半径は1です。 円が一周すると、円周だけ動きます。 360°回転すれば、2πだけ移動します。 ですから、1°回転すれば、π/180移動します。
円の中心は、(x, 1) です。
// 円 g2.setColor(Color.green); g2.draw(tr.Circle(x, 1, 1));
ここまでのソースです。
import java.awt.Color; import java.awt.Graphics2D; import myMath.MyCycloid; import myMath.Tpl10; public class TestMyCycloid02 extends Tpl10 { int t = 0; public void init() { tr.move(0, getHeight()); tr.set(1, 0, 0, -1); tr.scale(50); setTimer(10); } public void draw(Graphics2D g2) { MyCycloid mp = new MyCycloid(); double x; x = Math.toRadians(t); // 円 g2.setColor(Color.green); g2.draw(tr.Circle(x, 1, 1)); // cycloid draw(mp, 0, x); t++; if (x > 12) { t = 0; } } }