WIP: Une base plus propre pour réfléchir.
This commit is contained in:
parent
114e2ccef5
commit
dc341ca5b9
|
@ -50,7 +50,6 @@ int lines_ndx = 0;
|
|||
int plans_ndx = 0;
|
||||
|
||||
#define EDGE 0.999999
|
||||
#define CORRC 1.1
|
||||
|
||||
#define S 0
|
||||
#define S3 1
|
||||
|
@ -291,6 +290,7 @@ static int compute_arrow_2D(int space_size_x,
|
|||
|
||||
|
||||
|
||||
#define CORRC 1.2
|
||||
|
||||
static bool compute_space_3D (int space_size_x,
|
||||
int space_size_y,
|
||||
|
@ -305,25 +305,21 @@ static bool compute_space_3D (int space_size_x,
|
|||
GLubyte *line_origin,
|
||||
GLubyte *plan_origin)
|
||||
{
|
||||
int max = 0, c = 0; // TODO max = math.max(max, space_size_x);
|
||||
for (c = 0; c <= space_size_x; c++) if (c > max) max = c;
|
||||
for (c = 0; c <= space_size_y; c++) if (c > max) max = c;
|
||||
for (c = 0; c <= space_size_z; c++) if (c > max) max = c;
|
||||
printf("max(%d,%d,%d) = %d;\n", space_size_x, space_size_y, space_size_z, max);
|
||||
int maximum = 0, c = 0; // TODO max = math.max(max, 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, maximum = max * CORRC;
|
||||
float x = 0, y = 0, z = 0, max = maximum * CORRC;
|
||||
|
||||
for (int i = 0; i <= space_size_x; i++){
|
||||
for (int j = 0; j <= space_size_y; j++)
|
||||
for (int j = 0; j <= space_size_y; j++){
|
||||
for (int k = 0; k <= space_size_z; k++){
|
||||
|
||||
printf("(%d*%d*%d)<>", i, j, k);
|
||||
|
||||
x = (2 * i / space_size_x - 1) * (space_size_x / maximum);
|
||||
y = (2 * j / space_size_y - 1) * (space_size_y / maximum);
|
||||
z = (2 * k / space_size_z - 1) * (space_size_z / maximum);
|
||||
|
||||
printf("[%0.00f %0.00f %0.00f] ", x, y, z);
|
||||
x = (2 * i / space_size_x - 1) * (space_size_x / max);
|
||||
y = (2 * j / space_size_y - 1) * (space_size_y / max);
|
||||
z = (2 * k / space_size_z - 1) * (space_size_z / max);
|
||||
|
||||
*(vertex_origin + vertex_ndx + 0) = x;
|
||||
*(vertex_origin + vertex_ndx + 1) = y;
|
||||
|
@ -331,25 +327,21 @@ static bool compute_space_3D (int space_size_x,
|
|||
|
||||
vertex_ndx += 3; // if (V) printf(" => vertex_ndx = %3d space_3D\n", vertex_ndx);
|
||||
|
||||
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
*(color_origin + colors_ndx + 0) = 1.0f * x ;
|
||||
*(color_origin + colors_ndx + 1) = 0.0f * y;
|
||||
*(color_origin + colors_ndx + 2) = 0.0f * z;
|
||||
*(color_origin + colors_ndx + 0) = x ;
|
||||
*(color_origin + colors_ndx + 1) = y;
|
||||
*(color_origin + colors_ndx + 2) = z;
|
||||
|
||||
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);
|
||||
}
|
||||
printf(" ");
|
||||
}
|
||||
printf("\n");
|
||||
};
|
||||
|
||||
|
||||
int u = 3; // '9' marche aussi (je n'ai pas été plus loin)
|
||||
*(line_origin + lines_ndx + 0) = 1 + u; *(line_origin + lines_ndx + 1) = 2 + u; lines_ndx += 2;
|
||||
*(line_origin + lines_ndx + 0) = 3 + u; *(line_origin + lines_ndx + 1) = 4 + u; lines_ndx += 2;
|
||||
*(line_origin + lines_ndx + 0) = 5 + u; *(line_origin + lines_ndx + 1) = 6 + u; lines_ndx += 2;
|
||||
|
||||
*(line_origin + lines_ndx + 0) = 2 + u; *(line_origin + lines_ndx + 1) = 4 + u; lines_ndx += 2;
|
||||
*(line_origin + lines_ndx + 0) = 1 + u; *(line_origin + lines_ndx + 1) = 3 + u; lines_ndx += 2;
|
||||
*(line_origin + lines_ndx + 1) = 1; lines_ndx += 1;
|
||||
*(line_origin + lines_ndx + 2) = 2; lines_ndx += 1;
|
||||
|
||||
//if (S3) printf("space 3D buffer_lines (from-to) ");
|
||||
for (int v = 0; v < lines_ndx / 2; v ++) {
|
||||
|
|
|
@ -539,7 +539,7 @@ GLubyte arrows[] = {
|
|||
|
||||
static void get_model_data_and_user_preferences(){
|
||||
|
||||
model_space_size_x = 4; // 0 < model_space_size_x
|
||||
model_space_size_x = 3; // 0 < model_space_size_x
|
||||
model_space_size_y = 2; // 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
|
||||
|
|
Loading…
Reference in New Issue