From a79f468f1984a998ed610ce30130f82334f81fd9 Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Sat, 4 Nov 2023 15:19:41 +0100 Subject: [PATCH] =?UTF-8?q?WIP:=20mesures=20&=20v=C3=A9rifications=20pour?= =?UTF-8?q?=20optimisations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/graphics/arrows.c | 2 -- src/graphics/graphics.c | 29 +++++++++++++++++++++++------ 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/graphics/arrows.c b/src/graphics/arrows.c index 5ad6c0d..0a8042e 100644 --- a/src/graphics/arrows.c +++ b/src/graphics/arrows.c @@ -37,8 +37,6 @@ int write_one_arrow_vertex (int space_X_int, int space_Y_int, int space_Z_int, int weight, int site, int arrow_x, int arrow_y, int arrow_z, int print) { - printf("In write_one_arrow_vertex() site = %d\n", site); - float max = fmax(space_X_int, space_Y_int); max = fmax(max, space_Z_int); diff --git a/src/graphics/graphics.c b/src/graphics/graphics.c index 6666a06..30d5187 100644 --- a/src/graphics/graphics.c +++ b/src/graphics/graphics.c @@ -694,7 +694,7 @@ static inline int set_arrow (struct arrow_t *arrows_ptr, int arrows_nb, int spac int address = -1, current_weight = -1; if (console) printf("in set_arrow (begin) arrows_nb = %d requested site: %d > ", arrows_nb, site); - if (console) for (int i = 0; i < arrows_nb; i++) {printf(" [%d] = %d ", i, arrows_ptr[i].site); if (site == arrows_ptr[i].site) break;} + /* if (console) for (int i = 0; i < arrows_nb; i++) {printf(" [%d] = %d ", i, arrows_ptr[i].site); if (site == arrows_ptr[i].site) break;} */ for (int i = 0; i < arrows_nb; i++) if ((site == arrows_ptr[i].site) @@ -756,13 +756,13 @@ void main_test_graphics (void) srand(time(NULL)); int rand(void); void srand(unsigned int seed); - int randomize = 5, console = 0, arrows_nb = 0, space_X = 1, space_Y = 1, space_Z = 1; + int randomize = 60, console = 0, arrows_nb = 0, space_X = 1, space_Y = 1, space_Z = 1; if (randomize) { space_X = 1 + rand() % randomize; space_Y = 1 + rand() % randomize; space_Z = 1 + rand() % randomize; } - int density_max = space_X * space_Y * space_Z, specified_arrows_nb = rand() % density_max; + int density_max = space_X * space_Y * space_Z, specified_arrows_nb = density_max; int max = fmax(space_X, space_Y); max = fmax(max, space_Z); @@ -790,7 +790,10 @@ void main_test_graphics (void) /*------------------------------------------------------------------------*/ + printf("specified_arrows_nb: %d\n", specified_arrows_nb); + if (randomize) for (int i = 0; i < specified_arrows_nb; i++) + { arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, 1, // load rand() % 6, // site @@ -798,11 +801,15 @@ void main_test_graphics (void) rand() % space_Y, // y rand() % space_Z, // z console); + if (i > 0 && i % 1000 == 0) printf("|"); + if (i > 0 && i % 100000 == 0) printf("\n"); + } else for (int i = 0; i < 6; i++) arrows_nb = set_arrow (arrows_ptr, arrows_nb, 1, 1, 1, 1, i, 0, 0, 0, 0); int max_arrows_nb = arrows_nb; + printf("\nend initial arrows drawing\n"); - if (randomize) for (int i = 0; i < specified_arrows_nb * 6; i++) + if (randomize) for (int i = 0; i < 6; i++) arrows_nb = set_arrow (arrows_ptr, arrows_nb, space_X, space_Y, space_Z, rand() % 1, // load rand() % 6, // site @@ -811,9 +818,19 @@ void main_test_graphics (void) rand() % space_Z, // z console); else for (int i = 0; i < 6; i++) - arrows_nb = set_arrow (arrows_ptr, arrows_nb, 1, 1, 1, 0, i, 0, 0, 0, 1); + arrows_nb = set_arrow (arrows_ptr, arrows_nb, 1, 1, 1, 0, i, 0, 0, 0, 0); - if (randomize) print_user_choices(arrows_ptr, max_arrows_nb, arrows_nb, space_X, space_Y, space_Z, 1, 0); + int angle = 9; + if (space_X > angle && space_Y > angle && space_Z > angle) for (int i = 0; i < angle; i++) + for (int u = 0; u < angle; u++) for (int v = 0; v < angle; v++) for (int w = 0; w < angle; w++) + if (u + v + w < angle * 3) + arrows_nb = set_arrow (arrows_ptr, arrows_nb, 1, 1, 1, 0, i, u, v, w, 0); + + if (space_X > angle && space_Y > angle && space_Z > angle) + printf("+ effacement des flèches dans l'angle-origine\ + <=> contrôle graphique de la fonction erase_arrow()\n"); + + if (randomize) print_user_choices(arrows_ptr, max_arrows_nb, arrows_nb, space_X, space_Y, space_Z, 0, 0);