WIP: un coeff. à régler et ça pourrait être bon !

This commit is contained in:
Jean Sirmai 2023-08-22 00:19:37 +02:00
parent 815362698d
commit 8f40a19a1f
Signed by: jean
GPG Key ID: FB3115C340E057E3
6 changed files with 33 additions and 54 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

View File

@ -1,15 +0,0 @@
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) ?

View File

@ -390,20 +390,20 @@ static void draw_EW_ZA_SN_in_a_cubic_space(GLuint *lines_origin, int coeff, int
/* Z-A C +/- side_size x f */
/* E-W C +/- side_size x side_size x f */
int step_z = 1, step_y = space_Z, step_x = space_Z * space_Y;
// coeff = step_z * space_Z + step_y * space_Y + step_x * space_X
// for (int i = 0; i < space_X * space_Y * space_Z; i ++) draw_a_central_star (lines_origin, coeff + i * 6);
// space_X = 9; space_Y = 7; space_Z = 11;
// space_X = 9; space_Y = 9; space_Z = 9;
int s = space_X * space_Y * space_Z / 2;
int z = space_Z / 2;
int y = z * space_Y;
int x = y * space_X;
// int z = space_Z / 2; int y = z * space_Y; int x = y * space_X;
draw_a_central_star (lines_origin, coeff + (s + x - 7) * 6 + 1); // W
draw_a_central_star (lines_origin, coeff + (s - x + 7) * 6 + 1); // E
draw_a_central_star (lines_origin, coeff + (s + y - 2) * 6 + 1); // Z
draw_a_central_star (lines_origin, coeff + (s - y + 2) * 6 + 1); // A
draw_a_central_star (lines_origin, coeff + (s + z + 0) * 6 + 1); // S
draw_a_central_star (lines_origin, coeff + (s - z - 0) * 6 + 1); // N
draw_a_central_star (lines_origin, coeff + (s + step_x) * 6 + 1); // W
draw_a_central_star (lines_origin, coeff + (s - step_x) * 6 + 1); // E
draw_a_central_star (lines_origin, coeff + (s + step_y) * 6 + 1); // Z
draw_a_central_star (lines_origin, coeff + (s - step_y) * 6 + 1); // A
draw_a_central_star (lines_origin, coeff + (s + step_z) * 6 + 1); // S
draw_a_central_star (lines_origin, coeff + (s - step_z) * 6 + 1); // N
}
static int draw_a_central_central_star(GLuint *lines_origin, int coeff, int volume)
@ -468,34 +468,28 @@ static float radius(int x, int y, int z, int space_X, int space_Y, int space_Z){
/* return 0; */
/* } */
static int experimental_1(GLuint *lines_origin,
int space_X, int space_Y, int space_Z, int step_x, int step_y)
static int experimental_1(GLuint *lines_origin, int space_X, int space_Y, int space_Z)
{
float r = 0.0f, limit = 1.0f;
int nb_in_neighborhood = 0, step_z = 1;
int coeff = space_X * space_Y * space_Z / 2;
float rayon = 0.0f, limit = 1.0f;
int nb_in_neighborhood = 0;
int center = space_X * space_Y * space_Z / 2;
int step_z = 1, step_y = space_Z, step_x = space_Z * space_Y;
int coeff = step_z * space_Z + step_y * space_Y + step_x * space_X;
printf("buffers : with limit = %3.1f, %d/%d neighboors, ",\
limit, nb_in_neighborhood, coeff * 2 + 1);
// int z = space_Z;
// int y = z * space_Z;
// int x = y * space_Y;
for (int i = 0; i < space_X; i++){
for (int j = 0; j < space_Y; j++){
for (int i = 0; i < space_X; i++)
for (int j = 0; j < space_Y; j++)
for (int k = 0; k < space_Z; k++){
r = radius(i, j, k, space_X, space_Y, space_Z);
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, coeff + u * 6 + delta,\
step_z * space_Z + step_y * space_Y + step_x * space_X);
return draw_a_central_star(lines_origin, coeff + u * 6 + delta );
rayon = radius(i, j, k, space_X, space_Y, space_Z);
if (rayon < limit){
int u = (i - space_X / 2) * step_x + (j - space_Y / 2) * step_y + (k - space_Z / 2) * step_z;
u = (i + 0) * step_x + (j + 0) * step_y + (k + 0) * step_z;
if (1) printf("%d*%d*%d rayon = %4.2f i,j,k = %2d,%2d,%2d \n",\
space_X, space_Y, space_Z, rayon, space_X / 2 - i, space_Y / 2 - j, space_Z / 2 - k);
draw_a_central_star(lines_origin, coeff + center + u * 6 + 12);
nb_in_neighborhood ++;
}
}
}
}
if (0) printf("buffers g: with limit = %3.1f, %d/%d neighboors, ", limit, nb_in_neighborhood, coeff * 2 + 1);
return 0;
}
@ -543,12 +537,12 @@ bool compute_space(int space_X, int space_Y, int space_Z,
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, 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 (1) ad_hoc = experimental_1(lines_origin, space_X, space_Y, space_Z);
if (0) draw_a_central_central_star (lines_origin, coeff, cubes_nb * 6 / 2 - 2);
if (0) 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 ] ",\
if (0) 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 (0) calcul(lines_origin, side_size, coeff);

View File

@ -550,9 +550,9 @@ GLuint arrows[] = {
static void get_model_data_and_user_preferences(){
space_X = 9; // 0 < space_X assert TODO
space_Y = 7; // 0 < space_Y assert TODO
space_Z = 11; // 0 < space_Z assert TODO
space_X = 3; // 0 < space_X assert TODO
space_Y = 3; // 0 < space_Y assert TODO
space_Z = 3; // 0 < space_Z assert TODO
cubes_nb = space_X * space_Y * space_Z;
pref_show_grid = 1; // 0, 1, 2, 3, 5, 6, 10, 15, 30, etc.
// xyz, 0, x, y, z, xy, xz, yz, xyz (repeat)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB