ajout De la fonction de representation des graphes
This commit is contained in:
parent
8108949bb3
commit
f174afd188
@ -1,41 +0,0 @@
|
||||
#include<graph.h>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
void visuelGraphe(graphe g){
|
||||
int taille=1000;
|
||||
int origine=taille/2;
|
||||
int distance=4*origine/5;
|
||||
int tailleVert=taille/20;
|
||||
InitialiserGraphique();
|
||||
CreerFenetre(10,10,taille,taille);
|
||||
|
||||
int i,j;
|
||||
int x,y;
|
||||
char* nV=malloc(2);
|
||||
*nV='1';
|
||||
*(nV+1)='\0';
|
||||
int* cX=calloc(g.ordre,sizeof(int));
|
||||
int* cY=calloc(g.ordre,sizeof(int));
|
||||
for(i=0;i<g.ordre;i++){
|
||||
x=(int) origine+distance*cos(2*M_PI*i/g.ordre);
|
||||
y=(int) origine+distance*sin(2*M_PI*i/g.ordre);
|
||||
cX[i]=x+tailleVert/2;
|
||||
cY[i]=y+tailleVert/2;
|
||||
RemplirArc(x,y,tailleVert,tailleVert,0,360);
|
||||
EcrireTexte(x,y,nV,2);
|
||||
(*nV)++;
|
||||
|
||||
}
|
||||
|
||||
for(i=0;i<g.ordre;i++){
|
||||
for(j=0;j<g.ordre;j++){
|
||||
if(g.adj[i][j]!=0){
|
||||
DessinerSegment(cX[i],cY[i],cX[j],cY[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Touche();
|
||||
FermerGraphique();
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user