c++ - Draw ArcCtg ( x ) plot -


i don't how draw graph function: y = arcctg( x ).. i'm not @ math that's i've done far:

void drawgraph() {     double x,y,z;     float xmin=0, xmax=m_pi, ymin=0, ymax=m_pi; //  glpushmatrix();     glbegin (gl_line_stipple); (x = xmin; x <= xmax; x+=0.1) {     (y = ymin; y <= ymax; y+=0.1)     {         y = atan(x);     y = m_pi_2 -y;  //that transform arctan( x )  actan (x ) guess..         glvertex3f (x, y, -1);     } } glend (); //glpopmatrix(); } 

when run program it's not responding : - (... appreciated. thanks!

you following:

for (y = ymin; y <= ymax; y+=0.1)     {         y = something;     } 

this create endless loop (unless something > ymax, not in case). imagine following:

for (a = 0; <= 10; a++)     {         = 5;     } 

use variable inside loop instead of y, , you'll fine.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -