quelqu'un peut il m'expliquer ce que font exactement ici les tableaux . j'aimerais savoir si ce sont les tableaux qui passent des valeurs ou si on passe des valeurs aux tableaux.j'ai mis des nota là où il ya un prob.MERCI
j'ai mis l'ensemble de la classe pour plus de clarte:
class Champ {
public:
Champ();
~Champ();
// calcul du champ scalaire 3D
void calcule(Metaball* liste, int nombreMetas);
// triangulation avec génération de tous les cubes
void triangulation(float valeurReference);
private:
// algorithme des marching-cubes sans interpolation optimisée
bool marchingCubes(int x, int y, int z, float valeurReference);
public:
// tableaux qui stockent la géométrie de l'objet (mesh)
int nbPoints;
V3D* pointsMesh;
V3D* normalesMesh;
private:
// tableaux de stockage du champ scalaire et de son gradient
float champ[TAILLE_CHAMP][TAILLE_CHAMP][TAILLE_CHAMP];
V3D gradient[TAILLE_CHAMP][TAILLE_CHAMP][TAILLE_CHAMP];
};
#endif
Champ::Champ()
{
pointsMesh = new V3D[TAILLE_CHAMP * TAILLE_CHAMP * TAILLE_CHAMP * 5 * 3];
normalesMesh = new V3D[TAILLE_CHAMP * TAILLE_CHAMP * TAILLE_CHAMP * 5 * 3];
nbPoints = 0;
}
/*******************************************************************************
* Destructeur
******************************************************************************/
Champ::~Champ()
{
delete[] pointsMesh;
delete[] normalesMesh;
}
/*******************************************************************************
* Calcul du champ
******************************************************************************/
void Champ::calcule(Metaball* liste, int nombreMetas)
{
int x, y, z, i;
V3D pos;
for (z = 0; z < TAILLE_CHAMP; z++) {
for (y = 0; y < TAILLE_CHAMP; y++) {
for (x = 0; x < TAILLE_CHAMP; x++) {
//!!!!nota:que veut dire precisement la notation pos.x=x dans ce contexte et d'une maniere generale
pos.x = x;
pos.y = y;
pos.z = z;
//nota:qu'est celà que signifie :est ce qu'on passe au tab la valeur
0.0f ??a quoi servent les boucles????
champ[x][y][z] = 0.0f;
for (i = 0; i < nombreMetas; i++) {
//nota:ici que se passe t il avec le tab???incrementé par un autre
tab à qui on passe la fonction (pos)????cà veut dire quoi????
champ[x][y][z] += liste[i].fonction(pos);
}
}
}
}
for (z = 1; z < TAILLE_CHAMP - 1; z++) {
for (y = 1; y < TAILLE_CHAMP - 1; y++) {
for (x = 1; x < TAILLE_CHAMP - 1; x++) {
//nota:ici le tab recoit le param x???qui a pour param l'autre tab??
//je ne vois pas comment et pourquoi un tab recevrait un autre
tab en param!!!!
gradient[x][y][z].x = champ[x + 1][y][z] - champ[x - 1][y][z];
gradient[x][y][z].y = champ[x][y + 1][z] - champ[x][y - 1][z];
gradient[x][y][z].z = champ[x][y][
z + 1] - champ[x][y][z - 1];
gradient[x][y][z] *= 0.5;
}
}
}
}
J' AI VRAIMENT BESOIN DE QUELQU UN DE DOUE POUR M'EXPLIQUER CA CLAIREMENT PARCE QUE JE NAGE COMPLETEMENT ET JE RETROUVE CETTE "SYNTAXE" TOUT LE TEMPS DANS LE GRAPHISME.MERCI D'AVANCE