WIP: ça suffit pour ce soir --- une double boucle est OK. Y a plus qu'à copier...
This commit is contained in:
parent
0870df7ff1
commit
2dd9b88dba
|
@ -43,3 +43,4 @@ bool compute_space_and_arrows(int model_space_size_x,
|
||||||
GLubyte *plan_origin);
|
GLubyte *plan_origin);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 190 KiB |
|
@ -61,9 +61,9 @@ int plans_ndx = 0;
|
||||||
#define C 0
|
#define C 0
|
||||||
#define P 0
|
#define P 0
|
||||||
|
|
||||||
static bool compute_space_2D(int space_size_x,
|
static bool compute_space_2D(int size_x,
|
||||||
int space_size_y,
|
int size_y,
|
||||||
int space_size_z,
|
int size_z,
|
||||||
|
|
||||||
int pref_mark_unit_space,
|
int pref_mark_unit_space,
|
||||||
int pref_style_lines_planes,
|
int pref_style_lines_planes,
|
||||||
|
@ -76,27 +76,27 @@ static bool compute_space_2D(int space_size_x,
|
||||||
{
|
{
|
||||||
|
|
||||||
float x = 0;
|
float x = 0;
|
||||||
// for (int k = 0; k < space_size_x + 1; k++) <=> + 1
|
// for (int k = 0; k < size_x + 1; k++) <=> + 1
|
||||||
// car on passe du nombre de cases = (n)
|
// car on passe du nombre de cases = (n)
|
||||||
// au nombre de séparations entre les cases + les deux bords = (n + 1)
|
// au nombre de séparations entre les cases + les deux bords = (n + 1)
|
||||||
|
|
||||||
if (S) printf("space_2D vertex ");
|
if (S) printf("space_2D vertex ");
|
||||||
for (int k = 0; k < space_size_x; k++){ // barres verticales
|
for (int k = 0; k < size_x; k++){ // barres verticales
|
||||||
//
|
//
|
||||||
x = ((space_size_x % 2) * (space_size_x / 2 - k)
|
x = ((size_x % 2) * (size_x / 2 - k)
|
||||||
+ (space_size_x % 2 - 1) * (k + 0.5f - space_size_x / 2)) / space_size_x * 2 * EDGE;
|
+ (size_x % 2 - 1) * (k + 0.5f - size_x / 2)) / size_x * 2 * EDGE;
|
||||||
|
|
||||||
if (S) printf("[%1.1f] ", x);
|
if (S) printf("[%1.1f] ", x);
|
||||||
|
|
||||||
*(vertex_origin + k * 6 + 0) = - x;
|
*(vertex_origin + k * 6 + 0) = - x;
|
||||||
*(vertex_origin + k * 6 + 1) = 1.0f / space_size_x;
|
*(vertex_origin + k * 6 + 1) = 1.0f / size_x;
|
||||||
*(vertex_origin + k * 6 + 2) = 0.0f;
|
*(vertex_origin + k * 6 + 2) = 0.0f;
|
||||||
|
|
||||||
*(vertex_origin + k * 6 + 3) = - x;
|
*(vertex_origin + k * 6 + 3) = - x;
|
||||||
*(vertex_origin + k * 6 + 4) = - 1.0f / space_size_x;
|
*(vertex_origin + k * 6 + 4) = - 1.0f / size_x;
|
||||||
*(vertex_origin + k * 6 + 5) = 0.0f;
|
*(vertex_origin + k * 6 + 5) = 0.0f;
|
||||||
|
|
||||||
// fun > if (k == space_size_x - 1) *(vertex_origin + k * 6 + 5) = 0.1f;
|
// fun > if (k == size_x - 1) *(vertex_origin + k * 6 + 5) = 0.1f;
|
||||||
|
|
||||||
vertex_ndx += 6; if (V) printf(" => vertex_ndx = %3d space 2D\n", vertex_ndx);
|
vertex_ndx += 6; if (V) printf(" => vertex_ndx = %3d space 2D\n", vertex_ndx);
|
||||||
|
|
||||||
|
@ -124,21 +124,21 @@ static bool compute_space_2D(int space_size_x,
|
||||||
*(color_origin + 4) = 1;
|
*(color_origin + 4) = 1;
|
||||||
*(color_origin + 5) = 1;
|
*(color_origin + 5) = 1;
|
||||||
|
|
||||||
*(color_origin + (space_size_x - 1) * 6 + 0) = 1;
|
*(color_origin + (size_x - 1) * 6 + 0) = 1;
|
||||||
*(color_origin + (space_size_x - 1) * 6 + 1) = 1;
|
*(color_origin + (size_x - 1) * 6 + 1) = 1;
|
||||||
*(color_origin + (space_size_x - 1) * 6 + 2) = 1;
|
*(color_origin + (size_x - 1) * 6 + 2) = 1;
|
||||||
|
|
||||||
*(color_origin + (space_size_x - 1) * 6 + 3) = 0;
|
*(color_origin + (size_x - 1) * 6 + 3) = 0;
|
||||||
*(color_origin + (space_size_x - 1) * 6 + 4) = 0;
|
*(color_origin + (size_x - 1) * 6 + 4) = 0;
|
||||||
*(color_origin + (space_size_x - 1) * 6 + 5) = 0;
|
*(color_origin + (size_x - 1) * 6 + 5) = 0;
|
||||||
|
|
||||||
colors_ndx += 12; if (C) printf(" => colors_ndx = %d\n", colors_ndx);
|
colors_ndx += 12; if (C) printf(" => colors_ndx = %d\n", colors_ndx);
|
||||||
|
|
||||||
*(line_origin + lines_ndx + 0) = 0;
|
*(line_origin + lines_ndx + 0) = 0;
|
||||||
*(line_origin + lines_ndx + 1) = space_size_x * 2 - 2; // barre horizontale du bas
|
*(line_origin + lines_ndx + 1) = size_x * 2 - 2; // barre horizontale du bas
|
||||||
|
|
||||||
*(line_origin + lines_ndx + 2) = 1;
|
*(line_origin + lines_ndx + 2) = 1;
|
||||||
*(line_origin + lines_ndx + 3) = space_size_x * 2 - 1; // barre horizontale du haut
|
*(line_origin + lines_ndx + 3) = size_x * 2 - 1; // barre horizontale du haut
|
||||||
|
|
||||||
lines_ndx += 4; if (L) printf("H=> lines_ndx = %3d space 2D H\n", lines_ndx);
|
lines_ndx += 4; if (L) printf("H=> lines_ndx = %3d space 2D H\n", lines_ndx);
|
||||||
|
|
||||||
|
@ -156,29 +156,29 @@ static bool compute_space_2D(int space_size_x,
|
||||||
|
|
||||||
if (pref_mark_unit_space == 2 || pref_mark_unit_space == 3) // diagonales to mark last space unit
|
if (pref_mark_unit_space == 2 || pref_mark_unit_space == 3) // diagonales to mark last space unit
|
||||||
{
|
{
|
||||||
*(line_origin + lines_ndx + 0) = (space_size_x - 2) * 2 + 0;
|
*(line_origin + lines_ndx + 0) = (size_x - 2) * 2 + 0;
|
||||||
*(line_origin + lines_ndx + 1) = (space_size_x - 2) * 2 + 3;
|
*(line_origin + lines_ndx + 1) = (size_x - 2) * 2 + 3;
|
||||||
|
|
||||||
*(line_origin + lines_ndx + 2) = (space_size_x - 2) * 2 + 1;
|
*(line_origin + lines_ndx + 2) = (size_x - 2) * 2 + 1;
|
||||||
*(line_origin + lines_ndx + 3) = (space_size_x - 2) * 2 + 2;
|
*(line_origin + lines_ndx + 3) = (size_x - 2) * 2 + 2;
|
||||||
|
|
||||||
lines_ndx +=4; if (L) printf("X=> lines_ndx = %3d space 2D X\n", lines_ndx);
|
lines_ndx +=4; if (L) printf("X=> lines_ndx = %3d space 2D X\n", lines_ndx);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (S) printf(" n = %d x 2 côté = [%1.1f]\n", space_size_x + 1, 2.0f / space_size_x);
|
if (S) printf(" n = %d x 2 côté = [%1.1f]\n", size_x + 1, 2.0f / size_x);
|
||||||
if (S) printf("space_2D line_origin (%d - space_size_x(0)) x (%d - space_size_x(1)) ", 0, 1);
|
if (S) printf("space_2D line_origin (%d - size_x(0)) x (%d - size_x(1)) ", 0, 1);
|
||||||
for (int v = 0; v < space_size_x + 2; v++)
|
for (int v = 0; v < size_x + 2; v++)
|
||||||
if (S) printf("(%d-%d) ", *(line_origin + v), *(line_origin + v + 1));
|
if (S) printf("(%d-%d) ", *(line_origin + v), *(line_origin + v + 1));
|
||||||
if (S) printf(" n = 4 + (%d x 2)\n", space_size_x + 2);
|
if (S) printf(" n = 4 + (%d x 2)\n", size_x + 2);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define A2 1
|
#define A2 1
|
||||||
static int compute_arrow_2D(int space_size_x,
|
static int compute_arrow_2D(int size_x,
|
||||||
int space_size_y,
|
int size_y,
|
||||||
int space_size_z,
|
int size_z,
|
||||||
|
|
||||||
int weight,
|
int weight,
|
||||||
int site,
|
int site,
|
||||||
|
@ -196,22 +196,22 @@ static int compute_arrow_2D(int space_size_x,
|
||||||
{
|
{
|
||||||
printf("compute_arrow_2D load = %d site = %d x = %d\n", weight, site, x);
|
printf("compute_arrow_2D load = %d site = %d x = %d\n", weight, site, x);
|
||||||
float zero = 0.0f;
|
float zero = 0.0f;
|
||||||
float center = (1.0f / space_size_x) * (2 * x - space_size_x + 2);
|
float center = (1.0f / size_x) * (2 * x - size_x + 2);
|
||||||
float tip = center + (2 * site - 1) * (1.0f / space_size_x - 0.01f);
|
float tip = center + (2 * site - 1) * (1.0f / size_x - 0.01f);
|
||||||
float base = center + (2 * site - 1) * (0.1f / space_size_x);
|
float base = center + (2 * site - 1) * (0.1f / size_x);
|
||||||
float lat = 0.4f / space_size_x;
|
float lat = 0.4f / size_x;
|
||||||
|
|
||||||
/* for (int i = 0; i < space_size_x; i++) */
|
/* for (int i = 0; i < size_x; i++) */
|
||||||
/* for (int j = 0; j < space_size_y; j++) */
|
/* for (int j = 0; j < size_y; j++) */
|
||||||
/* for (int k = 0; k < space_size_z; k++) */
|
/* for (int k = 0; k < size_z; k++) */
|
||||||
/* { */
|
/* { */
|
||||||
|
|
||||||
/* x = - ((space_size_x % 2) * (space_size_x / 2 - i) */
|
/* x = - ((size_x % 2) * (size_x / 2 - i) */
|
||||||
/* - (space_size_x % 2 - 1) * (i + 0.5f - space_size_x / 2)) / space_size_x * 2 * EDGE; */
|
/* - (size_x % 2 - 1) * (i + 0.5f - size_x / 2)) / size_x * 2 * EDGE; */
|
||||||
/* y = - ((space_size_x % 2) * (space_size_x / 2 - j) */
|
/* y = - ((size_x % 2) * (size_x / 2 - j) */
|
||||||
/* - (space_size_x % 2 - 1) * (j + 0.5f - space_size_x / 2)) / space_size_x * 2 * EDGE; */
|
/* - (size_x % 2 - 1) * (j + 0.5f - size_x / 2)) / size_x * 2 * EDGE; */
|
||||||
/* z = - ((space_size_x % 2) * (space_size_x / 2 - k) */
|
/* z = - ((size_x % 2) * (size_x / 2 - k) */
|
||||||
/* - (space_size_x % 2 - 1) * (k + 0.5f - space_size_x / 2)) / space_size_x * 2 * EDGE; */
|
/* - (size_x % 2 - 1) * (k + 0.5f - size_x / 2)) / size_x * 2 * EDGE; */
|
||||||
/* } */
|
/* } */
|
||||||
|
|
||||||
*(vertex_origin + vertex_ndx + 0) = tip;
|
*(vertex_origin + vertex_ndx + 0) = tip;
|
||||||
|
@ -259,12 +259,12 @@ static int compute_arrow_2D(int space_size_x,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* x = - ((space_size_x % 2) * (space_size_x / 2 - i) */
|
/* x = - ((size_x % 2) * (size_x / 2 - i) */
|
||||||
/* - (space_size_x % 2 - 1) * (i + 0.5f - space_size_x / 2)) / space_size_x * 2 * EDGE; */
|
/* - (size_x % 2 - 1) * (i + 0.5f - size_x / 2)) / size_x * 2 * EDGE; */
|
||||||
/* y = - ((space_size_y % 2) * (space_size_y / 2 - j) */
|
/* y = - ((size_y % 2) * (size_y / 2 - j) */
|
||||||
/* - (space_size_y % 2 - 1) * (j + 0.5f - space_size_y / 2)) / space_size_y * 2 * EDGE; */
|
/* - (size_y % 2 - 1) * (j + 0.5f - size_y / 2)) / size_y * 2 * EDGE; */
|
||||||
/* z = - ((space_size_z % 2) * (space_size_z / 2 - k) */
|
/* z = - ((size_z % 2) * (size_z / 2 - k) */
|
||||||
/* - (space_size_z % 2 - 1) * (k + 0.5f - space_size_z / 2)) / space_size_z * 2 * EDGE; */
|
/* - (size_z % 2 - 1) * (k + 0.5f - size_z / 2)) / size_z * 2 * EDGE; */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -293,9 +293,9 @@ static int compute_arrow_2D(int space_size_x,
|
||||||
#define CORRC 1.3
|
#define CORRC 1.3
|
||||||
#define P 0
|
#define P 0
|
||||||
|
|
||||||
static bool compute_space_3D (int space_size_x,
|
static bool compute_space_3D (int size_x,
|
||||||
int space_size_y,
|
int size_y,
|
||||||
int space_size_z,
|
int size_z,
|
||||||
|
|
||||||
int pref_mark_unit_space,
|
int pref_mark_unit_space,
|
||||||
int pref_style_lines_planes,
|
int pref_style_lines_planes,
|
||||||
|
@ -306,23 +306,23 @@ static bool compute_space_3D (int space_size_x,
|
||||||
GLubyte *line_origin,
|
GLubyte *line_origin,
|
||||||
GLubyte *plan_origin)
|
GLubyte *plan_origin)
|
||||||
{
|
{
|
||||||
int maximum = 0, c = 0; // TODO max = math.max(max, space_size_x);
|
int maximum = 0, c = 0; // TODO max = math.max(max, size_x);
|
||||||
for (c = 0; c <= space_size_x; c++) if (c > maximum) maximum = c;
|
for (c = 0; c <= size_x; c++) if (c > maximum) maximum = c;
|
||||||
for (c = 0; c <= space_size_y; c++) if (c > maximum) maximum = c;
|
for (c = 0; c <= size_y; c++) if (c > maximum) maximum = c;
|
||||||
for (c = 0; c <= space_size_z; c++) if (c > maximum) maximum = c;
|
for (c = 0; c <= size_z; c++) if (c > maximum) maximum = c;
|
||||||
|
|
||||||
float i, j, k, x, y, z, max = maximum * CORRC;
|
float i, j, k, x, y, z, max = maximum * CORRC;
|
||||||
|
|
||||||
printf("max(%d,%d,%d) = %d; size_x / max = %6.3f; size_y / max = %6.3f; size_z / max = %6.3f\n",\
|
printf("max(%d,%d,%d) = %d; size_x / max = %6.3f; size_y / max = %6.3f; size_z / max = %6.3f\n",\
|
||||||
space_size_x, space_size_y, space_size_z, maximum, space_size_x / max, space_size_y / max, space_size_z / max);
|
size_x, size_y, size_z, maximum, size_x / max, size_y / max, size_z / max);
|
||||||
|
|
||||||
for (i = 0; i <= space_size_x; i++){
|
for (i = 0; i <= size_x; i++){
|
||||||
for (j = 0; j <= space_size_y; j++){
|
for (j = 0; j <= size_y; j++){
|
||||||
for (k = 0; k <= space_size_z; k++){
|
for (k = 0; k <= size_z; k++){
|
||||||
|
|
||||||
x = (2 * i / space_size_x - 1) * (space_size_x / max);
|
x = (2 * i / size_x - 1) * (size_x / max);
|
||||||
y = (2 * j / space_size_y - 1) * (space_size_y / max);
|
y = (2 * j / size_y - 1) * (size_y / max);
|
||||||
z = (2 * k / space_size_z - 1) * (space_size_z / max);
|
z = (2 * k / size_z - 1) * (size_z / max);
|
||||||
|
|
||||||
*(vertex_origin + vertex_ndx + 0) = x / 2;
|
*(vertex_origin + vertex_ndx + 0) = x / 2;
|
||||||
*(vertex_origin + vertex_ndx + 1) = y;
|
*(vertex_origin + vertex_ndx + 1) = y;
|
||||||
|
@ -345,59 +345,19 @@ static bool compute_space_3D (int space_size_x,
|
||||||
if (P) printf("\n");
|
if (P) printf("\n");
|
||||||
};
|
};
|
||||||
|
|
||||||
for (int u = 0; u < (space_size_x + 1) * (space_size_y + 1); u ++){
|
for (int u = 0; u < (size_x + 1) * (size_y + 1); u ++){ // << cette boucle est à remplacer, sur le modèle de la suivante.
|
||||||
*(line_origin + lines_ndx) = u * (space_size_z + 1);
|
*(line_origin + lines_ndx) = u * (size_z + 1);
|
||||||
lines_ndx += 1;
|
lines_ndx += 1;
|
||||||
*(line_origin + lines_ndx) = u * (space_size_z + 1) + 1;
|
*(line_origin + lines_ndx) = u * (size_z + 1) + size_z;
|
||||||
lines_ndx += 1;
|
lines_ndx += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
*(line_origin + lines_ndx) = 0; lines_ndx += 1;
|
for (int u = 0; u <= size_x; u ++){
|
||||||
*(line_origin + lines_ndx) = 18; lines_ndx += 1;
|
for (int w = 0; w < size_y; w ++){
|
||||||
|
*(line_origin + lines_ndx) = (size_z + 1) * (size_y + 1) * u + w; lines_ndx += 1;
|
||||||
*(line_origin + lines_ndx) = 2; lines_ndx += 1;
|
*(line_origin + lines_ndx) = (size_z + 1) * (size_y + 1) * u + (size_z + 1) * size_y + w; lines_ndx += 1;
|
||||||
*(line_origin + lines_ndx) = 20; lines_ndx += 1;
|
}
|
||||||
|
}
|
||||||
*(line_origin + lines_ndx) = 4; lines_ndx += 1;
|
|
||||||
*(line_origin + lines_ndx) = 22; lines_ndx += 1;
|
|
||||||
|
|
||||||
|
|
||||||
*(line_origin + lines_ndx) = 1; lines_ndx += 1;
|
|
||||||
*(line_origin + lines_ndx) = 19; lines_ndx += 1;
|
|
||||||
|
|
||||||
*(line_origin + lines_ndx) = 3; lines_ndx += 1;
|
|
||||||
*(line_origin + lines_ndx) = 21; lines_ndx += 1;
|
|
||||||
|
|
||||||
*(line_origin + lines_ndx) = 5; lines_ndx += 1;
|
|
||||||
*(line_origin + lines_ndx) = 23; lines_ndx += 1;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
*(line_origin + lines_ndx) = 0; lines_ndx += 1;
|
|
||||||
*(line_origin + lines_ndx) = 4; lines_ndx += 1;
|
|
||||||
|
|
||||||
*(line_origin + lines_ndx) = 1; lines_ndx += 1;
|
|
||||||
*(line_origin + lines_ndx) = 5; lines_ndx += 1;
|
|
||||||
|
|
||||||
*(line_origin + lines_ndx) = 6; lines_ndx += 1;
|
|
||||||
*(line_origin + lines_ndx) = 10; lines_ndx += 1;
|
|
||||||
|
|
||||||
*(line_origin + lines_ndx) = 7; lines_ndx += 1;
|
|
||||||
*(line_origin + lines_ndx) = 11; lines_ndx += 1;
|
|
||||||
|
|
||||||
|
|
||||||
*(line_origin + lines_ndx) = 12; lines_ndx += 1;
|
|
||||||
*(line_origin + lines_ndx) = 16; lines_ndx += 1;
|
|
||||||
|
|
||||||
*(line_origin + lines_ndx) = 13; lines_ndx += 1;
|
|
||||||
*(line_origin + lines_ndx) = 17; lines_ndx += 1;
|
|
||||||
|
|
||||||
*(line_origin + lines_ndx) = 18; lines_ndx += 1;
|
|
||||||
*(line_origin + lines_ndx) = 22; lines_ndx += 1;
|
|
||||||
|
|
||||||
*(line_origin + lines_ndx) = 19; lines_ndx += 1;
|
|
||||||
*(line_origin + lines_ndx) = 23; lines_ndx += 1;
|
|
||||||
|
|
||||||
|
|
||||||
//if (S3) printf("space 3D buffer_lines (from-to) ");
|
//if (S3) printf("space 3D buffer_lines (from-to) ");
|
||||||
printf("nb lines / nb vertex = %d/%d ", lines_ndx / 2, vertex_ndx / 3);
|
printf("nb lines / nb vertex = %d/%d ", lines_ndx / 2, vertex_ndx / 3);
|
||||||
|
@ -441,9 +401,9 @@ static bool compute_space_3D (int space_size_x,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static bool compute_arrow_3D(int space_size_x,
|
static bool compute_arrow_3D(int size_x,
|
||||||
int space_size_y,
|
int size_y,
|
||||||
int space_size_z,
|
int size_z,
|
||||||
|
|
||||||
int weight,
|
int weight,
|
||||||
int site,
|
int site,
|
||||||
|
@ -461,34 +421,34 @@ static bool compute_space_3D (int space_size_x,
|
||||||
|
|
||||||
{
|
{
|
||||||
float zero = 0.0f;
|
float zero = 0.0f;
|
||||||
float center = (1.0f / space_size_x) * (2 * x - space_size_x + 2);
|
float center = (1.0f / size_x) * (2 * x - size_x + 2);
|
||||||
float tip = center + (2 * site - 1) * (1.0f / space_size_x);
|
float tip = center + (2 * site - 1) * (1.0f / size_x);
|
||||||
float base = center + (2 * site - 1) * (0.1f / space_size_x);
|
float base = center + (2 * site - 1) * (0.1f / size_x);
|
||||||
|
|
||||||
*(vertex_origin + vertex_ndx + 0) = center + (2 * site - 1) * (1.0f / space_size_x - 0.01f);
|
*(vertex_origin + vertex_ndx + 0) = center + (2 * site - 1) * (1.0f / size_x - 0.01f);
|
||||||
*(vertex_origin + vertex_ndx + 1) = zero;
|
*(vertex_origin + vertex_ndx + 1) = zero;
|
||||||
*(vertex_origin + vertex_ndx + 2) = zero;
|
*(vertex_origin + vertex_ndx + 2) = zero;
|
||||||
|
|
||||||
*(vertex_origin + vertex_ndx + 3) = base;
|
*(vertex_origin + vertex_ndx + 3) = base;
|
||||||
*(vertex_origin + vertex_ndx + 4) = 0.4f / space_size_x;
|
*(vertex_origin + vertex_ndx + 4) = 0.4f / size_x;
|
||||||
*(vertex_origin + vertex_ndx + 5) = 0.4f / space_size_x;
|
*(vertex_origin + vertex_ndx + 5) = 0.4f / size_x;
|
||||||
|
|
||||||
*(vertex_origin + vertex_ndx + 6) = base;
|
*(vertex_origin + vertex_ndx + 6) = base;
|
||||||
*(vertex_origin + vertex_ndx + 7) = 0.4f / space_size_x;
|
*(vertex_origin + vertex_ndx + 7) = 0.4f / size_x;
|
||||||
*(vertex_origin + vertex_ndx + 8) = - 0.4f / space_size_x;
|
*(vertex_origin + vertex_ndx + 8) = - 0.4f / size_x;
|
||||||
|
|
||||||
*(vertex_origin + vertex_ndx + 9) = base;
|
*(vertex_origin + vertex_ndx + 9) = base;
|
||||||
*(vertex_origin + vertex_ndx + 10) = - 0.4f / space_size_x;
|
*(vertex_origin + vertex_ndx + 10) = - 0.4f / size_x;
|
||||||
*(vertex_origin + vertex_ndx + 11) = - 0.4f / space_size_x;
|
*(vertex_origin + vertex_ndx + 11) = - 0.4f / size_x;
|
||||||
|
|
||||||
*(vertex_origin + vertex_ndx + 12) = base;
|
*(vertex_origin + vertex_ndx + 12) = base;
|
||||||
*(vertex_origin + vertex_ndx + 13) = - 0.4f / space_size_x;
|
*(vertex_origin + vertex_ndx + 13) = - 0.4f / size_x;
|
||||||
*(vertex_origin + vertex_ndx + 14) = 0.4f / space_size_x;
|
*(vertex_origin + vertex_ndx + 14) = 0.4f / size_x;
|
||||||
|
|
||||||
vertex_ndx += 15; if (V) printf(" => vertex_ndx = %3d arrow_3D\n", vertex_ndx);
|
vertex_ndx += 15; if (V) printf(" => vertex_ndx = %3d arrow_3D\n", vertex_ndx);
|
||||||
|
|
||||||
if (A3) printf("center = %f tip = %f base = %f\n",\
|
if (A3) printf("center = %f tip = %f base = %f\n",\
|
||||||
center, tip, base); // space_size_x * 12=%d igap=%d
|
center, tip, base); // size_x * 12=%d igap=%d
|
||||||
|
|
||||||
if (pref_style_lines_planes == 0) {
|
if (pref_style_lines_planes == 0) {
|
||||||
|
|
||||||
|
@ -521,21 +481,21 @@ static bool compute_space_3D (int space_size_x,
|
||||||
|
|
||||||
if (pref_style_lines_planes == 1) {
|
if (pref_style_lines_planes == 1) {
|
||||||
|
|
||||||
*(plan_origin + plans_ndx + 0) = space_size_x * 12 / 3 + 0;
|
*(plan_origin + plans_ndx + 0) = size_x * 12 / 3 + 0;
|
||||||
*(plan_origin + plans_ndx + 1) = space_size_x * 12 / 3 + 1;
|
*(plan_origin + plans_ndx + 1) = size_x * 12 / 3 + 1;
|
||||||
*(plan_origin + plans_ndx + 2) = space_size_x * 12 / 3 + 2;
|
*(plan_origin + plans_ndx + 2) = size_x * 12 / 3 + 2;
|
||||||
|
|
||||||
*(plan_origin + plans_ndx + 3) = space_size_x * 12 / 3 + 0;
|
*(plan_origin + plans_ndx + 3) = size_x * 12 / 3 + 0;
|
||||||
*(plan_origin + plans_ndx + 4) = space_size_x * 12 / 3 + 3;
|
*(plan_origin + plans_ndx + 4) = size_x * 12 / 3 + 3;
|
||||||
*(plan_origin + plans_ndx + 5) = space_size_x * 12 / 3 + 4;
|
*(plan_origin + plans_ndx + 5) = size_x * 12 / 3 + 4;
|
||||||
|
|
||||||
*(plan_origin + plans_ndx + 0) = space_size_x * 12 / 3 + 0;
|
*(plan_origin + plans_ndx + 0) = size_x * 12 / 3 + 0;
|
||||||
*(plan_origin + plans_ndx + 1) = space_size_x * 12 / 3 + 1;
|
*(plan_origin + plans_ndx + 1) = size_x * 12 / 3 + 1;
|
||||||
*(plan_origin + plans_ndx + 2) = space_size_x * 12 / 3 + 3;
|
*(plan_origin + plans_ndx + 2) = size_x * 12 / 3 + 3;
|
||||||
|
|
||||||
*(plan_origin + plans_ndx + 3) = space_size_x * 12 / 3 + 0;
|
*(plan_origin + plans_ndx + 3) = size_x * 12 / 3 + 0;
|
||||||
*(plan_origin + plans_ndx + 4) = space_size_x * 12 / 3 + 2;
|
*(plan_origin + plans_ndx + 4) = size_x * 12 / 3 + 2;
|
||||||
*(plan_origin + plans_ndx + 5) = space_size_x * 12 / 3 + 4;
|
*(plan_origin + plans_ndx + 5) = size_x * 12 / 3 + 4;
|
||||||
|
|
||||||
plans_ndx += 12; if (P) printf("|=> plans_ndx = %3d arrow_3D\n", plans_ndx);
|
plans_ndx += 12; if (P) printf("|=> plans_ndx = %3d arrow_3D\n", plans_ndx);
|
||||||
}
|
}
|
||||||
|
@ -543,9 +503,9 @@ static bool compute_space_3D (int space_size_x,
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void show_user_choices(int model_space_size_x,
|
static void show_user_choices(int model_size_x,
|
||||||
int model_space_size_y,
|
int model_size_y,
|
||||||
int model_space_size_z,
|
int model_size_z,
|
||||||
|
|
||||||
GLubyte *arrows,
|
GLubyte *arrows,
|
||||||
int model_arrows_nb,
|
int model_arrows_nb,
|
||||||
|
@ -554,7 +514,7 @@ static void show_user_choices(int model_space_size_x,
|
||||||
int pref_style_lines_planes,
|
int pref_style_lines_planes,
|
||||||
int pref_style_mix_colors)
|
int pref_style_mix_colors)
|
||||||
{
|
{
|
||||||
printf("model + user constraints : space size x,y,z = %d,%d,%d ", model_space_size_x, model_space_size_y, model_space_size_z);
|
printf("model + user constraints : space size x,y,z = %d,%d,%d ", model_size_x, model_size_y, model_size_z);
|
||||||
if (model_arrows_nb > 0) printf("[%d] arrows ", model_arrows_nb);
|
if (model_arrows_nb > 0) printf("[%d] arrows ", model_arrows_nb);
|
||||||
if (pref_mark_unit_space == 0) printf("no unit_space marks ");
|
if (pref_mark_unit_space == 0) printf("no unit_space marks ");
|
||||||
if (pref_mark_unit_space == 1) printf("first unit space marked ");
|
if (pref_mark_unit_space == 1) printf("first unit space marked ");
|
||||||
|
@ -572,9 +532,9 @@ static void show_user_choices(int model_space_size_x,
|
||||||
i, *(arrows + i * 5 + 0), *(arrows + i * 5 + 1), *(arrows + i * 5 + 2), *(arrows + i * 5 + 3), *(arrows + i * 5 + 4));
|
i, *(arrows + i * 5 + 0), *(arrows + i * 5 + 1), *(arrows + i * 5 + 2), *(arrows + i * 5 + 3), *(arrows + i * 5 + 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool compute_space_and_arrows(int model_space_size_x,
|
bool compute_space_and_arrows(int model_size_x,
|
||||||
int model_space_size_y,
|
int model_size_y,
|
||||||
int model_space_size_z,
|
int model_size_z,
|
||||||
|
|
||||||
GLubyte *arrows,
|
GLubyte *arrows,
|
||||||
int model_arrows_nb,
|
int model_arrows_nb,
|
||||||
|
@ -589,9 +549,9 @@ bool compute_space_and_arrows(int model_space_size_x,
|
||||||
GLubyte *plan_origin)
|
GLubyte *plan_origin)
|
||||||
|
|
||||||
{
|
{
|
||||||
if (SA) show_user_choices(model_space_size_x,
|
if (SA) show_user_choices(model_size_x,
|
||||||
model_space_size_y,
|
model_size_y,
|
||||||
model_space_size_z,
|
model_size_z,
|
||||||
|
|
||||||
arrows,
|
arrows,
|
||||||
model_arrows_nb,
|
model_arrows_nb,
|
||||||
|
@ -600,9 +560,9 @@ bool compute_space_and_arrows(int model_space_size_x,
|
||||||
pref_style_lines_planes,
|
pref_style_lines_planes,
|
||||||
pref_style_mix_colors);
|
pref_style_mix_colors);
|
||||||
|
|
||||||
compute_space_3D (model_space_size_x,
|
compute_space_3D (model_size_x,
|
||||||
model_space_size_y,
|
model_size_y,
|
||||||
model_space_size_z,
|
model_size_z,
|
||||||
|
|
||||||
pref_mark_unit_space,
|
pref_mark_unit_space,
|
||||||
pref_style_lines_planes,
|
pref_style_lines_planes,
|
||||||
|
@ -614,9 +574,9 @@ bool compute_space_and_arrows(int model_space_size_x,
|
||||||
plan_origin);
|
plan_origin);
|
||||||
|
|
||||||
for (int i = 0; i < model_arrows_nb; i++)
|
for (int i = 0; i < model_arrows_nb; i++)
|
||||||
compute_arrow_3D (model_space_size_x,
|
compute_arrow_3D (model_size_x,
|
||||||
model_space_size_y,
|
model_size_y,
|
||||||
model_space_size_z,
|
model_size_z,
|
||||||
|
|
||||||
*(arrows + i * 5 + 0), // weight (load)
|
*(arrows + i * 5 + 0), // weight (load)
|
||||||
*(arrows + i * 5 + 1), // site
|
*(arrows + i * 5 + 1), // site
|
||||||
|
@ -636,3 +596,4 @@ bool compute_space_and_arrows(int model_space_size_x,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -539,9 +539,9 @@ GLubyte arrows[] = {
|
||||||
|
|
||||||
static void get_model_data_and_user_preferences(){
|
static void get_model_data_and_user_preferences(){
|
||||||
|
|
||||||
model_space_size_x = 3; // 0 < model_space_size_x
|
model_space_size_x = 5; // 0 < model_space_size_x
|
||||||
model_space_size_y = 2; // 0 < model_space_size_y
|
model_space_size_y = 4; // 0 < model_space_size_y
|
||||||
model_space_size_z = 1; // 0 < model_space_size_z
|
model_space_size_z = 3; // 0 < model_space_size_z
|
||||||
model_arrows_nb = 0; // assert : l'emplacement des flèches est contraint
|
model_arrows_nb = 0; // assert : l'emplacement des flèches est contraint
|
||||||
// par model_space_size_x, y, z et le nombre de sites
|
// par model_space_size_x, y, z et le nombre de sites
|
||||||
|
|
||||||
|
@ -773,3 +773,4 @@ void graphics_draw(const void *gl_area)
|
||||||
glFlush();
|
glFlush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue