WIP: beaucoup mieux, déjà ! (les vertex semblent OK)

This commit is contained in:
Jean Sirmai 2023-07-18 19:27:19 +02:00
parent dc341ca5b9
commit 811b98504f
Signed by: jean
GPG Key ID: FB3115C340E057E3
2 changed files with 24 additions and 16 deletions

View File

@ -290,7 +290,8 @@ static int compute_arrow_2D(int space_size_x,
#define CORRC 1.2
#define CORRC 1.3
#define P 1
static bool compute_space_3D (int space_size_x,
int space_size_y,
@ -309,13 +310,15 @@ static bool compute_space_3D (int space_size_x,
for (c = 0; c <= space_size_x; c++) if (c > maximum) maximum = c;
for (c = 0; c <= space_size_y; c++) if (c > maximum) maximum = c;
for (c = 0; c <= space_size_z; c++) if (c > maximum) maximum = c;
printf("max(%d,%d,%d) = %d;\n", space_size_x, space_size_y, space_size_z, maximum);
float x = 0, y = 0, z = 0, max = maximum * CORRC;
float i, j, k, x, y, z, max = maximum * CORRC;
for (int i = 0; i <= space_size_x; i++){
for (int j = 0; j <= space_size_y; j++){
for (int k = 0; k <= space_size_z; k++){
printf("max(%d,%d,%d) = %d; size_x / max = %6.3f; size_y / max = %6.3f; size_z / max = %6.3f\n",\
space_size_x, space_size_y, space_size_z, maximum, space_size_x / max, space_size_y / max, space_size_z / max);
for (i = 0; i <= space_size_x; i++){
for (j = 0; j <= space_size_y; j++){
for (k = 0; k <= space_size_z; k++){
x = (2 * i / space_size_x - 1) * (space_size_x / max);
y = (2 * j / space_size_y - 1) * (space_size_y / max);
@ -333,21 +336,26 @@ static bool compute_space_3D (int space_size_x,
colors_ndx += 3; // if (C) printf(" => colors_ndx = %d\n", colors_ndx);
printf("(%d*%d*%d)<>[%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);
}
printf(" ");
if (P) printf(" ");
}
printf("\n");
if (P) printf("\n");
};
*(line_origin + lines_ndx + 1) = 1; lines_ndx += 1;
*(line_origin + lines_ndx + 2) = 2; lines_ndx += 1;
*(line_origin + lines_ndx) = 0; lines_ndx += 1;
*(line_origin + lines_ndx) = 2; lines_ndx += 1;
*(line_origin + lines_ndx) = 1; lines_ndx += 1;
*(line_origin + lines_ndx) = 3; lines_ndx += 1;
*(line_origin + lines_ndx) = 2; lines_ndx += 1;
*(line_origin + lines_ndx) = 3; lines_ndx += 1;
*(line_origin + lines_ndx) = 0; lines_ndx += 1;
*(line_origin + lines_ndx) = 1; lines_ndx += 1;
//if (S3) printf("space 3D buffer_lines (from-to) ");
for (int v = 0; v < lines_ndx / 2; v ++) {
if (S3) printf("(%d-%d) ", *(line_origin + 2 * v), *(line_origin + 2 * v + 1));
}
if (S3) printf("\n");
if (S3) printf(" \n");
return 1;
}

View File

@ -539,8 +539,8 @@ GLubyte arrows[] = {
static void get_model_data_and_user_preferences(){
model_space_size_x = 3; // 0 < model_space_size_x
model_space_size_y = 2; // 0 < model_space_size_y
model_space_size_x = 5; // 0 < model_space_size_x
model_space_size_y = 1; // 0 < model_space_size_y
model_space_size_z = 1; // 0 < model_space_size_z
model_arrows_nb = 4; // assert : l'emplacement des flèches est contraint
// par model_space_size_x, y, z et le nombre de sites
@ -573,7 +573,7 @@ static void get_model_data_and_user_preferences(){
#define S 1
#define S 0
static void compute_buffers_sizes(int model_space_size_x,
int model_space_size_y,
int model_space_size_z,