WIP: Algorithme de calcul des adresses buffer lignes du centre d'un cube (i,j,k) -V0 Ok

This commit is contained in:
Jean Sirmai 2023-08-23 21:45:19 +02:00
parent 5858d9578c
commit 7211f7315d
Signed by: jean
GPG Key ID: FB3115C340E057E3
19 changed files with 104 additions and 8 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 230 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 240 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 243 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 256 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 248 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 241 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 240 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

View File

@ -1,3 +1,41 @@
step_z = 1, step_y = space_Z, step_x = space_Z * space_Y
x.y.z v(i,j,k) delta v = i * step_x + j * step_y + k * step_z
--------------------------------------------------------------------
1 0 5 = 2 + 3 -76 --100 = 24
3 13 66 = 5 + 61 -52 - -76 = 24
5 62 149 = 66 + 83 -28 - -52 = 24
7 171 236 = 149 + 87 -4 - -28 = 24
9 364 303 = 236 + 67 20 - -4 = 24
11 665 236 = 303 + 23 23 / ? = ? 44 - 20 = 24
13 1098 281 = 326 - 45 45 / 23 = 1,956521739 45 - -23 = 68 68 - 44 = 24
15 1687 144 = 281 - 137 137 / ? = ? 137 - 45 = 92 92 - 68 = 24
17 2456 -109 = 144 - 253 253 / 137 = 1,846715328 253 - 137 = 116 116 - 92 = 24
19 3429 -502 = -109 - 393 393 / 253 = 1,553359684 393 - 253 = 140 140 - 116 = 24
21 4630 -1059 = -502 - 557 557 / 393 = 1,417302799 557 - 393 = 164 164 - 140 = 24
23 6083 -1804 = -1059 - 745 745 / 557 = 1,337522442 745 - 557 = 188 188 - 164 = 24
25 7812 -2761 = -1804 - 957 957 / 745 = 1,284563758 957 - 745 = 212 212 - 188 = 24
27 9841 -3954 = -2761 - 1193 1193 / 957 = 1,246603971 1193 - 957 = 236 236 - 212 = 24
29 12194 -5407 = -3954 - 1453 1453 / 1193 = 1,217937972 1453 - 1193 = 260 260 - 236 = 24
31 14895 -7144 = -5407 - 1737 1737 / 1453 = 1,195457674 1737 - 1453 = 284 284 - 260 = 24
33 17968 -9189 = -7144 - 2045 2045 / 1737 = 1,177317214 2045 - 1737 = 308 308 - 284 = 24
35 21437 2377 - 2045 = 332 332 - 308 = 24
-------------------------------------------- --------------------------------------------
3 * 3 * 3 3 * 3 * 3
step_z * space_Z step_z * space_Z

55
resolu Normal file
View File

@ -0,0 +1,55 @@
delta = 2 + 3 + 61 + 83 + 87 + 67 + 23
- 45 - 137 - 253 - 393 - 557 - 745
- 957 - 1193 - 1453 - 1737 - 2045 - 2377
= - 11566
------------------------------------------
côté dérivée_1 dérivée_2
c (1) (d1) (d2)
------------------------------------------
1 . -76 --100 = 24
3 . -52 - -76 = 24
5 . -28 - -52 = 24
7 . -4 - -28 = 24
9 . 20 - -4 = 24
11 -23 . 44 - 20 = 24
13 45 - -23 = 68 68 - 44 = 24
15 137 - 45 = 92 92 - 68 = 24
17 253 - 137 = 116 116 - 92 = 24
19 393 - 253 = 140 140 - 116 = 24
21 557 - 393 = 164 164 - 140 = 24
23 745 - 557 = 188 188 - 164 = 24
25 957 - 745 = 212 212 - 188 = 24
27 1193 - 957 = 236 236 - 212 = 24
29 1453 - 1193 = 260 260 - 236 = 24
31 1737 - 1453 = 284 284 - 260 = 24
33 2045 - 1737 = 308 308 - 284 = 24
35 2377 - 2045 = 332 332 - 308 = 24
Pour calculer l'adresse mémoire des trois lignes
qui dessinnent l'étoile située au centre d'un cube
de côté 'c' il faut faire la somme des quatre termes :
- coeff_1 = step_z * space_Z + step_y * space_Y + step_x * space_X
- coeff_2 = (i * step_x + j * step_y + k * step_z) * 6
- center = space_X * space_Y * space_Z / 2 et
- delta = sigma (de 1 à c) des termes de la colonne 1
draw_a_central_star (lines_origin, coeff_1 + center + coeff_2 + delta)
static void 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);
}
static void draw_line (GLuint *lines_origin, int a, int b)
{
*(lines_origin + lines_index) = a; lines_index ++;
*(lines_origin + lines_index) = b; lines_index ++;
}
On calcule le dernier terme de 'delta' en connaissant
sa différence avec le terme précédent de la colonne (1).
On calcule cette différence (d1) en ajoutant 24
au terme précédent de la colonne (d1).

