diff --git a/src/graphics/arrows.c b/src/graphics/arrows.c index ddb02fc..bc099e7 100644 --- a/src/graphics/arrows.c +++ b/src/graphics/arrows.c @@ -173,44 +173,48 @@ static void show_one_arrow_data_1(int offset_vertex, int offset_colors, offset_vertex, offset_colors, weight, site, x, y, z); } -static void show_one_arrow_data_2(int offset_vertex, int offset_colors, - float max, float base, float tip, float ux, float uy, float uz, float vx, float vy, float vz) +static void show_one_arrow_data_2(int offset_vertex, float max, int uxi, int uyi, int uzi, + float ux, float uy, float uz, float vx, float vy, float vz) { - printf("offset_vertex = %d max = %8.5f base = %8.5f tip = %8.5f\n\ - ux = %8.5f uy = %8.5f uz = %8.5f\n vx = %8.5f vy = %8.5f vz = %8.5f\n",\ - offset_vertex, max, base, tip, ux, uy, uz, vx, vy, vz); + printf("offset_vertex = %d max = %8.5f\n\ + xi = %6d yi = %6d zi = %6d\n\ + ux = %8.5f uy = %8.5f uz = %8.5f\n\ + vx = %8.5f vy = %8.5f vz = %8.5f\n",\ + offset_vertex, max, ux, uy, uz, vx, vy, vz); } /******************************************************************************/ void write_one_arrow(int offset_vertex, int offset_colors, int offset_lines, - int space_X, int space_Y, int space_Z, + int space_X_int, int space_Y_int, int space_Z_int, int weight, int site, int x, int y, int z) { // show_one_arrow_data_1 (offset_vertex, offset_colors, space_X, space_Y, space_Z, weight, site, x, y, z); - float nuance = 0.24f, - max = fmax(space_X, space_Y); + float space_X = space_X_int, space_Y = space_Y_int, space_Z = space_Z_int; + float max = fmax(space_X, space_Y); max = fmax(max, space_Z); + int uxi = (2 * x) / space_X_int, + uyi = (2 * y) / space_Y_int, + uzi = (2 * z) / space_Z_int; + + float ux = uxi, uy = uyi, uz = uzi; + + float vx = (ux - 1.0f) * (space_X / max) + (1.0f / max), + vy = (uy - 1.0f) * (space_Y / max) + (1.0f / max), + vz = (uz - 1.0f) * (space_Z / max) + (1.0f / max); + + show_one_arrow_data_2 (offset_vertex, max, + uxi, uyi, uzi, ux, uy, uz, vx, vy, vz); + // arrow_basis_width donne la dimension de l'étoile centrale float arrow_basis_width = 0.3f * (1 / max), // décale légèrement les pointes des flèches // pour qu'elles n'aillent pas jusqu'aux faces des cubes - arrow_tip_padding = 0.1 * (1 / max), - - ux = (2 * x) / space_X, - uy = (2 * y) / space_Y, - uz = (2 * z) / space_Z; - - float vx = (ux - 1) * (space_X / max) + (1 / max), - vy = (uy - 1) * (space_Y / max) + (1 / max), - vz = (uz - 1) * (space_Z / max) + (1 / max); - - show_one_arrow_data_2 (offset_vertex, offset_colors, max, - ux, uy, uz, vx, vy, vz, arrow_basis_width, arrow_tip_padding); + arrow_tip_padding = 0.1 * (1 / max); // X - X axis - central star (basis) graphics_write_vertex(vx + arrow_basis_width, vy, vz); @@ -241,6 +245,7 @@ void write_one_arrow(int offset_vertex, int offset_colors, int offset_lines, + float nuance = 0.24f; // X - X (EAST - WEST) axis - arrows tips (red - green) graphics_write_vertex (vx + (1 / max) - arrow_tip_padding, vy, vz);