WIP: première matrice 3D complète paramétrable (un peu...) => une bonne base pour corriger les erreurs !

This commit is contained in:
Jean Sirmai 2023-07-20 23:21:41 +02:00
parent 2dd9b88dba
commit 90e2c8d346
Signed by: jean
GPG Key ID: FB3115C340E057E3
3 changed files with 20 additions and 14 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 KiB

View File

@ -52,8 +52,8 @@ int plans_ndx = 0;
#define EDGE 0.999999 #define EDGE 0.999999
#define S 0 #define S 0
#define S3 1 #define S3 0
#define SA 1 #define SA 0
#define A3 0 #define A3 0
#define L 0 #define L 0
@ -328,15 +328,13 @@ static bool compute_space_3D (int size_x,
*(vertex_origin + vertex_ndx + 1) = y; *(vertex_origin + vertex_ndx + 1) = y;
*(vertex_origin + vertex_ndx + 2) = z; *(vertex_origin + vertex_ndx + 2) = z;
vertex_ndx += 3; vertex_ndx += 3; // if (V) printf(" => vertex_ndx = %3d\n", vertex_ndx);
// if (V) printf(" => vertex_ndx = %3d\n", vertex_ndx);
*(color_origin + colors_ndx + 0) = x; *(color_origin + colors_ndx + 0) = x;
*(color_origin + colors_ndx + 1) = 3 * y / 2; *(color_origin + colors_ndx + 1) = 3 * y / 2;
*(color_origin + colors_ndx + 2) = z; *(color_origin + colors_ndx + 2) = z;
colors_ndx += 3; colors_ndx += 3; // if (C) printf(" => colors_ndx = %3d\n", colors_ndx);
// if (C) printf(" => colors_ndx = %3d\n", colors_ndx);
if (P) printf("(%1.0f*%1.0f*%1.0f)<>[%6.3f %6.3f %6.3f] ", i, j, k, x, y, z); if (P) printf("(%1.0f*%1.0f*%1.0f)<>[%6.3f %6.3f %6.3f] ", i, j, k, x, y, z);
} }
@ -345,17 +343,25 @@ static bool compute_space_3D (int size_x,
if (P) printf("\n"); if (P) printf("\n");
}; };
for (int u = 0; u < (size_x + 1) * (size_y + 1); u ++){ // << cette boucle est à remplacer, sur le modèle de la suivante. for (int u = 0; u < size_y + 1; u ++){
*(line_origin + lines_ndx) = u * (size_z + 1); for (int w = 0; w < size_z + 1; w ++){
lines_ndx += 1; *(line_origin + lines_ndx) = w + (size_z + 1) * u; lines_ndx += 1;
*(line_origin + lines_ndx) = u * (size_z + 1) + size_z; *(line_origin + lines_ndx) = (size_x + 1) * (size_y + 1) * (size_z + 1)
lines_ndx += 1; - (size_y + 1) * (size_z + 1) + w + (size_z + 1) * u; lines_ndx += 1;
}
}
for (int u = 0; u <= size_y; u ++){
for (int w = 0; w < size_x + 1; w ++){
*(line_origin + lines_ndx) = (size_z + 1) * (size_y + 1) * w + (size_z + 1) * u; lines_ndx += 1;
*(line_origin + lines_ndx) = (size_z + 1) * (size_y + 1) * w + size_z + (size_z + 1) * u; lines_ndx += 1;
}
} }
for (int u = 0; u <= size_x; u ++){ for (int u = 0; u <= size_x; u ++){
for (int w = 0; w < size_y; w ++){ for (int w = 0; w < size_y; w ++){
*(line_origin + lines_ndx) = (size_z + 1) * (size_y + 1) * u + w; lines_ndx += 1; *(line_origin + lines_ndx) = (size_z + 1) * (size_y + 1) * u + w; lines_ndx += 1;
*(line_origin + lines_ndx) = (size_z + 1) * (size_y + 1) * u + (size_z + 1) * size_y + w; lines_ndx += 1; *(line_origin + lines_ndx) = (size_z + 1) * (size_y + 1) * u + (size_z + 1) * size_y + w; lines_ndx += 1;
} }
} }

View File

@ -539,7 +539,7 @@ GLubyte arrows[] = {
static void get_model_data_and_user_preferences(){ static void get_model_data_and_user_preferences(){
model_space_size_x = 5; // 0 < model_space_size_x model_space_size_x = 10; // 0 < model_space_size_x
model_space_size_y = 4; // 0 < model_space_size_y model_space_size_y = 4; // 0 < model_space_size_y
model_space_size_z = 3; // 0 < model_space_size_z model_space_size_z = 3; // 0 < model_space_size_z
model_arrows_nb = 0; // assert : l'emplacement des flèches est contraint model_arrows_nb = 0; // assert : l'emplacement des flèches est contraint