/*!
\brief Generate a city from an initial land triangle.
*/
void City::Generate()
{
    double x = 30 * UNITE; // x = 10  ->  1km² // maximum 15 pour l'exportation sous maya (trop lourd après)
	
	std::vector<Centre> centres;

	TypeCentre type1 = VILLE, type2 = INDUSTRIEL, type3 = RESIDENCE;
	centres.push_back(Centre(Vector(0,0,0),type1));
	centres.push_back(Centre(Vector(-30*x,-30*x,0),type2)); // ajout d'un centre industriel
	centres.push_back(Centre(Vector(-30*x,-30*x,0),type3)); // ajout d'un centre résidentiel
	centres.push_back(Centre(Vector(-30*x, 30*x,0),type3)); // ajout d'un centre résidentiel
	//centres.push_back(Centre(Vector(20*x,0,0),type1)); // ajout d'un centre ville

	Vector v[4];
	v[0] = Vector(-50*x,-50*x,0);
	v[1] = Vector(50*x, -50*x,0);
	v[2] = Vector(50*x, 50*x,0);
	v[3] = Vector(-50*x,50*x,0);

	Vector::setCol(COL_FOND1,COL_FOND2,COL_FOND3);
	PrismQuad(v[0],v[1],v[2],v[3], 0.000001); // coloration du fond de la zone de la ville
	Vector::setColDefaut();
	
	LandQuad(v[0],v[1],v[2],v[3], centres).Subdivide();
	std::cout << "Nombre de quads: " << PrismQuad::nbQuad << std::endl;

	// fonction d'exportation en obj
	//exporte::exporteMaya();
}
void MaisonClassique::buildFloors(const Quadrangle& q)
{
	Vector plusUnEtage(0,0, windowHeight);

	PrismQuad(q, numberOfMaxFloors*windowHeight).Render();
	for(unsigned int vect = 0; vect < 4; vect++) listPoints[vect] += (plusUnEtage*numberOfMaxFloors);

	//double unite = (double) UNITE;

	//for(unsigned int i = 1; i < nbEtagesMax; i++)
	//{
		//creerEtagesSimples(nbEtagesMax);

		//double nbFenetres = 2;
		//double tailleDesFenetres = unite;
		//double tailleDesCoins = unite;

		//double plusPetitCote = Norm(listePoints[3]-listePoints[0]);
		//if(plusPetitCote > Norm(listePoints[1]-listePoints[0])) plusPetitCote = Norm(listePoints[1]-listePoints[0]);	

		//double tailleDesInterFenetre = plusPetitCote - tailleDesFenetres * nbFenetres - tailleDesCoins*2;
		//tailleDesInterFenetre -= 0.5;

		//etageFenetre->setHauteurBordInf(hauteurEtage*0.1);
		//etageFenetre->setHauteurBordSup(hauteurEtage*0.1);
		//etageFenetre->setTailleInterFenetre(tailleDesInterFenetre);
		//etageFenetre->setTailleFenetre(tailleDesFenetres);
		//etageFenetre->setTailleCoin(tailleDesCoins);
		//etageFenetre->creerEtageVitre(listePoints, hauteurEtage);
	//}
}
Exemplo n.º 3
0
void BaseBuilding::createGroundFloor(const unsigned int& _nbEtages)
{
	setBuildingColor();
	PrismQuad(listPoints[0], listPoints[1], listPoints[2], listPoints[3], windowHeight*_nbEtages).Render();

	for(unsigned int vect = 0; vect < 4; vect++) listPoints[vect] += Vector(0,0, windowHeight*_nbEtages);
}
Exemplo n.º 4
0
void Building::createGroundFloor()
{

	PrismQuad(listPoints[0], listPoints[1], listPoints[2], listPoints[3], windowHeight*numOfFloorsGroundFloor).Render();

	for(unsigned int vect = 0; vect < 4; vect++) listPoints[vect] += Vector(0,0, windowHeight*numOfFloorsGroundFloor);
}
void Batiment::creerBordureToit(const bool& toitParDefaut)
{
	double largeurBord = (double) UNITE*0.2;
	double hauteurBord = (double) UNITE;
	hauteurBord *= toitParDefaut?0.5:0.2;

	double air = Quadrangle(listePoints[0],listePoints[1],listePoints[2],listePoints[3]).Area();

	bool airMini = air > 8*(largeurBord*largeurBord); //2*le minimum

	if(airMini)
	{
		for(unsigned int i = 0; i < 4 && airMin; i++)
		{
			Vector a(listePoints[i%4]);
			Vector b(listePoints[(i+1)%4]);
			Vector pt1, pt2, pt3, pt4;

			Vector ab = Vector(b-a);

			double angle = ( atan2(ab[1],ab[0]) + (M_PI/2) )* (180/M_PI);
			double plusX = largeurBord*cos(angle*M_PI/180);
			double plusY = largeurBord*sin(angle*M_PI/180);

			pt1 = Vector(a[0], a[1], a[2]);
			pt2 = Vector(b[0], b[1], b[2]);
			pt3 = Vector(b[0] + plusX, b[1] + plusY, b[2]);
			pt4 = Vector(a[0] + plusX, a[1] + plusY, a[2]);

			Vector::setCol(125,125,125);
			PrismQuad(pt1, pt2, pt3, pt4, hauteurBord).Render();
			Vector::setColDefaut();
		}
	}
}
void LandQuad::creationQuartier()
{
	Vector::setCol(COL_ROUTE1,COL_ROUTE2,COL_ROUTE3);
	PrismQuad(Quadrangle(p[0],p[1],p[2],p[3]),0.10*UNITE).Render();
	Vector::setColDefaut();

	double tShrink = 7.5*UNITE; // largeur de 15m (au total, donc 7.5m de chaque côté depuis le milieu de la route)
	Quadrangle q=Quadrangle(p[0],p[1],p[2],p[3]).Shrink(tShrink,tShrink,tShrink,tShrink);
	
	BlockQuad(q.getVectors(0), q.getVectors(1), q.getVectors(2), q.getVectors(3),centres);
}
/*!
\brief Create a quadrangular block.
\param a,b,c,d End vertices of the parcel.
*/
BlockQuad::BlockQuad(const Vector& _a,const Vector& _b,const Vector& _c,const Vector& _d,const std::vector<Centre>&_centres): Quadrangle(_a,_b,_c,_d)
{
	// hauteur de 10 mètres pour le lampadaire (5 unités)

	Mobilier(7*UNITE,50*UNITE,0.3*UNITE).creerLampadaires(Quadrangle(_a,_b,_c,_d)); // d a 10 pour le moment mais il faudra le mettre à 25 (cad tous les 50m) une fois les vrais quartiers définis

	// création du trottoir
	Vector::setCol(COL_TROTT1,COL_TROTT2,COL_TROTT3);
	PrismQuad(Quadrangle(_a,_b,_c,_d),0.30*UNITE).Render(); // hauteur de 20 cm
	Vector::setColDefaut();
	double tShrink = 4* UNITE; // 4 m
    Quadrangle q=Quadrangle(_a,_b,_c,_d).Shrink(tShrink,tShrink,tShrink,tShrink);
	Quartier::choixQuartier(q,_centres);
}
/*
\brief Subdivide a quadrangular land parcel. 
*/
void LandQuad::Subdivide()
{
  // Area
  double area=Area();

    // Compute index of smallest edge
    double ab=Norm(p[1]-p[0]);
    double bc=Norm(p[2]-p[1]);
    double cd=Norm(p[3]-p[2]);
    double da=Norm(p[0]-p[3]);

	double random = ((double)(rand()%3 + 3) / 10); // rapport de division du côté

	//std::cout << "ab = " << ab << std::endl;
	//std::cout << "bc = " << bc << std::endl << std::endl;

	int partage = rand()%2;
	// première subdivision large

	if( ab > 150*UNITE && da > 150*UNITE)
	{
		if(partage)
		{
			Vector v1(0,0,0); v1.setDiffxy(p[0],p[1],random * ab);
			Vector v2(0,0,0); v2.setDiffxy(p[3],p[2],random * cd);
			LandQuad(p[0],v1,v2,p[3],centres).Subdivide();
			LandQuad(v1,p[1],p[2],v2,centres).Subdivide();

		}
		else 
		{
			Vector v1(0,0,0); v1.setDiffxy(p[0],p[3],random * da);
			Vector v2(0,0,0); v2.setDiffxy(p[1],p[2],random * bc);
			LandQuad(v1,v2,p[2],p[3],centres).Subdivide();
			LandQuad(p[0],p[1],v2,v1,centres).Subdivide();
		}
	}
	else if(ab > 150*UNITE )//&& partage
	{

		Vector v1(0,0,0); v1.setDiffxy(p[0],p[1],random * ab);
		Vector v2(0,0,0); v2.setDiffxy(p[3],p[2],random * cd);
		LandQuad(p[0],v1,v2,p[3],centres).Subdivide();
		LandQuad(v1,p[1],p[2],v2,centres).Subdivide();

	}
	else if( da >  150*UNITE )//&& !partage
	{

		Vector v1(0,0,0); v1.setDiffxy(p[0],p[3],random * da);
		Vector v2(0,0,0); v2.setDiffxy(p[1],p[2],random * bc);
		LandQuad(v1,v2,p[2],p[3],centres).Subdivide();
		LandQuad(p[0],p[1],v2,v1,centres).Subdivide();

	}
	
	else if( (ab > 90*UNITE && ab < 160*UNITE  && bc > 2*ab && bc < 320*UNITE && bc > 180*UNITE )|| (bc > 90*UNITE && bc < 160*UNITE  && ab > 2*bc && ab < 320*UNITE && ab > 180*UNITE) || // très grands quartiers rectangulaires
			 (ab > 150*UNITE && ab < 200*UNITE  && bc > 1.5*ab && bc < 300*UNITE && bc >225*UNITE )|| (bc > 150*UNITE && bc < 200*UNITE  && ab > 1.5*bc && ab < 300*UNITE && ab > 225*UNITE) || // très grands quartiers semi rectangulaires
			 (ab > 80*UNITE && ab < 100*UNITE  && bc < 100*UNITE  && bc > 80*UNITE)) // grands quartiers carrés
	{
		
		creationQuartier();
		
	}
	else if( ab > 90*UNITE && da >  90*UNITE)
	{
		if(partage){
			Vector v1(0,0,0); v1.setDiffxy(p[0],p[1],random * ab);
			Vector v2(0,0,0); v2.setDiffxy(p[3],p[2],random * cd);
			LandQuad(p[0],v1,v2,p[3],centres).Subdivide();
			LandQuad(v1,p[1],p[2],v2,centres).Subdivide();

		}
		else{
			Vector v1(0,0,0); v1.setDiffxy(p[0],p[3],random * da);
			Vector v2(0,0,0); v2.setDiffxy(p[1],p[2],random * bc);
			LandQuad(v1,v2,p[2],p[3],centres).Subdivide();
			LandQuad(p[0],p[1],v2,v1,centres).Subdivide();

		}

	}
	// deuxième subdivision moyenne
	else if(ab > 90*UNITE ) // && partage
	{
		Vector v1(0,0,0); v1.setDiffxy(p[0],p[1],random * ab);
		Vector v2(0,0,0); v2.setDiffxy(p[3],p[2],random * cd);
		LandQuad(p[0],v1,v2,p[3],centres).Subdivide();
		LandQuad(v1,p[1],p[2],v2,centres).Subdivide();

	}
	else if( da >  90*UNITE  ) // && !partage
	{
		Vector v1(0,0,0); v1.setDiffxy(p[0],p[3],random * da);
		Vector v2(0,0,0); v2.setDiffxy(p[1],p[2],random * bc);
		LandQuad(v1,v2,p[2],p[3],centres).Subdivide();
		LandQuad(p[0],p[1],v2,v1,centres).Subdivide();

	}

	else if( (ab > 80*UNITE && ab < 100*UNITE  && bc > 2*ab && bc < 200*UNITE && bc > 180*UNITE  )|| (bc > 80*UNITE && bc < 100*UNITE  && ab > 2*bc && ab < 200*UNITE && ab >160*UNITE )||  //  quartiers rectangulaires moyens
			(ab > 50*UNITE && ab < 70*UNITE  && bc < 70*UNITE  && bc > 50*UNITE) || //  quartiers carrés moyens
			(ab > 50*UNITE && ab < 70*UNITE  && bc > 3*ab && bc < 210*UNITE && bc >150*UNITE )|| (bc> 50*UNITE && bc < 70*UNITE  && ab > 3*bc && ab < 210*UNITE && ab >150*UNITE ) ||  //  quartiers rectangulaires étalés moyens
			(ab > 50*UNITE && ab < 80*UNITE  && bc > 1.5*ab && bc < 120*UNITE && bc > 75*UNITE )|| (bc > 50*UNITE && bc < 80*UNITE  && ab > 1.5*bc && ab < 120*UNITE && ab > 75*UNITE )) //  quartiers semi rectangulaires moyens
	{
		creationQuartier();
	}

	// dernière subdivision 
	else if(ab > 120*UNITE && ab > 2 *bc)
	{
		Vector v1(0,0,0); v1.setDiffxy(p[0],p[1],random * ab);
		Vector v2(0,0,0); v2.setDiffxy(p[3],p[2],random * cd);
		LandQuad(p[0],v1,v2,p[3],centres).Subdivide();
		LandQuad(v1,p[1],p[2],v2,centres).Subdivide();



	}
	else if( da >  120*UNITE && da > 2 *ab)
	{
		Vector v1(0,0,0); v1.setDiffxy(p[0],p[3],random * da);
		Vector v2(0,0,0); v2.setDiffxy(p[1],p[2],random * bc);
		LandQuad(v1,v2,p[2],p[3],centres).Subdivide();
		LandQuad(p[0],p[1],v2,v1,centres).Subdivide();


	}
	else if(da > 30*UNITE && ab > 30*UNITE)
	{
		creationQuartier();
	}
	else
	{
		Vector::setCol(COL_ROUTE1,COL_ROUTE2,COL_ROUTE3);
		PrismQuad(Quadrangle(p[0],p[1],p[2],p[3]),0.10*UNITE).Render();

		double tShrink = 7.5*UNITE; // largeur de 15m (au total, donc 7.5m de chaque côté depuis le milieu de la route)
		Quadrangle q=Quadrangle(p[0],p[1],p[2],p[3]).Shrink(tShrink,tShrink,tShrink,tShrink);

		Mobilier(10*UNITE,50*UNITE,0.3*UNITE).creerLampadaires(Quadrangle(q[0],q[1],q[2],q[3])); // d a 10 pour le moment mais il faudra le mettre à 25 (cad tous les 50m) une fois les vrais quartiers définis

		 //création du trottoir
		Vector::setCol(COL_TROTT1,COL_TROTT2,COL_TROTT3);
		PrismQuad(Quadrangle(q[0],q[1],q[2],q[3]),0.30*UNITE).Render(); // hauteur de 20 cm
		Vector::setColDefaut();
		 tShrink = 4* UNITE; // 4 m
		Quadrangle q2=Quadrangle(q[0],q[1],q[2],q[3]).Shrink(tShrink,tShrink,tShrink,tShrink);

		Vector::setCol(COL_HERBE1,COL_HERBE2,COL_HERBE3);
		
		PrismQuad(Quadrangle(q2[0],q2[1],q2[2],q2[3]),0.40*UNITE).Render();
		//PrismQuad(Quadrangle(p[0],p[1],p[2],p[3]),0.40*UNITE).Render();
		
		Vector::setColDefaut();
	}



  
}
Exemplo n.º 9
0
void BaseBuilding::creerToitPyramideCoupe()
{
	double largeurBord = (double) UNIT*0.2;
	double hauteurBord = (double) UNIT*0.2;
	double air = Quadrangle(listPoints[0],listPoints[1],listPoints[2],listPoints[3]).Area();
	bool airMini = air > 8*(largeurBord*largeurBord);

	if(airMini)
	{
		float zTriangle = listPoints[0][2] + (float) windowHeight*2;
		Vector centre(0,0,0);

		for(unsigned int i = 0; i < listPoints.size(); i++) centre += listPoints[i];
		centre /= listPoints.size();
		double& z = centre[2]; 
		z = zTriangle; // mise à jour de Z

		//-------------------------Quadrangle supérieur --------------------------------------------------->
		std::vector<Vector> quadrangleIn; //la liste des points du quadrangle supérieur

		double onConserve = (double)(rand()%15)/100;
		for(unsigned int i = 0; i < listPoints.size(); i++)
		{
			Vector in = listPoints[i] + (centre - listPoints[i])*(onConserve + 0.5);
			double& z = in[2];
			z = zTriangle;
			quadrangleIn.push_back(in);
		}

		glBegin(GL_QUADS);
			glNormal3d(0,0,1.0f);
			glColor3ub(Vector::col1,Vector::col2,Vector::col3);
			glVertex3f(quadrangleIn[0][0], quadrangleIn[0][1], quadrangleIn[0][2]);
			glVertex3f(quadrangleIn[1][0], quadrangleIn[1][1], quadrangleIn[1][2]);
			glVertex3f(quadrangleIn[2][0], quadrangleIn[2][1], quadrangleIn[2][2]);
			glVertex3f(quadrangleIn[3][0], quadrangleIn[3][1], quadrangleIn[3][2]);

			for(int i=0; i<4;i++)
			{
				for(int j =0;j<3;j++)
				{
					ToitPyramideCoupe.push_back(quadrangleIn[i][j]);
				}
			}
			
		glEnd(); 
		//--------------------------------------------------------------------------------------------------<


		//----------------------------Faces de la "pyramide coupée"-----------------------------------------<  
		glBegin(GL_QUADS);
			glColor3ub(Vector::col1,Vector::col2,Vector::col3);
			for(unsigned int i = 0; i < 4; i++)
			{	
				glVertex3f(quadrangleIn[i%4][0], quadrangleIn[i%4][1], quadrangleIn[i%4][2]); // point Haut-Gauche
				glVertex3f(listPoints[i%4][0], listPoints[i%4][1], listPoints[i%4][2]); // point Bas-Gauche
				glVertex3f(listPoints[(i+1)%4][0], listPoints[(i+1)%4][1], listPoints[(i+1)%4][2]); //point Bas-Droite
				glVertex3f(quadrangleIn[(i+1)%4][0], quadrangleIn[(i+1)%4][1], quadrangleIn[(i+1)%4][2]); //point Haut-Droite
			}

			int j;
			for (int i=0; i<=3 ;i++)
			{
				for(j=0;j<=2;j++)
					ToitPyramideCoupe.push_back(quadrangleIn[i%4][j]);
				for(j=0;j<=2;j++)
			   	    ToitPyramideCoupe.push_back(listPoints[i%4][j]);
			    for(j=0;j<=2;j++)
				    ToitPyramideCoupe.push_back(listPoints[(i+1)%4][j]);
			    for(j=0;j<=2;j++)
			        ToitPyramideCoupe.push_back(quadrangleIn[(i+1)%4][j]);
			}


		glEnd();
		//--------------------------------------------------------------------------------------------------<

		listPoints.clear();
		for(unsigned int i = 0; i < quadrangleIn.size(); i++) listPoints.push_back(quadrangleIn[i]);
 PrismQuad(quadrangleIn[0],quadrangleIn[1],quadrangleIn[2],quadrangleIn[3], ((double) UNIT)*0.2).Render();
	}
	
}
Exemplo n.º 10
0
void BaseBuilding::createSimpleFloors(const unsigned int& _nbEtages)
{
	PrismQuad(listPoints[0],listPoints[1],listPoints[2],listPoints[3], _nbEtages*windowHeight).Render();
	for(unsigned int vect = 0; vect < 4; vect++) listPoints[vect] += Vector(0,0,_nbEtages*windowHeight);
}
Exemplo n.º 11
0
void BaseBuilding::creerToitPrisme(bool addChimney)
{

	/*
	 d_________________c
	 |				   |
	e|________g________|f --> arrête supérieure du prisme
	 | 				   |
	 |________h________|
	 a				   b
	*/

	double air = Quadrangle(listPoints[0],listPoints[1],listPoints[2],listPoints[3]).Area();

	if(air > airMin)
	{
		double hauteurPrisme = (double) UNIT * 3;
		Vector monterEnZ(0,0,hauteurPrisme);
		int j;

		Vector e = ( (listPoints[3] + listPoints[0]) /2 ) + monterEnZ;
		Vector f = ( (listPoints[2] + listPoints[1]) /2 ) + monterEnZ;

		glBegin(GL_TRIANGLES); // Face ade
			Vector n= (listPoints[3]-listPoints[0])/(e-listPoints[0]);
			n/=Norm(n);
			glNormal3f(n[0],n[1],n[2]);
			glColor3ub(Vector::col1,Vector::col2,Vector::col3);
			glVertex3f(listPoints[0][0], listPoints[0][1], listPoints[0][2]);
			glVertex3f(listPoints[3][0], listPoints[3][1], listPoints[3][2]);
			glVertex3f(e[0], e[1], e[2]);

			  
			for(j=0;j<=2;j++)
				PrismRoof.push_back(listPoints[0][j]);
			for(j=0;j<=2;j++)
				PrismRoof.push_back(listPoints[3][j]);
			for(j=0;j<=2;j++)
				PrismRoof.push_back(e[j]);			

		glEnd();

		glBegin(GL_QUADS); // Face abfe
			n= (listPoints[1]-listPoints[0])/(e-listPoints[0]);
			n/=Norm(n);
			glNormal3f(n[0],n[1],n[2]);
			glColor3ub(Vector::col1,Vector::col2,Vector::col3);
			glVertex3f(listPoints[0][0], listPoints[0][1], listPoints[0][2]);
			glVertex3f(listPoints[1][0], listPoints[1][1], listPoints[1][2]);
			glVertex3f(f[0], f[1], f[2]);
			glVertex3f(e[0], e[1], e[2]);

			for(j=0;j<=2;j++)
				PrismRoof.push_back(listPoints[0][j]);
			for(j=0;j<=2;j++)
				PrismRoof.push_back(listPoints[1][j]);
			for(j=0;j<=2;j++)
				PrismRoof.push_back(f[j]);
			for(j=0;j<=2;j++)
				PrismRoof.push_back(e[j]);
			
		glEnd();

		glBegin(GL_QUADS); // Face cdef
			n= (listPoints[3]-listPoints[2])/(f-listPoints[2]);
			n/=Norm(n);
			glNormal3f(n[0],n[1],n[2]);
			glColor3ub(Vector::col1,Vector::col2,Vector::col3);
			glVertex3f(listPoints[2][0], listPoints[2][1], listPoints[2][2]);
			glVertex3f(listPoints[3][0], listPoints[3][1], listPoints[3][2]);
			glVertex3f(e[0], e[1], e[2]);
			glVertex3f(f[0], f[1], f[2]);

			for(j=0;j<=2;j++)
				PrismRoof.push_back(listPoints[2][j]);
			for(j=0;j<=2;j++)
				PrismRoof.push_back(listPoints[3][j]);
			for(j=0;j<=2;j++)
				PrismRoof.push_back(e[j]);
			for(j=0;j<=2;j++)
				PrismRoof.push_back(f[j]);

		glEnd();

		glBegin(GL_TRIANGLES); // Face bcf
			n= (listPoints[2]-listPoints[1])/(f-listPoints[1]);
			n/=Norm(n);
			glNormal3f(n[0],n[1],n[2]);
			glColor3ub(Vector::col1,Vector::col2,Vector::col3);
			glVertex3f(listPoints[1][0], listPoints[1][1], listPoints[1][2]);
			glVertex3f(listPoints[2][0], listPoints[2][1], listPoints[2][2]);
			glVertex3f(f[0], f[1], f[2]);

			for(j=0;j<=2;j++)
				PrismRoof.push_back(listPoints[1][j]);
			for(j=0;j<=2;j++)
				PrismRoof.push_back(listPoints[2][j]);
			for(j=0;j<=2;j++)
				PrismRoof.push_back(f[j]);

		glEnd();


		//-------------------Cheminée----------------------------->

		if(addChimney)
		{
			Vector g = (e + f)/2;
			Vector h = (listPoints[0] + listPoints[1])/2;

			double chimneyWidth = (double) UNIT;

			std::vector<Vector> newPoints;
			newPoints.push_back(listPoints[0] + monterEnZ/3);
			newPoints.push_back(h + monterEnZ/3); //e - monterEnZ + (monterEnZ/3)
			newPoints.push_back(e - (monterEnZ*2/3)); //g - monterEnZ + (monterEnZ/3)
			newPoints.push_back(g - (monterEnZ*2/3));

			Vector tmp = (listPoints[0] + e + g + h)/4;
			Vector centerAEGH = Vector(tmp[0],tmp[1], newPoints[0][2]); //le centre de la cheminée

			double tailleAd = Norm(newPoints[3] - newPoints[0]);
			double tailleAb = Norm(newPoints[1] - newPoints[0]);
			double ratioAbEtDc,ratioAdEtBc;
			if(tailleAd > tailleAb)
			{
				ratioAbEtDc = tailleAd/tailleAb;
				ratioAdEtBc = 1;
			}
			else
			{
				ratioAbEtDc = 1;
				ratioAdEtBc = tailleAb/tailleAd;
			}
		
			for(unsigned int i = 0; i < newPoints.size(); i++)
			{
				double pas = Norm(newPoints[i] - centerAEGH)/chimneyWidth;
				newPoints[i] = centerAEGH + ( (newPoints[i] - centerAEGH)/pas );
			}

			//Les sommets de la cheminée
			Vector a,b,c,d;
			a = newPoints[0];
			b = newPoints[1];
			c = newPoints[3];
			d = newPoints[2];

			//comme on veut que tous les côtés soient égaux, on applique un ratio
			PrismQuad(
				a,
				a + (b - a)*ratioAbEtDc,
				d + (c - d)*ratioAbEtDc,
				a + (d - a)*ratioAdEtBc,
				((double)UNIT)*3).Render();
		}
	}

}
void Batiment::creerRdc(const unsigned int& _nbEtages)
{
	PrismQuad(listePoints[0], listePoints[1], listePoints[2], listePoints[3], hauteurEtage*_nbEtages).Render();
	//on monte dirrectement à l'étage au dessus du Rdc
	for(unsigned int vect = 0; vect < 4; vect++) listePoints[vect] += Vector(0,0, hauteurEtage*_nbEtages);
}
void Batiment::creerToitPyramide()
{
	double largeurBord = (double) UNITE*0.2;
	double hauteurBord = (double) UNITE*0.2;
	double air = Quadrangle(listePoints[0],listePoints[1],listePoints[2],listePoints[3]).Area();
	bool airMini = air > 8*(largeurBord*largeurBord);
	int j;

	if(airMini)
	{
		double hauteurPyramide = hauteurEtage*2;
		Vector monterEnZ(0,0,hauteurPyramide);
		Vector centre(0,0,0);

		for(unsigned int i = 0; i < listePoints.size(); i++) centre += listePoints[i];
		centre /= listePoints.size();
		centre += monterEnZ;// mise à jour de Z


		glBegin(GL_TRIANGLES); // Debut du dessin de la pyramide
			glColor3ub(Vector::col1,Vector::col2,Vector::col3);
			for(unsigned int i = 0; i < 4; i++)
			{
				glNormal3d(0,0,1.0f);
				glVertex3f(centre[0], centre[1], centre[2]); // Haut du triangle de face
				glVertex3f(listePoints[i%4][0], listePoints[i%4][1], listePoints[i%4][3]); // Bas gauche du triangle de face
				glVertex3f(listePoints[(i+1)%4][0], listePoints[(i+1)%4][1], listePoints[(i+1)%4][3]); // Bas droit du triangle de face

				for(j=0;j<=2;j++)
			   	    ToitPyramide.push_back(centre[j]);
			    for(j=0;j<=1;j++)
				    ToitPyramide.push_back(listePoints[i%4][j]);
				if(j==2)
					ToitPyramide.push_back(listePoints[i%4][j+1]);
			    for(j=0;j<=1;j++)
			        ToitPyramide.push_back(listePoints[(i+1)%4][j]);
				if(j==2)
					ToitPyramide.push_back(listePoints[(i+1)%4][j+1]);

			}
		glEnd(); // Fin du dessin de la pyramide

		//ajout d'une antenne
		if(rand()%100 > 30)
		{
			//"0.9*" pour enterrer l'antenne dans la pyramide
			Vector enterrer(0,0, -0.15*hauteurPyramide);

			std::vector<Vector> quadrangleIn;

			// la base de l'antenne
			for(unsigned int i = 0; i < listePoints.size(); i++)
			{
				Vector in = (listePoints[i] + monterEnZ) + (centre - (listePoints[i] + monterEnZ))*0.97 + enterrer;
				quadrangleIn.push_back(in);
			}
			
			PrismQuad(quadrangleIn[0], quadrangleIn[1], quadrangleIn[2], quadrangleIn[3], hauteurEtage).Render();


			// l'antenne
			for(unsigned int i = 0; i < listePoints.size(); i++)
				quadrangleIn[i] = quadrangleIn[i] + (centre - quadrangleIn[i])*0.5;
			
			PrismQuad(quadrangleIn[0], quadrangleIn[1], quadrangleIn[2], quadrangleIn[3], hauteurPyramide*1.5).Render();
		}

	}
}
void Batiment::creerEtagesSimples(const unsigned int& _nbEtages)
{
	//étage normal
	PrismQuad(listePoints[0],listePoints[1],listePoints[2],listePoints[3], _nbEtages*hauteurEtage).Render();
	for(unsigned int vect = 0; vect < 4; vect++) listePoints[vect] += Vector(0,0,_nbEtages*hauteurEtage);
}