package business;

import java.awt.Point;

import utils.Constantes;

public class Ciclo extends Grafo {

	public Ciclo(int numeroVertices) {
		int radio = 80 + 5 * numeroVertices;
		int xPrimero = radio + 250;
		int yPrimero = 80;

		for(int i = 0; i < numeroVertices; i++) {
			double angulo = i * 2 * Constantes.PI / numeroVertices - Constantes.PI / 2 ;
			int x = xPrimero + (int)(radio * Math.cos(angulo));
			int y = yPrimero + radio + (int)(radio * Math.sin(angulo));
			anadirVertice(new Vertice(new Point(x,y), getVerticeId(), false));
		}

		if(numeroVertices > 2) {
			anadirArista(new Arista(vertices.get(0), vertices.get(numeroVertices-1), getAristaId(), false));
		}

		for(int i = 0; i < numeroVertices-1; i++) {
			anadirArista(new Arista(vertices.get(i), vertices.get(i+1), getAristaId(), false));
		}
	}
}