REF: Cube calcul centre et EW ZA SN (any size)

This commit is contained in:
Jean Sirmai 2023-08-14 17:38:16 +02:00
parent aac08f2a6a
commit 7d908a5468
Signed by: jean
GPG Key ID: FB3115C340E057E3
5 changed files with 57 additions and 25 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

View File

@ -44,7 +44,7 @@
static int vertex_index = 0;
static int colors_index = 0;
static int lines_index = 0;
static int plans_index = 0;
//static int plans_index = 0;
@ -101,8 +101,8 @@ static bool central_stars (int x, int y, int z,
float i, j, k, vx, vy, vz,
ad = 1 / max,
a_third = 0.3f * ad, // a_third donne la dimension de l'étoile centrale
eps = 0.1 * ad; // eps(ilon) servira à décaler légèrement les pointes des flèches
a_third = 0.3f * ad; // a_third donne la dimension de l'étoile centrale
// eps = 0.1 * ad; // eps(ilon) servira à décaler légèrement les pointes des flèches
// pour qu'elles n'aillent pas jusqu'aux faces des cubes
@ -352,9 +352,29 @@ static void draw_a_central_star_in_a_cubic_space(GLuint *lines_origin, int n, in
* 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)
{
/* N-S C +/- f */
/* Z-A C +/- side_size x f */
/* E-W C +/- side_size x side_size x f */
int s = side_size * side_size * side_size / 2;
int z = side_size / 2;
int y = z * side_size;
int x = y * side_size;
draw_a_central_star (lines_origin, n + (s + x) * 6); // W
draw_a_central_star (lines_origin, n + (s - x) * 6); // E
draw_a_central_star (lines_origin, n + (s + y) * 6); // Z
draw_a_central_star (lines_origin, n + (s - y) * 6); // A
draw_a_central_star (lines_origin, n + (s + z) * 6); // S
draw_a_central_star (lines_origin, n + (s - z) * 6); // N
}
// I'm standing on Earth (any planet or star or spinning spheroid, in fact)
// and looking towards its North pole
@ -386,6 +406,7 @@ bool compute_space(int cube_side,
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 */
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);
if (0) for (int i = 0; i < side_size * side_size * side_size; i ++)
draw_a_central_star (lines_origin, s + i * 6);
@ -396,30 +417,41 @@ bool compute_space(int cube_side,
// draw_a_central_star (lines_origin, s + 16 * 6); // Z
// draw_a_central_star (lines_origin, s + 22 * 6); // E
//
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 + 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",\
cube_side, (cube_side + 1) * (cube_side + 1), cube_side + 1, 1);
/* 3 5 7 11 */
/*-------------------------------------------------------------*/
/*------------------------------------------------------------------------*/
/* C 13 62 171 */
/* step_x 16 36 49 */
/* step_y 4 6 8 */
/* */
/*-------------------------------------------------------------*/
/* W 4 12 */
/* E 22 112 */
/* A 10 52 */
/* Z 16 72 */
/* S 12 60 */
/* N 14 64 */
/* step_y 4 6 8 */
/* |side/2| 1 (f) 2 3 4 */
/*------------------------------------------------------------------------*/
/* W 4 (- 9) 12 (- 50) 24 (- 147) */
/* E 22 (+ 9) 112 (+ 50) 318 (+ 147) */
/* A 10 (- 3) 52 (- 10) 150 (- 21) */
/* Z 16 (+ 3) 72 (+ 10) 192 (+ 21) */
/* S 12 (- 1) 60 (- 2) 168 (- 3) */
/* N 14 (+ 1) 64 (+ 2) 174 (+ 3) */
/*------------------------------------------------------------------------*/
/* N-S C +/- f */
/* Z-A C +/- side x f */
/* E-W C +/- side x side x f */
/* ZS 10 70 */
/*-------------------------------------------------------------*/

View File

@ -559,7 +559,7 @@ static void get_model_data_and_user_preferences(){
* JE CHOISIS DES CUBES AYANT DES COTÉS IMPAIRS POUR QU'IL Y AIT UNE CASE CENTRALE
*/
cube_side = 5; // 0 < cube_side
cube_side = 11; // 0 < cube_side
int arrows_array_size = 0;
while (*(arrows + arrows_array_size) != un_nombre_ad_hoc_que_je_mets_a_la_fin_du_tableau_pour_en_mesurer_la_taille)