WIP: Ouf ! Nettoyage Ok mais seulement cubes (pas X!=Y!=Z!=X) Allons déjeuner !
This commit is contained in:
parent
d8065ecf5f
commit
0e84388b80
|
@ -0,0 +1,15 @@
|
|||
x (x+1)(x+1) (x+1) 1 f(x) g(x)
|
||||
-----------------------------------------------------------
|
||||
3 16 4 1 149 3
|
||||
5 36 6 1 588 10
|
||||
7 64 8 1 1538 53
|
||||
9 100 10 1 3184 156
|
||||
11 144 12 1 5375 343
|
||||
13 196 14 1 9332 638
|
||||
15 256 16 1 14218 1065
|
||||
17 324 18 1 20568 1648
|
||||
19 400 20 1 28574 2411
|
||||
21 484 22 1 38428 3378
|
||||
|
||||
|
||||
Quelle est la fonction f(x) ?
|
|
@ -0,0 +1,33 @@
|
|||
// SI JE CALCULE LA POSITION D'UNE ÉTOILE CENTRALE EN FONCTION DE i, j, k
|
||||
// step_z = 1, step_y = space_Z + 1, step_x = (space_Z + 1) * (space_Y + 1)
|
||||
// s = step_z * space_Z + step_y * space_Y + step_x * space_X + 1
|
||||
// s + cubes_nb * 3 - 3
|
||||
// à (i * step_x + j * step_y + k * step_z) * 6,
|
||||
// JE DOIS RAJOUTER LA VALEUR DELTA
|
||||
|
||||
/* side step_x step_y step_z n delta */
|
||||
/* ---------------------------------------------------------- */
|
||||
/* 3 16 4 1 149 3 */
|
||||
/* 5 36 6 1 588 10 */
|
||||
/* 7 64 8 1 1538 53 */
|
||||
/* 9 100 10 1 3184 156 */
|
||||
/* 11 144 12 1 5375 343 */
|
||||
/* 13 196 14 1 9332 638 */
|
||||
/* 15 256 16 1 14218 1065 */
|
||||
/* 17 324 18 1 20568 1648 */
|
||||
/* 19 400 20 1 28574 2411 */
|
||||
/* 21 484 22 1 38428 3378 */
|
||||
|
||||
|
||||
/*
|
||||
s = step_z * space_Z + step_y * space_Y + step_x * space_X + 1
|
||||
draw_a_central_star (lines_origin, s + cubes_nb * 3 - 3);
|
||||
|
||||
static int draw_a_central_star(GLuint *lines_origin, int n)
|
||||
{
|
||||
draw_line (lines_origin, n + 0, n + 1);
|
||||
draw_line (lines_origin, n + 2, n + 3);
|
||||
draw_line (lines_origin, n + 4, n + 5);
|
||||
return n;
|
||||
}
|
||||
*/
|
|
@ -346,6 +346,8 @@ static void draw_3_x_4_around_6_poles(GLuint *lines_origin, int n, int side_size
|
|||
/* Z-A C +/- side_size x f */
|
||||
/* E-W C +/- side_size x side_size x f */
|
||||
|
||||
/* ! WARNING ! Chaque étoile est dessinée deux fois (je sais...) */
|
||||
|
||||
int s = side_size * side_size * side_size / 2;
|
||||
int z = side_size / 2;
|
||||
int y = z * side_size;
|
||||
|
@ -382,36 +384,37 @@ 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
|
||||
}
|
||||
|
||||
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 coeff, int space_X, int space_Y, int space_Z)
|
||||
{
|
||||
/* 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;
|
||||
// coeff = step_z * space_Z + step_y * space_Y + step_x * space_X
|
||||
int s = space_X * space_Y * space_Z / 2;
|
||||
int z = space_Z / 2;
|
||||
int y = z * space_Y;
|
||||
int x = y * space_X;
|
||||
|
||||
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
|
||||
draw_a_central_star (lines_origin, coeff + (s + x) * 6 + 1); // W
|
||||
draw_a_central_star (lines_origin, coeff + (s - x) * 6 + 1); // E
|
||||
draw_a_central_star (lines_origin, coeff + (s + y) * 6 + 1); // Z
|
||||
draw_a_central_star (lines_origin, coeff + (s - y) * 6 + 1); // A
|
||||
draw_a_central_star (lines_origin, coeff + (s + z) * 6 + 1); // S
|
||||
draw_a_central_star (lines_origin, coeff + (s - z) * 6 + 1); // N
|
||||
}
|
||||
|
||||
static int draw_a_central_central_star(GLuint *lines_origin, int s, int side_size)
|
||||
static int draw_a_central_central_star(GLuint *lines_origin, int coeff, int volume)
|
||||
{
|
||||
/* 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
|
||||
* LES CUBES / ou parallelepipèdes / ONT DES COTÉS IMPAIRS POUR QU'IL Y AIT UNE CASE CENTRALE
|
||||
*/
|
||||
int n = side_size * side_size * side_size / 2;
|
||||
// int n = side_size * side_size * side_size / 2;
|
||||
printf("draw_a_central_central_star > ");
|
||||
return draw_a_central_star(lines_origin, s + n * 6);
|
||||
return draw_a_central_star(lines_origin, coeff + volume);
|
||||
}
|
||||
|
||||
static float radius(int x, int y, int z, int space_X, int space_Y, int space_Z){
|
||||
|
@ -425,7 +428,7 @@ static float radius(int x, int y, int z, int space_X, int space_Y, int space_Z){
|
|||
// (1,2,2) (2,1,2) (2,2,1) (2,2,2) (2,2,3) (2,3,2) (3,2,2)
|
||||
|
||||
/* #define D 0 */
|
||||
/* static int draw_central_stars_in_neighbooring_cubes_verbose(GLuint *lines_origin, */
|
||||
/* static int experimental_1_verbose(GLuint *lines_origin, */
|
||||
/* int space_X, int space_Y, int space_Z, int step_x, int step_y) */
|
||||
/* { */
|
||||
/* float r = 0.0f, limit = 1.0f; */
|
||||
|
@ -463,15 +466,15 @@ static float radius(int x, int y, int z, int space_X, int space_Y, int space_Z){
|
|||
/* return 0; */
|
||||
/* } */
|
||||
|
||||
static int draw_central_stars_in_neighbooring_cubes(GLuint *lines_origin,
|
||||
static int experimental_1(GLuint *lines_origin,
|
||||
int space_X, int space_Y, int space_Z, int step_x, int step_y)
|
||||
{
|
||||
float r = 0.0f, limit = 1.0f;
|
||||
int nb_in_neighborhood = 0, step_z = 1;
|
||||
int s = space_X * space_Y * space_Z / 2;
|
||||
int coeff = space_X * space_Y * space_Z / 2;
|
||||
|
||||
printf("buffers : with limit = %3.1f, %d/%d neighboors, ",\
|
||||
limit, nb_in_neighborhood, s * 2 + 1);
|
||||
limit, nb_in_neighborhood, coeff * 2 + 1);
|
||||
|
||||
// int z = space_Z;
|
||||
// int y = z * space_Z;
|
||||
|
@ -483,9 +486,9 @@ static int draw_central_stars_in_neighbooring_cubes(GLuint *lines_origin,
|
|||
if (r < limit){ // 2.5f
|
||||
int u = i * step_x + j * step_y + k * step_z, delta = 3378;
|
||||
printf ("i(%d)*step_x + j(%d)*step_y + k(%d)*step_z = %d * 6 = %d delta = %d n = %d max/2 = %d",\
|
||||
i, j, k, u, u * 6, delta, s + u * 6 + delta,\
|
||||
i, j, k, u, u * 6, delta, coeff + u * 6 + delta,\
|
||||
step_z * space_Z + step_y * space_Y + step_x * space_X);
|
||||
return draw_a_central_star(lines_origin, s + u * 6 + delta );
|
||||
return draw_a_central_star(lines_origin, coeff + u * 6 + delta );
|
||||
nb_in_neighborhood ++;
|
||||
}
|
||||
}
|
||||
|
@ -507,13 +510,13 @@ static int draw_central_stars_in_neighbooring_cubes(GLuint *lines_origin,
|
|||
bool draw_some_arrows (GLuint *lines_origin, int s, int stx, int sty,
|
||||
GLuint *arrows, int arrows_nb) {return 1;}
|
||||
|
||||
static void calcul(GLuint *lines_origin, int cote, int s){
|
||||
static void calcul(GLuint *lines_origin, int cote, int coeff){
|
||||
int step_x = (cote + 1) * (cote + 1), step_y = cote + 1, step_z = 1;
|
||||
int essai = step_z * cote + step_y * cote + step_x * cote;
|
||||
int centre = cote * cote * cote * 3 - 3;
|
||||
printf("cote = %2d essai/2 = %3d <---> (cote)3* 3 - 3 = %3d\n",\
|
||||
cote, essai / 2, centre);
|
||||
draw_a_central_star (lines_origin, s + centre);
|
||||
draw_a_central_star (lines_origin, coeff + centre);
|
||||
}
|
||||
|
||||
bool compute_space(int space_X, int space_Y, int space_Z,
|
||||
|
@ -523,30 +526,30 @@ bool compute_space(int space_X, int space_Y, int space_Z,
|
|||
GLfloat *vertex_origin, GLfloat *colors_origin,
|
||||
GLuint *lines_origin, GLuint *plans_origin)
|
||||
{
|
||||
int cubes_nb = space_X * space_Y * space_Z;
|
||||
grids_intersections_volume (space_X, space_Y, space_Z, vertex_origin, colors_origin);
|
||||
central_stars (space_X, space_Y, space_Z, vertex_origin, colors_origin);
|
||||
centers (space_X, space_Y, space_Z, vertex_origin, colors_origin);
|
||||
int step_z = 1, step_y = space_Z + 1, step_x = (space_Z + 1) * (space_Y + 1);
|
||||
if (pref_show_grid > 0) draw_ridges_3D (space_X, space_Y, space_Z, step_x, step_y, step_z, lines_origin);
|
||||
draw_grids_3D(space_X, space_Y, space_Z, step_x, step_y, step_z, lines_origin, pref_show_grid);
|
||||
int s = step_z * space_Z + step_y * space_Y + step_x * space_X + 1;
|
||||
// if (pref_central_stars_nb == 1) draw_a_central_star (lines_origin, s + cubes_nb * 3 - 3);
|
||||
|
||||
int cubes_nb = space_X * space_Y * space_Z; // if ((space_X == space_Y) && (space_X == space_Z)) CUBE = 1;
|
||||
int coeff = step_z * space_Z + step_y * space_Y + step_x * space_X;
|
||||
int side_size = space_X, ad_hoc = 0, u = cubes_nb / 2 * 6;
|
||||
|
||||
|
||||
if (0 && pref_central_stars_nb == 1) draw_a_central_star (lines_origin, coeff + cubes_nb * 3 - 3);
|
||||
if (pref_central_stars_nb == cubes_nb)
|
||||
for (int i = 0; i < space_X * space_Y * space_Z; i ++) draw_a_central_star (lines_origin, s + i * 6);
|
||||
int CUBE = 0, side_size = 0;
|
||||
if ((space_X == space_Y) && (space_X == space_Z)) CUBE = 1;
|
||||
int ad_hoc = 0;
|
||||
if (CUBE) side_size = space_X; /* IF IT IS A CUBE, space_x = space_y = space_z */
|
||||
if (0) ad_hoc = draw_central_stars_in_neighbooring_cubes(lines_origin, space_X, space_Y, space_Z, step_x, step_y);
|
||||
if (0 && CUBE) draw_a_central_central_star (lines_origin, s, side_size);
|
||||
if (0 && CUBE) draw_EW_ZA_SN_in_a_cubic_space (lines_origin, s, side_size);
|
||||
if (0 && CUBE) draw_3_x_4_around_6_poles (lines_origin, s, side_size);
|
||||
int u = side_size * side_size * side_size / 2 * 6;
|
||||
printf(" DELTA = %d - %d = %d\nspace (%d x %d x %d) steps [ %d | %d | %d ] ",\
|
||||
s + u, ad_hoc, s + u - ad_hoc, space_X, space_Y, space_Z, step_x, step_y, step_z);
|
||||
for (int i = 0; i < space_X * space_Y * space_Z; i ++) draw_a_central_star (lines_origin, coeff + i * 6);
|
||||
if (0) ad_hoc = experimental_1(lines_origin, space_X, space_Y, space_Z, step_x, step_y);
|
||||
if (1) draw_a_central_central_star (lines_origin, coeff, cubes_nb * 6 / 2 - 2);
|
||||
if (1) draw_EW_ZA_SN_in_a_cubic_space (lines_origin, coeff, space_X, space_Y, space_Z);
|
||||
if (0) draw_3_x_4_around_6_poles (lines_origin, coeff, side_size);
|
||||
|
||||
printf(" DELTA = %d - %d = %d space (%d x %d x %d) steps [ %d | %d | %d ] ",\
|
||||
coeff + u, ad_hoc, coeff + u - ad_hoc, space_X, space_Y, space_Z, step_x, step_y, step_z);
|
||||
if (pref_test_diagonal) diagonal_test (space_X, space_Y, space_Z, step_x, step_y, step_z, lines_origin);
|
||||
if (1) calcul(lines_origin, side_size, s);
|
||||
if (0) calcul(lines_origin, side_size, coeff);
|
||||
if (0) printf(" >>> prochain objectif : dessiner un voisinage de Moore 3D sphérique.\n");
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -565,8 +565,8 @@ static void get_model_data_and_user_preferences(){
|
|||
pref_central_stars_nb = cubes_nb; // cubes_nb = max = space_X * space_Y * space_Z
|
||||
pref_central_stars_nb = 1 + 6 + 24;
|
||||
pref_central_stars_nb = 1 + 6;
|
||||
pref_central_stars_nb = 1;
|
||||
pref_central_stars_nb = 0;
|
||||
// pref_central_stars_nb = 1;
|
||||
|
||||
pref_test_diagonal = 0;
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 126 KiB |
Loading…
Reference in New Issue