ソースです。
import java.awt.Color;
import java.awt.Graphics2D;
import myMath.MyFunctionND;
import myMath.Tpl10;
public class TestMyParabora41 extends Tpl10 {
int t = 0;
public void init() {
tr.move(getWidth() / 2, getHeight() / 2 );
tr.set(1, 0, 0, -1);
tr.scale(50);
setTimer(100);
}
public void draw(Graphics2D g2) {
MyFunctionND mf = new MyFunctionND();
mf.set(0.25, 0, 0);
// 焦点
double xf = 0;
double yf = 1;
double x = (double) t / 10 - 3;
// 軸
g2.setColor(Color.black);
g2.draw(tr.LineX());
g2.draw(tr.LineY());
// 焦点
g2.setColor(Color.blue);
g2.fill(tr.Point(xf, yf));
// 準線
g2.setColor(Color.blue);
g2.draw(tr.Line(-5, -yf, 5, -yf));
//
g2.setColor(Color.green);
mf.p(x);
g2.draw(tr.Line(xf, yf, mf.x, mf.y));
g2.draw(tr.Line(x, -1, mf.x, mf.y));
//
g2.setColor(Color.red);
g2.fill(tr.Point(mf.x, mf.y));
draw(mf, -3, x);
t++;
if (x > 3) {
t = 0;
}
}
}