I’m making a program to draw a trajectory, was using as a basis the tangent, but when I put 90 degrees, the tangent is very large, so I thought of putting an if (angle == 90) did not use the tangent.
the design is right, but after choosing it 90 degrees it stops to draw.
for example
1-30 degrees - draws
2-45 degrees ---- draws
3 draws -90 degrees —
4-60 degrees — not drawing
5 — 80 degrees — not drawing
*
*
anyone know what is happening? making routine design is presented below:
thank
void Draw() {
glColor3f(1.0, 1.0, 1.0);
glBegin(GL_LINES);
convert(graus);
if (ant){
x=xx;
y=yy;
}
double rad = (graus3.1415926)/180;
GLfloat varx= sabc;
GLfloat vary= fabctan(rad);
if (graus==90 || graus == 270) {varx = 0;
vary = f*abc;
}
glVertex3f(x, y, 0.0);
glVertex3f(x+varx, y+vary, 0.0);
if(_kbhit())
{
xx= x+sabc;
yy= y+fabc*tan(rad);
cout<< "Digite o angulo: ";
cin>>graus;
rad = (graus*3.1415926)/180;
convert(graus);
ant =1;
abc = 0.0;
}
glEnd();
glFlush();
abc += var;
glutPostRedisplay();
}