円を移動させます。
import java.awt.Color; import java.awt.Graphics2D; import myMath.MyCircle; import myMath.MyHypoCycloid; import myMath.Tpl10; public class TestMyHypoCycloid02 extends Tpl10 { int t = 0; double rc = 2.5; // 定円 double rm = 1.0; // 動円 public void init() { tr.move(getWidth() / 2, getHeight() / 2); tr.set(1,0,0,-1); tr.scale(40); setTimer(10); } public void draw(Graphics2D g2) { double x; MyHypoCycloid mp = new MyHypoCycloid(); MyCircle mc = new MyCircle(); x = Math.toRadians(t); mp.set(rc, rm); mc.set(0, 0, rc - rm); g2.setColor(Color.black); // 定円 g2.setColor(Color.blue); g2.draw(tr.Circle(mc.x, mc.y, rc)); // 動円 g2.setColor(Color.green); mc.p(x); g2.draw(tr.Circle(mc.x, mc.y, rm)); draw(mp, 0, x); if (t > 360 * 2) { t = 0; } t++; } }