WIP: Pourquoi ne puis-je étendre l'espace au-delà de 7 x 5 x 4 (x y z) ?

This commit is contained in:
Jean Sirmai 2023-07-23 23:40:12 +02:00
parent 8d13016cc9
commit 9b1c6bc773
Signed by: jean
GPG Key ID: FB3115C340E057E3
2 changed files with 84 additions and 23 deletions

View File

@ -324,7 +324,7 @@ static bool compute_space_3D (int x,
vy = (2 * j / (y - 1) - 1) * (y - 1) / max; vy = (2 * j / (y - 1) - 1) * (y - 1) / max;
vz = (2 * k / (z - 1) - 1) * (z - 1) / max; vz = (2 * k / (z - 1) - 1) * (z - 1) / max;
*(vertex_origin + vertex_ndx + 0) = vx / 2; *(vertex_origin + vertex_ndx + 0) = vx;
*(vertex_origin + vertex_ndx + 1) = vy; *(vertex_origin + vertex_ndx + 1) = vy;
*(vertex_origin + vertex_ndx + 2) = vz; *(vertex_origin + vertex_ndx + 2) = vz;
@ -332,7 +332,7 @@ static bool compute_space_3D (int x,
*(color_origin + colors_ndx + 0) = vx; *(color_origin + colors_ndx + 0) = vx;
*(color_origin + colors_ndx + 1) = 3 * vy / 2; *(color_origin + colors_ndx + 1) = 3 * vy / 2;
*(color_origin + colors_ndx + 2) = vz; *(color_origin + colors_ndx + 2) = 3 * vz / 2;
colors_ndx += 3; // if (C) printf(" => colors_ndx = %3d\n", colors_ndx);23. colors_ndx += 3; // if (C) printf(" => colors_ndx = %3d\n", colors_ndx);23.
@ -343,26 +343,86 @@ static bool compute_space_3D (int x,
if (P) printf("\n"); if (P) printf("\n");
}; };
for (int u = 0; u < y; u ++){ int step_z = 1, step_y = z, step_x = y * z;//(y - 1) * (z - 1);
for (int w = 0; w < z; w ++){
*(line_origin + lines_ndx) = w + z * u; lines_ndx += 1;
*(line_origin + lines_ndx) = x * y * z - y * z + w + z * u; lines_ndx += 1;
}
}
for (int u = 0; u < y; u ++){ /* for (int u = 0; u < y; u ++){ */
for (int w = 0; w < x; w ++){ /* for (int w = 0; w < z; w ++){ */
*(line_origin + lines_ndx) = z * y * w + z * u; lines_ndx += 1; /* *(line_origin + lines_ndx) = w + z * u; lines_ndx += 1; */
*(line_origin + lines_ndx) = z * y * w + z - 1 + z * u; lines_ndx += 1; /* *(line_origin + lines_ndx) = x * y * z - y * z + w + z * u; lines_ndx += 1; */
} /* } */
} /* } */
/* for (int u = 0; u < y; u ++){ */
/* for (int w = 0; w < x; w ++){ */
/* *(line_origin + lines_ndx) = z * y * w + z * u; lines_ndx += 1; */
/* *(line_origin + lines_ndx) = z * y * w + z - 1 + z * u; lines_ndx += 1; */
/* } */
/* } */
/* for (int u = 0; u < x; u ++){ */
/* for (int w = 0; w < z; w ++){ */
/* *(line_origin + lines_ndx) = z * y * u + w; lines_ndx += 1; */
/* *(line_origin + lines_ndx) = z * y * u + z * y - z + w; lines_ndx += 1; */
/* } */
/* } */
*(line_origin + lines_ndx) = step_z * 0 + step_y * 0 + step_x * 0; lines_ndx += 1;
*(line_origin + lines_ndx) = step_z * 0 + step_y * 0 + step_x * (x - 1); lines_ndx += 1;
*(line_origin + lines_ndx) = step_z * 0 + step_y * 0 + step_x * 0; lines_ndx += 1;
*(line_origin + lines_ndx) = step_z * 0 + step_y * (y - 1) + step_x * 0; lines_ndx += 1;
*(line_origin + lines_ndx) = step_z * 0 + step_y * 0 + step_x * 0; lines_ndx += 1;
*(line_origin + lines_ndx) = step_z * (z - 1) + step_y * 0 + step_x * 0; lines_ndx += 1;
*(line_origin + lines_ndx) = step_z * (z - 1) + step_y * (y - 1) + step_x * (x - 1); lines_ndx += 1;
*(line_origin + lines_ndx) = step_z * 0 + step_y * (y - 1) + step_x * (x - 1); lines_ndx += 1;
*(line_origin + lines_ndx) = step_z * (z - 1) + step_y * (y - 1) + step_x * (x - 1); lines_ndx += 1;
*(line_origin + lines_ndx) = step_z * (z - 1) + step_y * (y - 1) + step_x * 0; lines_ndx += 1;
*(line_origin + lines_ndx) = step_z * (z - 1) + step_y * (y - 1) + step_x * (x - 1); lines_ndx += 1;
*(line_origin + lines_ndx) = step_z * (z - 1) + step_y * 0 + step_x * (x - 1); lines_ndx += 1;
*(line_origin + lines_ndx) = step_z * 1 + step_y * 2 + step_x * 3; lines_ndx += 1;
*(line_origin + lines_ndx) = step_z * 1 + step_y * 2 + step_x * 4; lines_ndx += 1;
*(line_origin + lines_ndx) = step_z * 1 + step_y * 2 + step_x * 3; lines_ndx += 1;
*(line_origin + lines_ndx) = step_z * 1 + step_y * 3 + step_x * 3; lines_ndx += 1;
*(line_origin + lines_ndx) = step_z * 1 + step_y * 2 + step_x * 3; lines_ndx += 1;
*(line_origin + lines_ndx) = step_z * 2 + step_y * 2 + step_x * 3; lines_ndx += 1;
*(line_origin + lines_ndx) = step_z * 2 + step_y * 3 + step_x * 4; lines_ndx += 1;
*(line_origin + lines_ndx) = step_z * 2 + step_y * 3 + step_x * 3; lines_ndx += 1;
*(line_origin + lines_ndx) = step_z * 2 + step_y * 3 + step_x * 4; lines_ndx += 1;
*(line_origin + lines_ndx) = step_z * 2 + step_y * 2 + step_x * 4; lines_ndx += 1;
*(line_origin + lines_ndx) = step_z * 2 + step_y * 3 + step_x * 4; lines_ndx += 1;
*(line_origin + lines_ndx) = step_z * 1 + step_y * 3 + step_x * 4; lines_ndx += 1;
*(line_origin + lines_ndx) = step_z * 1 + step_y * 2 + step_x * 4; lines_ndx += 1;
*(line_origin + lines_ndx) = step_z * 2 + step_y * 2 + step_x * 4; lines_ndx += 1;
*(line_origin + lines_ndx) = step_z * 1 + step_y * 2 + step_x * 4; lines_ndx += 1;
*(line_origin + lines_ndx) = step_z * 1 + step_y * 3 + step_x * 4; lines_ndx += 1;
*(line_origin + lines_ndx) = step_z * 1 + step_y * 3 + step_x * 3; lines_ndx += 1;
*(line_origin + lines_ndx) = step_z * 1 + step_y * 3 + step_x * 4; lines_ndx += 1;
*(line_origin + lines_ndx) = step_z * 2 + step_y * 2 + step_x * 3; lines_ndx += 1;
*(line_origin + lines_ndx) = step_z * 2 + step_y * 3 + step_x * 3; lines_ndx += 1;
*(line_origin + lines_ndx) = step_z * 2 + step_y * 2 + step_x * 3; lines_ndx += 1;
*(line_origin + lines_ndx) = step_z * 2 + step_y * 2 + step_x * 4; lines_ndx += 1;
*(line_origin + lines_ndx) = step_z * 2 + step_y * 3 + step_x * 3; lines_ndx += 1;
*(line_origin + lines_ndx) = step_z * 1 + step_y * 3 + step_x * 3; lines_ndx += 1;
for (int u = 0; u < x; u ++){
for (int w = 0; w < z; w ++){
*(line_origin + lines_ndx) = z * y * u + w; lines_ndx += 1;
*(line_origin + lines_ndx) = z * y * u + z * (y - 1) + w; lines_ndx += 1;
}
}
//if (S3) printf("space 3D buffer_lines (from-to) "); //if (S3) printf("space 3D buffer_lines (from-to) ");
printf("nb lines / nb vertex = %d/%d ", lines_ndx / 2, vertex_ndx / 3); printf("nb lines / nb vertex = %d/%d ", lines_ndx / 2, vertex_ndx / 3);
@ -605,3 +665,4 @@ bool compute_space_and_arrows(int model_size_x,

View File

@ -539,9 +539,9 @@ GLubyte arrows[] = {
static void get_model_data_and_user_preferences(){ static void get_model_data_and_user_preferences(){
model_space_size_x = 3; // 0 < model_space_size_x model_space_size_x = 7; // 0 < model_space_size_x
model_space_size_y = 8; // 0 < model_space_size_y model_space_size_y = 5; // 0 < model_space_size_y
model_space_size_z = 5; // 0 < model_space_size_z model_space_size_z = 4; // 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
// par model_space_size_x, y, z et le nombre de sites // par model_space_size_x, y, z et le nombre de sites