From 58f5cd8beb75cd6abebfa9381b3833d333f3ed2b Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Tue, 3 Oct 2023 16:19:54 +0200 Subject: [PATCH] WIP: set_arrow() OK (printf + drawing) with no more than two calls < to check ++ --- src/graphics/arrows.c | 6 +++--- src/graphics/graphics.c | 21 +++++++++++---------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/graphics/arrows.c b/src/graphics/arrows.c index e7c451a..8a5b302 100644 --- a/src/graphics/arrows.c +++ b/src/graphics/arrows.c @@ -79,19 +79,19 @@ void arrows_write_terminations (long x, long y, long z) graphics_write_color(0.3f, 0.3f, 0.3f); graphics_write_color(0.3f, 0.3f, 0.3f); - // X - X (EAST - WEST) axis - arrows tips + // X - X (EAST - WEST) axis - arrows tips (red - green) graphics_write_vertex (vx + (1 / max) - arrow_tip_padding, vy, vz); graphics_write_vertex (vx - (1 / max) + arrow_tip_padding, vy, vz); graphics_write_color(1.0f - nuance / 3, 0.0f + nuance, 0.0f + nuance); graphics_write_color(0.0f + nuance, 1.0f - nuance, 1.0f - nuance); - // Y - Y (ZENITH - NADIR) axis - arrows tips + // Y - Y (ZENITH - NADIR) axis - arrows tips (cyan - magenta) graphics_write_vertex (vx, vy + (1 / max) - arrow_tip_padding, vz); graphics_write_vertex (vx, vy - (1 / max) + arrow_tip_padding, vz); graphics_write_color(0.0f + nuance, 1.0f - nuance / 3, 0.0f + nuance); graphics_write_color(1.0f - nuance, 0.0f + nuance, 1.0f - nuance); - // Z - Z (NORTH - SOUTH) axis - arrows tips + // Z - Z (NORTH - SOUTH) axis - arrows tips (blue - yellow) graphics_write_vertex (vx, vy, vz + (1 / max) - arrow_tip_padding); graphics_write_vertex (vx, vy, vz - (1 / max) + arrow_tip_padding); graphics_write_color(0.0f + nuance, 0.0f + nuance, 1.0f - nuance / 4); diff --git a/src/graphics/graphics.c b/src/graphics/graphics.c index 074ba00..02874d7 100644 --- a/src/graphics/graphics.c +++ b/src/graphics/graphics.c @@ -643,7 +643,7 @@ static void show_buffers_states(int space_X, int space_Y, int space_Z, int arrow (arrows_nb * 14 - (buffer_lines_size - buffer_lines_size_after_cubes)) / arrows_nb, arrows_nb); if (arrows_nb > 1) - printf("\n WARNING In this test, it may happens that arrows with different weights are drawn superimposed (check the list).\n"); + printf("\n WARNING In this test, it may happens that some arrows (whatever their weights) are drawn superimposed (check the list).\n"); } @@ -880,13 +880,15 @@ void main_test_graphics (void) // xyz, 0, x, y, z, xy, xz, yz, xyz GLuint arrows[arrows_nb * 5]; show_user_choices(arrows, arrows_nb, space_X, space_Y, space_Z, pref_show_grids, 1, 0); + + // WARNING arrows with same address will be drawn superimposed if (arrows_nb > 0) for (int i = 0; i < arrows_nb; i ++) { arrows[i * 5 + 0] = 1 + rand() % arbitrary; // load / weight - arrows[i * 5 + 1] = rand() % 6; // site - arrows[i * 5 + 2] = rand() % space_X; // x - arrows[i * 5 + 3] = rand() % space_Y; // y - arrows[i * 5 + 4] = rand() % space_Z; // z + arrows[i * 5 + 1] = rand() % 6; // site + arrows[i * 5 + 2] = rand() % space_X; // x + arrows[i * 5 + 3] = rand() % space_Y; // y + arrows[i * 5 + 4] = rand() % space_Z; // z }; // forget the next two lines during the random tests @@ -913,12 +915,11 @@ void main_test_graphics (void) arrows_nb = set_arrow (arrows, arrows_nb, rand() % arbitrary, // load / weight rand() % 6, // site, - MIN (rand() % space_X, space_X - 1), // x TODO - // Qu'est-ce que c'est que ce truc pas net !... - MIN (rand() % space_Y, space_Y - 1), // y - MIN (rand() % space_Z, space_Z - 1)); // z + rand() % space_X, // x + rand() % space_Y, // y + rand() % space_Z); // z - // ligne suivante inutile: < ce sont les sous-fonctions de set_arrow() qui le font + // ligne suivante inutile: < ce sont les sous-fonctions de set_arrow() qui appellent // show_user_choices(arrows, arrows_nb, space_X, space_Y, space_Z, pref_show_grids, 1, 1); int weight = 0, site = 0,