WIP: Cubes (toutes dimensions) 'paquet cadeau' (mais pas sphère) > on repart !

This commit is contained in:
Jean Sirmai 2023-08-15 09:25:59 +02:00
parent bba4783aab
commit 5c6b649fc3
Signed by: jean
GPG Key ID: FB3115C340E057E3
1 changed files with 44 additions and 95 deletions

View File

@ -48,7 +48,7 @@ static int lines_index = 0;
static bool grids_intersections (int x, int y, int z, static bool grids_intersections_volume (int x, int y, int z,
GLfloat *vertex_origin, GLfloat *colors_origin) GLfloat *vertex_origin, GLfloat *colors_origin)
{ {
@ -283,7 +283,7 @@ static void draw_ridges_3D (int x, int y, int z,
} }
static bool draw_grids_3D (int x, int y, int z, static bool draw_grids_3D_volume (int x, int y, int z,
int step_x, int step_y, int step_z, int step_x, int step_y, int step_z,
GLuint *lines_origin, GLuint *lines_origin,
int pref_show_grid) int pref_show_grid)
@ -341,46 +341,6 @@ static void draw_a_central_star(GLuint *lines_origin, int n)
} }
/* W 4 (- 9) */
/* E 22 (+ 9) */
/* A 10 (- 3) */
/* Z 16 (+ 3) */
/* S 12 (- 1) */
/* N 14 (+ 1) */
/* */
// draw_a_central_star (lines_origin, s + 14 * 6);
/* EZ 25 22+3 */
/* EA 19 22-3 */
/* ES 21 22-1 */
/* EN 23 22+1 */
/* WZ 7 4+3 */
/* WA 1 4-3 */
/* WS 3 4-1 */
/* WN 5 4+1 */
/* ZE 25 16+9 */
/* ZW 7 16-9 */
/* ZS 15 16-1 */
/* ZN 17 16+1 */
/* AE 19 10+9 */
/* AW 1 10-9 */
/* AS 9 10-1 */
/* AN 11 10+1 */
/* */
/* SE 21 12+9 */
/* SW 3 12-9 */
/* SZ 15 12+3 */
/* SA 9 12-3 */
/* */
/* NE 23 14+9 */
/* NW 5 14-9 */
/* NZ 17 14+3 */
/* NA 11 14-3 */
static void draw_3_x_4_around_6_poles(GLuint *lines_origin, int n, int side_size) static void draw_3_x_4_around_6_poles(GLuint *lines_origin, int n, int side_size)
{ {
/* N-S C +/- f */ /* N-S C +/- f */
@ -423,19 +383,6 @@ static void draw_3_x_4_around_6_poles(GLuint *lines_origin, int n, int side_size
draw_a_central_star (lines_origin, n + (s - z - y) * 6); // W draw_a_central_star (lines_origin, n + (s - z - y) * 6); // W
} }
static void draw_a_central_star_in_a_cubic_space(GLuint *lines_origin, int n, int side_size)
{
/* DANS UN CUBE DE COTE 3 LE CENTRE EST À 3 x 3 x 3 = 27 / 2 = 13,5 >> 13 * 6
* DANS UN CUBE DE COTE 5 LE CENTRE EST À 5 x 5 x 5 = 125 / 2 = 62,5 >> 62 * 6
* DANS UN CUBE DE COTE 7 LE CENTRE EST À 7 x 7 x 7 = 342 / 2 = 171,5 >> 171 * 6
* ETC.
* JE CHOISIS DES CUBES AYANT DES COTÉS IMPAIRS POUR QU'IL Y AIT UNE CASE CENTRALE
*/
int s = side_size * side_size * side_size / 2;
draw_a_central_star(lines_origin, n + s * 6);
}
static void draw_EW_ZA_SN_in_a_cubic_space(GLuint *lines_origin, int n, int side_size) static void draw_EW_ZA_SN_in_a_cubic_space(GLuint *lines_origin, int n, int side_size)
{ {
/* N-S C +/- f */ /* N-S C +/- f */
@ -455,6 +402,19 @@ static void draw_EW_ZA_SN_in_a_cubic_space(GLuint *lines_origin, int n, int side
draw_a_central_star (lines_origin, n + (s - z) * 6); // N draw_a_central_star (lines_origin, n + (s - z) * 6); // N
} }
static void draw_a_central_star_in_a_cubic_space(GLuint *lines_origin, int n, int side_size)
{
/* DANS UN CUBE DE COTE 3 LE CENTRE EST À 3 x 3 x 3 = 27 / 2 = 13,5 >> 13 * 6
* DANS UN CUBE DE COTE 5 LE CENTRE EST À 5 x 5 x 5 = 125 / 2 = 62,5 >> 62 * 6
* DANS UN CUBE DE COTE 7 LE CENTRE EST À 7 x 7 x 7 = 342 / 2 = 171,5 >> 171 * 6
* ETC.
* JE CHOISIS DES CUBES AYANT DES COTÉS IMPAIRS POUR QU'IL Y AIT UNE CASE CENTRALE
*/
int s = side_size * side_size * side_size / 2;
draw_a_central_star(lines_origin, n + s * 6);
}
// I'm standing on Earth (any planet or star or spinning spheroid, in fact) // I'm standing on Earth (any planet or star or spinning spheroid, in fact)
// and looking towards its North pole // and looking towards its North pole
@ -475,40 +435,52 @@ bool compute_space(int cube_side,
GLuint *lines_origin, GLuint *plans_origin) GLuint *lines_origin, GLuint *plans_origin)
{ {
grids_intersections (cube_side, cube_side, cube_side, vertex_origin, colors_origin); grids_intersections_volume (cube_side, cube_side, cube_side, vertex_origin, colors_origin);
central_stars (cube_side, cube_side, cube_side, vertex_origin, colors_origin); central_stars (cube_side, cube_side, cube_side, vertex_origin, colors_origin);
centers (cube_side, cube_side, cube_side, vertex_origin, colors_origin); centers (cube_side, cube_side, cube_side, vertex_origin, colors_origin);
int step_z = 1, step_y = cube_side + 1, step_x = (cube_side + 1) * (cube_side + 1); int step_z = 1, step_y = cube_side + 1, step_x = (cube_side + 1) * (cube_side + 1);
if (pref_show_grid > 0) draw_ridges_3D (cube_side, cube_side, cube_side, step_x, step_y, step_z, lines_origin); if (pref_show_grid > 0) draw_ridges_3D (cube_side, cube_side, cube_side, step_x, step_y, step_z, lines_origin);
draw_grids_3D (cube_side, cube_side, cube_side, step_x, step_y, step_z, lines_origin, pref_show_grid); draw_grids_3D_volume (cube_side, cube_side, cube_side, step_x, step_y, step_z, lines_origin, pref_show_grid);
int s = step_z * cube_side + step_y * cube_side + step_x * cube_side + 1; int s = step_z * cube_side + step_y * cube_side + step_x * cube_side + 1;
int side_size = cube_side; /* IT IS A CUBE ! space_x = space_y = space_z */ int side_size = cube_side; /* IT IS A CUBE ! space_x = space_y = space_z */
// draw_a_central_star_in_a_cubic_space (lines_origin, s, side_size); draw_a_central_star_in_a_cubic_space (lines_origin, s, side_size);
draw_EW_ZA_SN_in_a_cubic_space (lines_origin, s, side_size); draw_EW_ZA_SN_in_a_cubic_space (lines_origin, s, side_size);
draw_3_x_4_around_6_poles (lines_origin, s, side_size); draw_3_x_4_around_6_poles (lines_origin, s, side_size);
if (0) for (int i = 0; i < side_size * side_size * side_size; i ++) if (0) for (int i = 0; i < side_size * side_size * side_size; i ++)
draw_a_central_star (lines_origin, s + i * 6); draw_a_central_star (lines_origin, s + i * 6);
//
// draw_a_central_star (lines_origin, s + 12 * 6); // W
// draw_a_central_star (lines_origin, s + 112 * 6); // E
// draw_a_central_star (lines_origin, s + 72 * 6); // Z
// draw_a_central_star (lines_origin, s + 52 * 6); // A
// draw_a_central_star (lines_origin, s + 60 * 6); // S
// draw_a_central_star (lines_origin, s + 64 * 6); // N
// draw_a_central_star (lines_origin, s + 24 * 6); // W
// draw_a_central_star (lines_origin, s + 318 * 6); // E
// draw_a_central_star (lines_origin, s + 192 * 6); // Z
// draw_a_central_star (lines_origin, s + 150 * 6); // A
// draw_a_central_star (lines_origin, s + 168 * 6); // S
// draw_a_central_star (lines_origin, s + 174 * 6); // N
printf("side = %d step_x = %d step_y = %d step_z = %d\n",\ printf("side = %d step_x = %d step_y = %d step_z = %d\n",\
cube_side, (cube_side + 1) * (cube_side + 1), cube_side + 1, 1); cube_side, (cube_side + 1) * (cube_side + 1), cube_side + 1, 1);
if (pref_test_diagonal) diagonal_test (cube_side, cube_side, cube_side, step_x, step_y, step_z, lines_origin);
printf(" Prochain objectif : dessiner les croix E, W, N, S, Z A puis EN, ES, etc.\n\
Puis dessiner toutes les croix limitant un voisinage de Moore 3D sphérique.\n");
return 0;
}
// S C O R I E S ---------------------------------------------------
/* ------------------------------------------------------------------------*/ /* ------------------------------------------------------------------------*/
/* 3 5 7 11 */ /* 3 5 7 11 */
/* ------------------------------------------------------------------------*/ /* ------------------------------------------------------------------------*/
@ -574,30 +546,7 @@ bool compute_space(int cube_side,
/* ZS 10 70 */
/*-------------------------------------------------------------*/
/* 13-4=7 63-12=51 */
// draw_line (lines_origin, 3500, 2422);// further experiments...
if (pref_test_diagonal) diagonal_test (cube_side, cube_side, cube_side, step_x, step_y, step_z, lines_origin);
printf(" Prochain objectif : dessiner les croix E, W, N, S, Z A puis EN, ES, etc.\n\
Puis dessiner toutes les croix limitant un voisinage de Moore 3D sphérique.\n");
return 0;
}
// S C O R I E S ---------------------------------------------------
/* static void draw_an_arrow_East_or_West (GLuint *lines_origin, int s, int weight, int site) */ /* static void draw_an_arrow_East_or_West (GLuint *lines_origin, int s, int weight, int site) */
/* { */ /* { */