diff --git a/src/gm/LR_1.java b/src/gm/LR_1.java new file mode 100644 index 0000000..21ef1e6 --- /dev/null +++ b/src/gm/LR_1.java @@ -0,0 +1,50 @@ +package gm; + +import com.annimon.graphics.Application; +import com.annimon.graphics.GraphicsExt; + +/** + * Вариант 11 (тут 1) + * @author aNNiMON + */ +public class LR_1 extends Application { + + public static void main(String[] args) { + new LR_1(); + } + + private static final double N = 40; + private static final double R = 3.4; + + private final double x0, y0; + + public LR_1() { + super(640, 480); + x0 = 4; + y0 = 3.5; + } + + @Override + protected void paint(GraphicsExt g) { + for (int i = 0; i < N; i++) { + drawEllipse(g, i, x0, y0); + } + } + + private void drawEllipse(GraphicsExt g, int i, double x0, double y0) { + double x = x0 + (i * R / N) * 1; + double y = y0; + g.move(x, y); + final double ax = Math.toRadians(6); + double angle = 0; + while (angle <= Math.PI * 2) { + final double sin_phi1 = Math.sin(angle); + final double cos_phi1 = Math.cos(angle); + x = x0 + (i * R / N) * cos_phi1; + y = y0 + ( (N - i) * R / N) * sin_phi1; + g.draw(x, y); + angle += ax; + } + } + +}