bonjour;
dans un tableau de points je veux afficher seulement ceux qui vérifient une équation pour cela j'ai écris la fonction suivant:malheuresement elle me renvoit des valeurs qui n'existe plus dans le tableau initial !
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 typedef struct Point { float x;float y;float z; }; Point *equation(Point a,Point b,Point tableau[taille]) { Point *sorti=(Point *)malloc(taille*sizeof(Point )); int cpt=0; float equation; float landa=-((a.x*b.x)+(a.y*b.y)+(a.z*b.z)); for(int i=0;i<taille;i++) { equation=((a.x*tableau[i].x)+(a.y*tableau[i].y)+(a.z*tableau[i].z))+landa; if(equation==0.0) { sorti[cpt].x=p[i].x;sorti[cpt].y=p[i].y;sorti[cpt].z=p[i].z;cpt++; } } return sorti; }
cordialement
Partager