From 3fb8528c1f19838f3d76cfa14e8f102b0f356552 Mon Sep 17 00:00:00 2001 From: Theo Date: Mon, 9 Sep 2024 11:38:45 +0200 Subject: [PATCH] =?UTF-8?q?Les=20axes=20=C3=A9taient=20pas=20bon,=20mdr?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.c | 15 ++++++++++----- valeurs.txt | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/main.c b/main.c index 888fa32..bf3e2ba 100644 --- a/main.c +++ b/main.c @@ -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_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 char* pointeur = file; unsigned int line = 0; - while(line < nc+1) + while(line < nc) { /* Cherche le premier \n à partir du pointeur * /!\ on suppose un fichier encodé en UNIX (LF) /!\ */ pointeur = strchr(pointeur, '\n') + 1; -// printf(" ->\"%c\"", *pointeur); + //printf(" ->\"%c\"", *pointeur); int taille_tableau = atoi(pointeur); 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 for(unsigned int i = 1; i < taille_tableau+1; i++) @@ -278,7 +283,7 @@ int main(int argc, char* argv[]) printCourbeTerminal(); - mode_affichage = HORIZONTAL; + mode_affichage = SUPERPOSER; int window = initWindow(argc, argv, afficher); glutMainLoop(); diff --git a/valeurs.txt b/valeurs.txt index 5e3f188..9b37e2e 100644 --- a/valeurs.txt +++ b/valeurs.txt @@ -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 5 1 2 3 4 5 6 21 543.3 75 34 76 89