BUT2/DEV/DEV3.2/TP02_Recursivite/Q5Main.java

30 lines
907 B
Java
Raw Normal View History

2023-10-12 16:39:49 +02:00
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.Polygon;
2023-10-23 13:07:05 +02:00
import java.lang.Math;
2023-10-12 16:39:49 +02:00
public class Q5Main{
public static void main(String[] args) {
2023-10-23 13:07:05 +02:00
int l = 1000;
int m = 40;
int detail = Integer.parseInt(args[0]);
2023-10-12 16:39:49 +02:00
JFrame fenetre = new JFrame("Q1 Galerie");
2023-10-23 13:07:05 +02:00
fenetre.setSize(l+2*m, l+2*m);
fenetre.setLocation(0, 0);
2023-10-12 16:39:49 +02:00
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Polygon etoile = new Polygon();
Q5Polygon dessinEtoile = new Q5Polygon(etoile);
2023-10-23 13:07:05 +02:00
Q5Recursivite modele = new Q5Recursivite(etoile, fenetre);
2023-10-12 16:39:49 +02:00
fenetre.add(dessinEtoile);
2023-10-23 13:07:05 +02:00
fenetre.setVisible(true);
Q5Point g = new Q5Point(m+l/2, m);
Q5Point c = new Q5Point(m+l-((int)(l*Math.sqrt(3))/2), m+(3*l)/4);
Q5Point a = new Q5Point(2*m+((int)(l*Math.sqrt(3))/2), m+(3*l)/4);
modele.nextStep(detail, a,c,g);
modele.nextStep(detail, c,g,a);
modele.nextStep(detail, g,a,c);
2023-10-12 16:39:49 +02:00
}
}