7.7 Three-dimensional interactive graph 243
cout << " right-mouse button to rotate up-down" << endl;
cout << " both buttons to zoom" << endl;}//--- If ’q’ is pressed, quit:if(kbd==’q’)
{
vexit();
return;
}//--- Check the mouse:click = slocator (&xaddr, &yaddr);//--- Not pressed:if(click==0)
{
goto again;
}//--- Ignore if cursor lies outside the plotting windowif( xaddr<-1 || xaddr > 1||yaddr<-1 || yaddr > 1)
goto again;//--- Rotate if left button is pressed:if(click==1)
{
angx = angxinit+200.0*yaddr;
color(bgc);
clear();
drawplot3d();
}//-- Rotate if right button is pressed:if(click==4)
{
angy = angyinit+200.0*xaddr;
color(bgc);
clear();
drawplot3d();
}