| 12 | 
  | 
 | 
| 13 | 
  | 
#include "standard.h" | 
| 14 | 
  | 
#include "view.h" | 
| 15 | 
+ | 
#include "resolu.h" | 
| 16 | 
  | 
#include <signal.h> | 
| 17 | 
  | 
#include <X11/Xlib.h> | 
| 18 | 
  | 
#include <X11/Xutil.h> | 
| 30 | 
  | 
float   col[3] = {1.,0.,0.};            /* color */ | 
| 31 | 
  | 
 | 
| 32 | 
  | 
VIEW    ourview = STDVIEW;              /* view for picture */ | 
| 33 | 
< | 
int     xres, yres;                     /* picture resolution */ | 
| 33 | 
> | 
RESOLU  pres;                           /* picture resolution */ | 
| 34 | 
  | 
 | 
| 35 | 
  | 
char    *progname;                      /* program name */ | 
| 36 | 
  | 
 | 
| 93 | 
  | 
        XColor  xc; | 
| 94 | 
  | 
        XGCValues       gcv; | 
| 95 | 
  | 
                                        /* get the viewing parameters */ | 
| 96 | 
< | 
        if (viewfile(pname, &ourview, &xres, &yres) <= 0 || | 
| 96 | 
> | 
        if (viewfile(pname, &ourview, &pres) <= 0 || | 
| 97 | 
  | 
                        setview(&ourview) != NULL) { | 
| 98 | 
  | 
                fprintf(stderr, "%s: cannot get view from \"%s\"\n", | 
| 99 | 
  | 
                                progname, pname); | 
| 134 | 
  | 
                XGetWindowAttributes(theDisplay, gwind, &wa); | 
| 135 | 
  | 
                sleep(6); | 
| 136 | 
  | 
        } while (wa.map_state != IsViewable); | 
| 137 | 
< | 
        if (wa.width != xres || wa.height != yres) { | 
| 137 | 
> | 
        if (wa.width != scanlen(&pres) || wa.height != numscans(&pres)) { | 
| 138 | 
  | 
                fprintf(stderr, | 
| 139 | 
  | 
                "%s: warning -- window seems to be the wrong size!\n", | 
| 140 | 
  | 
                                progname); | 
| 141 | 
< | 
                xres = wa.width; | 
| 142 | 
< | 
                yres = wa.height; | 
| 141 | 
> | 
                if (pres.or & YMAJOR) { | 
| 142 | 
> | 
                        pres.xr = wa.width; | 
| 143 | 
> | 
                        pres.yr = wa.height; | 
| 144 | 
> | 
                } else { | 
| 145 | 
> | 
                        pres.xr = wa.height; | 
| 146 | 
> | 
                        pres.yr = wa.width; | 
| 147 | 
> | 
                } | 
| 148 | 
  | 
        } | 
| 149 | 
  | 
                                        /* set graphics context */ | 
| 150 | 
  | 
        gcv.font = XLoadFont(theDisplay, FONTNAME); | 
| 211 | 
  | 
{ | 
| 212 | 
  | 
        FVECT   start, cur; | 
| 213 | 
  | 
        XPoint  pt[NSEG+1]; | 
| 214 | 
< | 
        double  px, py, pz; | 
| 214 | 
> | 
        FVECT   pp; | 
| 215 | 
> | 
        int     ip[2]; | 
| 216 | 
  | 
        register int    i; | 
| 217 | 
  | 
 | 
| 218 | 
  | 
        fcross(cur, dir, ourview.vup); | 
| 224 | 
  | 
                cur[0] += ourview.vp[0]; | 
| 225 | 
  | 
                cur[1] += ourview.vp[1]; | 
| 226 | 
  | 
                cur[2] += ourview.vp[2]; | 
| 227 | 
< | 
                viewpixel(&px, &py, &pz, &ourview, cur); | 
| 228 | 
< | 
                if (pz <= 0.0) | 
| 227 | 
> | 
                viewloc(pp, &ourview, cur); | 
| 228 | 
> | 
                if (pp[2] <= 0.0) | 
| 229 | 
  | 
                        goto fail; | 
| 230 | 
< | 
                pt[i].x = px*xres; | 
| 231 | 
< | 
                pt[i].y = yres-1 - (int)(py*yres); | 
| 230 | 
> | 
                loc2pix(ip, &pres, pp[0], pp[1]); | 
| 231 | 
> | 
                pt[i].x = ip[0]; | 
| 232 | 
> | 
                pt[i].y = ip[1]; | 
| 233 | 
  | 
        } | 
| 234 | 
  | 
        XDrawLines(theDisplay, gwind, vecGC, pt, NSEG+1, CoordModeOrigin); | 
| 235 | 
  | 
        return; | 
| 244 | 
  | 
double  v; | 
| 245 | 
  | 
{ | 
| 246 | 
  | 
        FVECT   pos; | 
| 247 | 
< | 
        double  px, py, pz; | 
| 247 | 
> | 
        FVECT   pp; | 
| 248 | 
> | 
        int     ip[2]; | 
| 249 | 
  | 
        char    buf[32]; | 
| 250 | 
  | 
 | 
| 251 | 
  | 
        pos[0] = ourview.vp[0] + dir[0]; | 
| 252 | 
  | 
        pos[1] = ourview.vp[1] + dir[1]; | 
| 253 | 
  | 
        pos[2] = ourview.vp[2] + dir[2]; | 
| 254 | 
< | 
        viewpixel(&px, &py, &pz, &ourview, pos); | 
| 255 | 
< | 
        if (pz <= 0.0) | 
| 254 | 
> | 
        viewloc(pp, &ourview, pos); | 
| 255 | 
> | 
        if (pp[2] <= 0.0) | 
| 256 | 
  | 
                return; | 
| 257 | 
+ | 
        loc2pix(ip, &pres, pp[0], pp[1]); | 
| 258 | 
  | 
        sprintf(buf, "%.0f", v); | 
| 259 | 
  | 
        XDrawImageString(theDisplay, gwind, strGC, | 
| 260 | 
< | 
                        (int)(px*xres), yres-1-(int)(py*yres), | 
| 251 | 
< | 
                        buf, strlen(buf));  | 
| 260 | 
> | 
                        ip[0], ip[1], buf, strlen(buf));  | 
| 261 | 
  | 
} |