最後に見易くするため、半径と定点を描きます。
ここまでのソースです。
import java.awt.Color; import java.awt.Graphics2D; import myMath.MyCircle; import myMath.MyEpiCycloid; import myMath.Tpl10; public class TestMyEpiCycloid03 extends Tpl10 { // 円・秒 int t = 0; double rc = 1.0; // 定円 double rm = 1.0; // 動円 public void init() { tr.move(getWidth() / 2, getHeight() / 2); tr.set(1, 0, 0, -1); tr.scale(30); setTimer(10); } public void draw(Graphics2D g2) { MyEpiCycloid mp = new MyEpiCycloid(); MyCircle mc = new MyCircle(); double x, r; mp.set(rc, rm); mc.set(0, 0, rc + rm); x = Math.toRadians(t); // 軸 g2.setColor(Color.black); g2.draw(tr.LineX()); g2.draw(tr.LineY()); // 定円 g2.setColor(Color.blue); g2.draw(tr.Circle(0, 0, rc)); // 動円 r = rm; g2.setColor(Color.green); mc.p(x); g2.draw(tr.Circle(mc.x, mc.y, r)); // 線 g2.setColor(Color.blue); mp.p(x); g2.draw(tr.Line(mc.x, mc.y, mp.x, mp.y)); // 点 g2.setColor(Color.red); g2.fill(tr.Point(mp.x,mp.y)); draw(mp, 0, x); t++; if (t > 360) { t = 0; } } }