/**
 * Application manipulant des figures

 * @author Matthias Colin
 * @version 1.1 (31/03/2010)
 */

public class DessinerFigures {

	/**
	 * l'application manipule 3 points A, B et D, un triangle T et un cercle C :
	 *	- constructions des différentes figures
	 *	- affichage
	 *	- translation et affichage
	 *	- calculs de surface et de périmètre
	 */
	public static void main(String[] args) {
		Point pointA, pointB, pointD, pointE, pointO;
		Cercle cercleC;
		Triangle triangleT, triangleOAD, triangleODE, triangleOEB;
		Polygone pentagone;
		double surfaceOAD, surfaceODE, surfaceOEB;
		
		pointA = new Point("A", 3, 5);
		System.out.println(pointA);
		pointA.translater(4, -3);
		System.out.println("translation de (4,-3) -> " + pointA);
		pointB = new Point("B", 3, 5);
		System.out.println("distance [" + pointA + "-" + pointB + "] = " + pointA.distance(pointB));  
		
		cercleC = new Cercle("C", pointB, 10);
		System.out.println(cercleC + " : perimetre = " + cercleC.perimetre() 
			+ " / surface = " + cercleC.surface());
		cercleC.translater(-1,-1);
		System.out.println("translation de C de (-1,-1) : " + cercleC + " et " + pointB);
		pointB.translater(-1, -1);
		System.out.println("translation de B de (-1,-1) : " + cercleC + " et " + pointB);
		
		pointD = new Point("D", 10, 8);
		triangleT = new Triangle("T", pointA, pointB, pointD);
		System.out.println(triangleT + " : perimetre = " + triangleT.perimetre()
			+ " / surface = " + triangleT.surface());
		triangleT.translater(-1,-1);
		System.out.println("translation de T de (-1,-1) : " + triangleT);
		
		pointE = new Point("E", 5, 13);
		pointO = new Point("O", 0, 0);
		
		pentagone = new Polygone("P5", pointO, pointA, pointD, pointE, pointB);
		System.out.println(pentagone + " / perimetre : " + pentagone.perimetre()
			+ " / surface = " + pentagone.surface());
		//pentagone.translater(5, -7);
		//System.out.println("translation de P5 de (5,-7) : " + pentagone);

		// Vérification du calcul de la surface du polygone
		triangleOAD = new Triangle("OAD", pointO, pointA, pointD);
		triangleODE = new Triangle("ODE", pointO, pointD, pointE);
		triangleOEB = new Triangle("OEB", pointO, pointE, pointB);
		surfaceOAD = triangleOAD.surface();
		surfaceODE = triangleODE.surface();
		surfaceOEB = triangleOEB.surface();
		System.out.println("Surface OAD : " + surfaceOAD);
		System.out.println("Surface ODE : " + surfaceODE);
		System.out.println("Surface OEB : " + surfaceOEB);
		System.out.println("Surface Totale (comparer avec P5) : " + 
			(surfaceOAD+surfaceODE+surfaceOEB));
	}
}
