static int getkey( /* get input key */ register XKeyPressedEvent *ekey ) { int n; char buf[8]; n = XLookupString(ekey, buf, sizeof(buf), NULL, NULL); if (n != 1) return(1); switch (buf[0]) { case 'h': /* turn on height motion lock */ headlocked = 1; break; case 'H': /* turn off height motion lock */ headlocked = 0; break; case 'l': /* retrieve last (premouse) view */ if (lastview.type) { VIEW vtmp; vtmp = thisview; dev_view(&lastview); lastview = vtmp; } else XBell(ourdisplay, 0); break; case 'n': /* move to next standard view */ gotoview(currentview+1); break; case 'p': /* move to last standard view */ gotoview(currentview-1); break; case '+': /* zoom in */ zoomview(100+ZOOMPCT, ekey->x, vres-1-ekey->y); break; case '-': /* zoom out */ zoomview(100-ZOOMPCT, ekey->x, vres-1-ekey->y); break; case 'v': /* spit current view to stdout */ fputs(VIEWSTR, stdout); fprintview(&thisview, stdout); fputc('\n', stdout); break; case 'V': /* append view to rad file */ appendview(NULL, &thisview); break; case 'q': /* quit the program */ return(0); default: XBell(ourdisplay, 0); break; } return(1); }
void getaim( /* aim camera */ char *s ) { VIEW nv = ourview; double zfact; if (getinterest(s, 1, nv.vdir, &zfact) < 0) return; zoomview(&nv, zfact); newview(&nv); }
void getrotate( /* rotate camera */ char *s ) { VIEW nv = ourview; double angle, elev, zfact; elev = 0.0; zfact = 1.0; if (sscanf(s, "%lf %lf %lf", &angle, &elev, &zfact) < 1) { error(COMMAND, "missing angle"); return; } spinvector(nv.vdir, ourview.vdir, ourview.vup, angle*(PI/180.)); if (elev != 0.0) geodesic(nv.vdir, nv.vdir, nv.vup, elev*(PI/180.), GEOD_RAD); zoomview(&nv, zfact); newview(&nv); }