極方程式と曲線

花びらの形

\[ r = 1 + 0.5 \sin 5 \theta + 0.3 \cos a \theta \]

で表される曲線を描きます。

a = 10

import java.awt.Graphics2D;

import MyPole;
import Tpl20;

public class TestMyPole061 extends Tpl20 {

	public void draw2(Graphics2D g2) {
		MyPole1 mp = new MyPole1();

		draw(mp, 0, 2 * Math.PI);
	}

	class MyPole1 extends MyPole {
		double a = 10;

		public double fr(double t) {
			return 1 + 0.5 * Math.sin(5 * t) + 0.3 * Math.cos(a * t);
		}
	}
}

a = 20

import java.awt.Graphics2D;

import MyPole;
import Tpl20;

public class TestMyPole062 extends Tpl20 {

	public void draw2(Graphics2D g2) {
		MyPole1 mp = new MyPole1();

		draw(mp, 0, 2 * Math.PI);
	}

	class MyPole1 extends MyPole {
		double a = 20;

		public double fr(double t) {
			return 1 + 0.5 * Math.sin(5 * t) + 0.3 * Math.cos(a * t);
		}
	}
}

花びら


[前へ] [戻る]