PDA

View Full Version : need help about drawing vectors



romb
08-02-2002, 06:00 AM
I'd like to know why the folowing program does not make appear two vectors with the same orientation.
(math.h is loaded .... http://www.opengl.org/discussion_boards/ubb/smile.gif )
the base is (1,angle[1],angle[0])
/*******************************************/****
angle[2]={40,60};
anglerd[0]=angle[0]*PI/180;anglerd[1]=angle[1]*PI/180;
dir[2]=cos(anglerd[1]);dir[0]=sin(anglerd[1])*cos(anglerd[0]);dir[1]=sin(anglerd[0])*sin(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();
///////////////////////////////////////////////////////////////////
thanks for your answers.