View File

@ -434,20 +434,23 @@ static void experimental_1(GLuint *lines_origin, int space_X, int space_Y, int
int cubes_nb = space_X * space_Y * space_Z, center = cubes_nb / 2; int cubes_nb = space_X * space_Y * space_Z, center = cubes_nb / 2;
int step_z = 1, step_y = space_Z, step_x = space_Z * space_Y; 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; int coeff = step_z * space_Z + step_y * space_Y + step_x * space_X;
int u = 0, v = 0, delta = 3 + 2; int u = 0, v = 0,
if (1) printf("space_XYZ (%d*%d*%d) step_xyz (%d,%d,%d) coeff = %d = step_z * space_Z + step_y * space_Y + step_x * space_X\n",\ delta = 3 + 2 + 61 + 83 + 87 + 67 + 23 - 45 - 137 - 253 - 393 - 557 - 745 - 957 - 1193 - 1453 - 1737 - 2045 - 2377;
delta -= 0;
if (1) printf("space_XYZ (%d*%d*%d) steps_xyz (%d,%d,%d) coeff = %d = step_z * space_Z + step_y * space_Y + step_x * space_X\n",\
space_X, space_Y, space_Z, step_x, step_y, step_z, coeff); space_X, space_Y, space_Z, step_x, step_y, step_z, coeff);
for (int i = 0; i < space_X; i++) for (int i = 0; i < space_X; i++)
for (int j = 0; j < space_Y; j++) for (int j = 0; j < space_Y; j++)
for (int k = 0; k < space_Z; k++){ for (int k = 0; k < space_Z; k++){
rayon = radius(i, j, k, space_X, space_Y, space_Z); rayon = radius(i, j, k, space_X, space_Y, space_Z);
if (rayon < limit_sup && rayon > limit_inf){ if (rayon < limit_sup && rayon >= limit_inf){
u = (i - space_X / 2) * step_x + (j - space_Y / 2) * step_y + (k - space_Z / 2) * step_z; u = (i - space_X / 2) * step_x + (j - space_Y / 2) * step_y + (k - space_Z / 2) * step_z;
v = i * step_x + j * step_y + k * step_z; v = i * step_x + j * step_y + k * step_z;
if (1) printf("i,j,k =%2d,%2d,%2d v = %d u = %d\n", space_X / 2 - i, space_Y / 2 - j, space_Z / 2 - k, v, u); if (1) printf("i,j,k =%2d,%2d,%2d v = %4d u = %4d\n", space_X / 2 - i, space_Y / 2 - j, space_Z / 2 - k, v, u);
if (1) draw_a_central_star(lines_origin, coeff + center + v * 6 + delta); if (1) draw_a_central_star(lines_origin, coeff + center + v * 6 + delta);
if (0) draw_a_central_star(lines_origin, coeff + cubes_nb * 6 / 2 + 2); if (0) draw_a_central_star(lines_origin, coeff + cubes_nb * 6 / 2 + 2);

View File

@ -552,9 +552,9 @@ GLuint arrows[] = {
static void get_model_data_and_user_preferences(){ static void get_model_data_and_user_preferences(){
space_X = 1; // 0 < space_X assert TODO space_X = 35; // 0 < space_X assert TODO
space_Y = 1; // 0 < space_Y assert TODO space_Y = 35; // 0 < space_Y assert TODO
space_Z = 1; // 0 < space_Z assert TODO space_Z = 35; // 0 < space_Z assert TODO
cubes_nb = space_X * space_Y * space_Z; cubes_nb = space_X * space_Y * space_Z;
pref_show_grid = 1; // 0, 1, 2, 3, 5, 6, 10, 15, 30, etc. pref_show_grid = 1; // 0, 1, 2, 3, 5, 6, 10, 15, 30, etc.
// xyz, 0, x, y, z, xy, xz, yz, xyz (repeat) // xyz, 0, x, y, z, xy, xz, yz, xyz (repeat)
@ -565,7 +565,7 @@ static void get_model_data_and_user_preferences(){
// par space_size_x, y, z et le nombre de sites // par space_size_x, y, z et le nombre de sites
// >>> assert TODO // >>> assert TODO
pref_central_stars_nb = cubes_nb; // cubes_nb = max = space_X * space_Y * space_Z pref_central_stars_nb = cubes_nb; // cubes_nb = max = space_X * space_Y * space_Z
pref_central_stars_nb = 1 + 6 + 24 + 6 + 6 + 24 + 70; pref_central_stars_nb = 1 + 6 + 24;
pref_central_stars_nb = 1 + 6; pref_central_stars_nb = 1 + 6;
pref_central_stars_nb = 1; pref_central_stars_nb = 1;