I have a problem (really ?!) : the foloowing code sould draw two vector with the same orientation… but it doesn’t work. I try to draw a vector in spherical coordonates ( the base is (1,angle[1],angle[0]) and sorry for the english …) with 2 rotations and with this cartesian composantes.
/-------------------------------------------------------------------------------------------
angle[2]={40,60};
anglerd[0]=angle[0]*PI/180;anglerd[1]=angle[1]*PI/180;
dir[0]=sin(anglerd[1])*cos(anglerd[0]);dir[1]=sin(anglerd[0])*sin(anglerd[1]);dir[2]=cos(anglerd[1]);
glColor3f(1,0,0);
glBegin(GL_LINES);
glVertex3f(0,0,0);glVertex3d(3*dir[0],3*dir[1],3* dir[2]); //vecteur directeur
glEnd();
//retrouver le vecteur directeur
glPushMatrix();
glRotated(angle[1]-90,0,1,0);
glRotatef(angle[0],0,0,1);
glColor3f(0,1,0);
glBegin(GL_LINES);
glVertex3f(0,0,0);glVertex3f(4,0,0);
glEnd();
glPopMatrix();
/------------------------------------------------------------------------------------------------
I hope my english is not so bad that it cannot be understand…