matrice 3 dimensions autour de z
Bonsoir,
Voila je suis confronte a un probleme lors d'une transformation par matrice
c'est tout simple comme ca mais j'ai du mal:
dans le cadre d'un tp je dois realiser une rotation de 3 point x, y, z (0,50,0) d'un angle de 90degres
dans le tp il annonce le resultat pour test --> (50,0,0) alors que moi j'obtient (-50,0,0) donc ma question est la suivante y'as t'il une erreur dans l'enonce de mon tp ou ma formule est incorrect??
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
struct rotation
{
float x1;
float y1;
float z1;
float anglex;
float angley;
}r;
void rotate_z(float x, float y, float z, float anglez)
{
float agl;
agl = anglez * M_PI / 180;
r.x1 = (x * cosf(agl)) - (y * -sinf(agl));
r.y1 = (x * sinf(agl)) + (y * cosf(agl));
r.z1 = z;
printf("A(%f, %f, %f) --> B(%f,%f,%f)\n",x,y,z, r.x1, r.y1, r.z1);
}
int main(int ac, char **av)
{
rotate_z(0,50,0,90);
return (0);
} |
merci de votre aide...