Les axes étaient pas bon, mdr

This commit is contained in:
Theo 2024-09-09 11:38:45 +02:00
parent 434be3a1ea
commit 3fb8528c1f
2 changed files with 11 additions and 6 deletions

15
main.c
View File

@ -96,7 +96,12 @@ void ligne(int index, float hgx, float hgy, float bdx, float bdy)
{ {
float pos_x = map(0, size-1, i-1, hgx, bdx); float pos_x = map(0, size-1, i-1, hgx, bdx);
float pos_y = map(valmin[index], valmax[index], courbe[index][i], bdy, hgy); float pos_y = map(valmin[index], valmax[index], courbe[index][i], bdy, hgy);
axes(hgx, pos_x, bdy, pos_y); if(mode_affichage == VERTICAL)
{
axes(bdy, pos_y, hgx, pos_x);
}else{
axes(hgx, pos_x, bdy, pos_y);
}
} }
} }
@ -187,16 +192,16 @@ void parseFile(char* file, long size)
// Pointeur mobile dans le fichier // Pointeur mobile dans le fichier
char* pointeur = file; char* pointeur = file;
unsigned int line = 0; unsigned int line = 0;
while(line < nc+1) while(line < nc)
{ {
/* Cherche le premier \n à partir du pointeur /* Cherche le premier \n à partir du pointeur
* /!\ on suppose un fichier encodé en UNIX (LF) /!\ */ * /!\ on suppose un fichier encodé en UNIX (LF) /!\ */
pointeur = strchr(pointeur, '\n') + 1; pointeur = strchr(pointeur, '\n') + 1;
// printf(" ->\"%c\"", *pointeur); //printf(" ->\"%c\"", *pointeur);
int taille_tableau = atoi(pointeur); int taille_tableau = atoi(pointeur);
courbe[line][0] = taille_tableau; courbe[line][0] = taille_tableau;
// printf(" ->\"%d\" \n", taille_tableau); //printf(" ->\"%d\" \n", taille_tableau);
// On suppose que les nombres sont séparés par un espace // On suppose que les nombres sont séparés par un espace
for(unsigned int i = 1; i < taille_tableau+1; i++) for(unsigned int i = 1; i < taille_tableau+1; i++)
@ -278,7 +283,7 @@ int main(int argc, char* argv[])
printCourbeTerminal(); printCourbeTerminal();
mode_affichage = HORIZONTAL; mode_affichage = SUPERPOSER;
int window = initWindow(argc, argv, afficher); int window = initWindow(argc, argv, afficher);
glutMainLoop(); glutMainLoop();

View File

@ -1,4 +1,4 @@
1 7
45 0.978147601 0.913545458 0.809016994 0.669130606 0.5 0.309016994 0.104528463 -0.104528463 -0.309016994 -0.5 -0.669130606 -0.809016994 -0.913545458 -0.978147601 -1 -0.978147601 -0.913545458 -0.809016994 -0.669130606 -0.5 -0.309016994 -0.104528463 0.104528463 0.309016994 0.5 0.669130606 0.809016994 0.913545458 0.978147601 1 0.978147601 0.913545458 0.809016994 0.669130606 0.5 0.309016994 0.104528463 -0.104528463 -0.309016994 -0.5 -0.669130606 -0.809016994 -0.913545458 -0.978147601 -1 45 0.978147601 0.913545458 0.809016994 0.669130606 0.5 0.309016994 0.104528463 -0.104528463 -0.309016994 -0.5 -0.669130606 -0.809016994 -0.913545458 -0.978147601 -1 -0.978147601 -0.913545458 -0.809016994 -0.669130606 -0.5 -0.309016994 -0.104528463 0.104528463 0.309016994 0.5 0.669130606 0.809016994 0.913545458 0.978147601 1 0.978147601 0.913545458 0.809016994 0.669130606 0.5 0.309016994 0.104528463 -0.104528463 -0.309016994 -0.5 -0.669130606 -0.809016994 -0.913545458 -0.978147601 -1
5 1 2 3 4 5 5 1 2 3 4 5
6 21 543.3 75 34 76 89 6 21 543.3 75 34 76 89