From c24e93e6df48b3b020a2cb4da6b00254a3cea4fe Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Wed, 11 Oct 2023 16:52:00 +0200 Subject: [PATCH] =?UTF-8?q?WIP:=2012=20lignes=20et=20un=20d=C3=A9but=20de?= =?UTF-8?q?=20m=C3=A9thode...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/graphics/grid.c | 94 +++++++++++++++++++++++++++------------------ 1 file changed, 57 insertions(+), 37 deletions(-) diff --git a/src/graphics/grid.c b/src/graphics/grid.c index 2e7ed0f..ca17bb4 100644 --- a/src/graphics/grid.c +++ b/src/graphics/grid.c @@ -52,7 +52,7 @@ void write_space_ridges (long x, long y, long z) void write_marks_along_space_ridges (long x, long y, long z) { - float i, j, k, vx, vy, vz, max = fmax(x, y); + float i, j, k, vx, vy, vz, max = fmax(x, y); int kin = 0; max = fmax(max, z); for (i = 0; i <= x; i++) @@ -64,48 +64,68 @@ void write_marks_along_space_ridges (long x, long y, long z) vz = (2 * k / z - 1) * z / max; if ( - (i == 0 && j == 0) || (i == 0 && j == y) || (i == x && j == 0) || (i == x && j == y) - || (i == 0 && k == 0) || (i == 0 && k == z) || (i == x && k == 0) || (i == x && k == z) - || (j == 0 && k == 0) || (j == 0 && k == z) || (j == y && k == 0) || (j == y && k == z) - ) - graphics_write_vertex (vx, vy, vz); + (i == 0 && j == 0 && k > 0 && k < z) + || (i == 0 && j == y && k > 0 && k < z) + || (i == x && j == 0 && k > 0 && k < z) + || (i == x && j == y && k > 0 && k < z) + || (i == 0 && k == 0 && j > 0 && j < y) + || (i == 0 && k == z && j > 0 && j < y) + || (i == x && k == 0 && j > 0 && j < y) + || (i == x && k == z && j > 0 && j < y) + || (j == 0 && k == 0 && i > 0 && i < x) + || (j == 0 && k == z && i > 0 && i < x) + || (j == y && k == 0 && i > 0 && i < x) + || (j == y && k == z && i > 0 && i < x) + ) { + kin ++; + graphics_write_vertex (vx, vy, vz); + } }; +printf("n = %d\n", kin); + + int vertex_offset = 8; + + graphics_write_line (vertex_offset + 0, vertex_offset + 6); // + graphics_write_line (vertex_offset + 1, vertex_offset + 7); // + + graphics_write_line (vertex_offset + 2, vertex_offset + 3); // + graphics_write_line (vertex_offset + 4, vertex_offset + 5); // + + graphics_write_line (vertex_offset + 8, vertex_offset + 9); // + graphics_write_line (vertex_offset + 12, vertex_offset + 13); // + + graphics_write_line (vertex_offset + 10, vertex_offset + 11); // + graphics_write_line (vertex_offset + 14, vertex_offset + 15); // + + graphics_write_line (vertex_offset + 18, vertex_offset + 19); // + graphics_write_line (vertex_offset + 20, vertex_offset + 21); // + + graphics_write_line (vertex_offset + 16, vertex_offset + 22); // + graphics_write_line (vertex_offset + 17, vertex_offset + 23); // + + /* graphics_write_line (buffer_lines_offset + 20, buffer_lines_offset + 21); */ + /* graphics_write_line (buffer_lines_offset + 22, buffer_lines_offset + 23); */ + + /* graphics_write_line (buffer_lines_offset + 1, buffer_lines_offset + 21); */ + /* graphics_write_line (buffer_lines_offset + 2, buffer_lines_offset + 22); */ + + /* graphics_write_line (buffer_lines_offset + 0, buffer_lines_offset + 20); */ + /* graphics_write_line (buffer_lines_offset + 3, buffer_lines_offset + 23); */ + + /* graphics_write_line (buffer_lines_offset + 17, buffer_lines_offset + 25); */ + /* graphics_write_line (buffer_lines_offset + 18, buffer_lines_offset + 26); */ + + /* graphics_write_line (buffer_lines_offset + 5, buffer_lines_offset + 25); */ + /* graphics_write_line (buffer_lines_offset + 6, buffer_lines_offset + 26); */ - int buffer_lines_offset = 12; + /* graphics_write_line (buffer_lines_offset + 5, buffer_lines_offset + 25); */ + /* graphics_write_line (buffer_lines_offset + 6, buffer_lines_offset + 26); */ - graphics_write_line (buffer_lines_offset + 5, buffer_lines_offset + 25); - graphics_write_line (buffer_lines_offset + 6, buffer_lines_offset + 26); + /* graphics_write_line (buffer_lines_offset + 0, buffer_lines_offset + 1); */ + /* graphics_write_line (buffer_lines_offset + 1, buffer_lines_offset + 2); */ - graphics_write_line (buffer_lines_offset + 1, buffer_lines_offset + 0); - graphics_write_line (buffer_lines_offset + 2, buffer_lines_offset + 3); - graphics_write_line (buffer_lines_offset + 8, buffer_lines_offset + 9); - graphics_write_line (buffer_lines_offset + 10, buffer_lines_offset + 11); - - graphics_write_line (buffer_lines_offset + 9, buffer_lines_offset + 11); - graphics_write_line (buffer_lines_offset + 8, buffer_lines_offset + 10); - - graphics_write_line (buffer_lines_offset + 12, buffer_lines_offset + 13); - graphics_write_line (buffer_lines_offset + 14, buffer_lines_offset + 15); - - graphics_write_line (buffer_lines_offset + 12, buffer_lines_offset + 14); - graphics_write_line (buffer_lines_offset + 13, buffer_lines_offset + 15); - - graphics_write_line (buffer_lines_offset + 20, buffer_lines_offset + 21); - graphics_write_line (buffer_lines_offset + 22, buffer_lines_offset + 23); - - graphics_write_line (buffer_lines_offset + 1, buffer_lines_offset + 21); - graphics_write_line (buffer_lines_offset + 2, buffer_lines_offset + 22); - - graphics_write_line (buffer_lines_offset + 0, buffer_lines_offset + 20); - graphics_write_line (buffer_lines_offset + 3, buffer_lines_offset + 23); - - graphics_write_line (buffer_lines_offset + 17, buffer_lines_offset + 25); - graphics_write_line (buffer_lines_offset + 18, buffer_lines_offset + 26); - - graphics_write_line (buffer_lines_offset + 5, buffer_lines_offset + 25); - graphics_write_line (buffer_lines_offset + 6, buffer_lines_offset + 26); }