| 15 |
|
#include "paths.h" |
| 16 |
|
#include "view.h" |
| 17 |
|
|
| 18 |
– |
|
| 19 |
– |
#define FEQ(x,y) (fabs((x)-(y)) <= FTINY) |
| 20 |
– |
#define VEQ(v,w) (FEQ((v)[0],(w)[0]) && FEQ((v)[1],(w)[1]) \ |
| 21 |
– |
&& FEQ((v)[2],(w)[2])) |
| 22 |
– |
|
| 18 |
|
VIEW stdview = STDVIEW; /* default view parameters */ |
| 19 |
|
|
| 20 |
|
static gethfunc gethview; |
| 28 |
|
static char ill_horiz[] = "illegal horizontal view size"; |
| 29 |
|
static char ill_vert[] = "illegal vertical view size"; |
| 30 |
|
|
| 31 |
< |
if (v->vaft < -FTINY || (v->vaft > FTINY && v->vaft <= v->vfore)) |
| 31 |
> |
if ((v->vfore < -FTINY) | (v->vaft < -FTINY) || |
| 32 |
> |
(v->vaft > FTINY) & (v->vaft <= v->vfore)) |
| 33 |
|
return("illegal fore/aft clipping plane"); |
| 34 |
|
|
| 35 |
|
if (v->vdist <= FTINY) |
| 63 |
|
return(ill_horiz); |
| 64 |
|
if (v->vert >= 180.0-FTINY) |
| 65 |
|
return(ill_vert); |
| 66 |
< |
v->hn2 = 2.0 * tan(v->horiz*(PI/180.0/2.0)); |
| 67 |
< |
v->vn2 = 2.0 * tan(v->vert*(PI/180.0/2.0)); |
| 66 |
> |
v->hn2 = 2.0 * tan(v->horiz*(PI/360.)); |
| 67 |
> |
v->vn2 = 2.0 * tan(v->vert*(PI/360.)); |
| 68 |
|
break; |
| 69 |
|
case VT_CYL: /* cylindrical panorama */ |
| 70 |
|
if (v->horiz > 360.0+FTINY) |
| 72 |
|
if (v->vert >= 180.0-FTINY) |
| 73 |
|
return(ill_vert); |
| 74 |
|
v->hn2 = v->horiz * (PI/180.0); |
| 75 |
< |
v->vn2 = 2.0 * tan(v->vert*(PI/180.0/2.0)); |
| 75 |
> |
v->vn2 = 2.0 * tan(v->vert*(PI/360.)); |
| 76 |
|
break; |
| 77 |
|
case VT_ANG: /* angular fisheye */ |
| 78 |
|
if (v->horiz > 360.0+FTINY) |
| 87 |
|
return(ill_horiz); |
| 88 |
|
if (v->vert > 180.0+FTINY) |
| 89 |
|
return(ill_vert); |
| 90 |
< |
v->hn2 = 2.0 * sin(v->horiz*(PI/180.0/2.0)); |
| 91 |
< |
v->vn2 = 2.0 * sin(v->vert*(PI/180.0/2.0)); |
| 90 |
> |
v->hn2 = 2.0 * sin(v->horiz*(PI/360.)); |
| 91 |
> |
v->vn2 = 2.0 * sin(v->vert*(PI/360.)); |
| 92 |
|
break; |
| 93 |
|
case VT_PLS: /* planispheric fisheye */ |
| 94 |
|
if (v->horiz >= 360.0-FTINY) |
| 95 |
|
return(ill_horiz); |
| 96 |
|
if (v->vert >= 360.0-FTINY) |
| 97 |
|
return(ill_vert); |
| 98 |
< |
v->hn2 = 2.*sin(v->horiz*(PI/180.0/2.0)) / |
| 99 |
< |
(1.0 + cos(v->horiz*(PI/180.0/2.0))); |
| 100 |
< |
v->vn2 = 2.*sin(v->vert*(PI/180.0/2.0)) / |
| 101 |
< |
(1.0 + cos(v->vert*(PI/180.0/2.0))); |
| 98 |
> |
v->hn2 = 2.*sin(v->horiz*(PI/360.)) / |
| 99 |
> |
(1.0 + cos(v->horiz*(PI/360.))); |
| 100 |
> |
v->vn2 = 2.*sin(v->vert*(PI/360.)) / |
| 101 |
> |
(1.0 + cos(v->vert*(PI/360.))); |
| 102 |
|
break; |
| 103 |
|
default: |
| 104 |
|
return("unknown view type"); |
| 120 |
|
} |
| 121 |
|
|
| 122 |
|
|
| 123 |
+ |
char * |
| 124 |
+ |
cropview( /* crop a view to the indicated bounds */ |
| 125 |
+ |
VIEW *v, |
| 126 |
+ |
double x0, |
| 127 |
+ |
double y0, |
| 128 |
+ |
double x1, |
| 129 |
+ |
double y1 |
| 130 |
+ |
) |
| 131 |
+ |
{ |
| 132 |
+ |
static char ill_hemi[] = "illegal crop for hemispherical view"; |
| 133 |
+ |
double d; |
| 134 |
+ |
/* order crop extrema */ |
| 135 |
+ |
if (x0 > x1) { d=x0; x0=x1; x1=d; } |
| 136 |
+ |
if (y0 > y1) { d=y0; y0=y1; y1=d; } |
| 137 |
+ |
|
| 138 |
+ |
if ((x1-x0 <= FTINY) | (y1-y0 <= FTINY)) |
| 139 |
+ |
return("zero crop area"); |
| 140 |
+ |
|
| 141 |
+ |
d = x1 - x0; /* adjust horizontal size? */ |
| 142 |
+ |
if (!FABSEQ(d, 1.)) |
| 143 |
+ |
switch (v->type) { |
| 144 |
+ |
case VT_PER: |
| 145 |
+ |
v->horiz = 360./PI*atan( d*tan(PI/360.*v->horiz) ); |
| 146 |
+ |
break; |
| 147 |
+ |
case VT_PAR: |
| 148 |
+ |
case VT_ANG: |
| 149 |
+ |
case VT_CYL: |
| 150 |
+ |
v->horiz *= d; |
| 151 |
+ |
break; |
| 152 |
+ |
case VT_HEM: |
| 153 |
+ |
d *= sin(PI/360.*v->horiz); |
| 154 |
+ |
if (d > 1.) |
| 155 |
+ |
return(ill_hemi); |
| 156 |
+ |
v->horiz = 360./PI*asin( d ); |
| 157 |
+ |
break; |
| 158 |
+ |
case VT_PLS: |
| 159 |
+ |
d *= sin(PI/360.*v->horiz) / |
| 160 |
+ |
(1. + cos(PI/360.*v->horiz)); |
| 161 |
+ |
v->horiz = 360./PI*acos( (1. - d*d) / (1. + d*d) ); |
| 162 |
+ |
break; |
| 163 |
+ |
} |
| 164 |
+ |
|
| 165 |
+ |
d = y1 - y0; /* adjust vertical size? */ |
| 166 |
+ |
if (!FABSEQ(d, 1.)) |
| 167 |
+ |
switch (v->type) { |
| 168 |
+ |
case VT_PER: |
| 169 |
+ |
case VT_CYL: |
| 170 |
+ |
v->vert = 360./PI*atan( d*tan(PI/360.*v->vert) ); |
| 171 |
+ |
break; |
| 172 |
+ |
case VT_PAR: |
| 173 |
+ |
case VT_ANG: |
| 174 |
+ |
v->vert *= d; |
| 175 |
+ |
break; |
| 176 |
+ |
case VT_HEM: |
| 177 |
+ |
d *= sin(PI/360.*v->vert); |
| 178 |
+ |
if (d > 1.) |
| 179 |
+ |
return(ill_hemi); |
| 180 |
+ |
v->vert = 360./PI*asin( d ); |
| 181 |
+ |
break; |
| 182 |
+ |
case VT_PLS: |
| 183 |
+ |
d *= sin(PI/360.*v->vert) / |
| 184 |
+ |
(1. + cos(PI/360.*v->vert)); |
| 185 |
+ |
v->vert = 360./PI*acos( (1. - d*d) / (1. + d*d) ); |
| 186 |
+ |
break; |
| 187 |
+ |
} |
| 188 |
+ |
/* adjust offsets */ |
| 189 |
+ |
v->hoff = ((x0 + x1)*.5 - .5 + v->hoff) / (x1 - x0); |
| 190 |
+ |
v->voff = ((y0 + y1)*.5 - .5 + v->voff) / (y1 - y0); |
| 191 |
+ |
|
| 192 |
+ |
return(setview(v)); /* final error checks & set-up */ |
| 193 |
+ |
} |
| 194 |
+ |
|
| 195 |
+ |
|
| 196 |
|
void |
| 197 |
|
normaspect( /* fix pixel aspect or resolution */ |
| 198 |
|
double va, /* view aspect ratio */ |
| 238 |
|
direc[0] = v->vdir[0] + x*v->hvec[0] + y*v->vvec[0]; |
| 239 |
|
direc[1] = v->vdir[1] + x*v->hvec[1] + y*v->vvec[1]; |
| 240 |
|
direc[2] = v->vdir[2] + x*v->hvec[2] + y*v->vvec[2]; |
| 241 |
< |
orig[0] = v->vp[0] + v->vfore*direc[0]; |
| 173 |
< |
orig[1] = v->vp[1] + v->vfore*direc[1]; |
| 174 |
< |
orig[2] = v->vp[2] + v->vfore*direc[2]; |
| 241 |
> |
VSUM(orig, v->vp, direc, v->vfore); |
| 242 |
|
d = normalize(direc); |
| 243 |
|
return(v->vaft > FTINY ? (v->vaft - v->vfore)*d : 0.0); |
| 244 |
|
case VT_HEM: /* hemispherical fisheye */ |
| 249 |
|
direc[0] = z*v->vdir[0] + x*v->hvec[0] + y*v->vvec[0]; |
| 250 |
|
direc[1] = z*v->vdir[1] + x*v->hvec[1] + y*v->vvec[1]; |
| 251 |
|
direc[2] = z*v->vdir[2] + x*v->hvec[2] + y*v->vvec[2]; |
| 252 |
< |
orig[0] = v->vp[0] + v->vfore*direc[0]; |
| 186 |
< |
orig[1] = v->vp[1] + v->vfore*direc[1]; |
| 187 |
< |
orig[2] = v->vp[2] + v->vfore*direc[2]; |
| 252 |
> |
VSUM(orig, v->vp, direc, v->vfore); |
| 253 |
|
return(v->vaft > FTINY ? v->vaft - v->vfore : 0.0); |
| 254 |
|
case VT_CYL: /* cylindrical panorama */ |
| 255 |
|
d = x * v->horiz * (PI/180.0); |
| 258 |
|
direc[0] = z*v->vdir[0] + x*v->hvec[0] + y*v->vvec[0]; |
| 259 |
|
direc[1] = z*v->vdir[1] + x*v->hvec[1] + y*v->vvec[1]; |
| 260 |
|
direc[2] = z*v->vdir[2] + x*v->hvec[2] + y*v->vvec[2]; |
| 261 |
< |
orig[0] = v->vp[0] + v->vfore*direc[0]; |
| 197 |
< |
orig[1] = v->vp[1] + v->vfore*direc[1]; |
| 198 |
< |
orig[2] = v->vp[2] + v->vfore*direc[2]; |
| 261 |
> |
VSUM(orig, v->vp, direc, v->vfore); |
| 262 |
|
d = normalize(direc); |
| 263 |
|
return(v->vaft > FTINY ? (v->vaft - v->vfore)*d : 0.0); |
| 264 |
|
case VT_ANG: /* angular fisheye */ |
| 275 |
|
direc[0] = z*v->vdir[0] + x*v->hvec[0] + y*v->vvec[0]; |
| 276 |
|
direc[1] = z*v->vdir[1] + x*v->hvec[1] + y*v->vvec[1]; |
| 277 |
|
direc[2] = z*v->vdir[2] + x*v->hvec[2] + y*v->vvec[2]; |
| 278 |
< |
orig[0] = v->vp[0] + v->vfore*direc[0]; |
| 216 |
< |
orig[1] = v->vp[1] + v->vfore*direc[1]; |
| 217 |
< |
orig[2] = v->vp[2] + v->vfore*direc[2]; |
| 278 |
> |
VSUM(orig, v->vp, direc, v->vfore); |
| 279 |
|
return(v->vaft > FTINY ? v->vaft - v->vfore : 0.0); |
| 280 |
|
case VT_PLS: /* planispheric fisheye */ |
| 281 |
|
x *= sqrt(v->hn2); |
| 282 |
|
y *= sqrt(v->vn2); |
| 283 |
|
d = x*x + y*y; |
| 284 |
|
z = (1. - d)/(1. + d); |
| 285 |
< |
d = d <= FTINY*FTINY ? PI : sqrt((1.0 - z*z)/d); |
| 286 |
< |
x *= d; |
| 226 |
< |
y *= d; |
| 285 |
> |
x *= (1. + z); |
| 286 |
> |
y *= (1. + z); |
| 287 |
|
direc[0] = z*v->vdir[0] + x*v->hvec[0] + y*v->vvec[0]; |
| 288 |
|
direc[1] = z*v->vdir[1] + x*v->hvec[1] + y*v->vvec[1]; |
| 289 |
|
direc[2] = z*v->vdir[2] + x*v->hvec[2] + y*v->vvec[2]; |
| 290 |
< |
orig[0] = v->vp[0] + v->vfore*direc[0]; |
| 231 |
< |
orig[1] = v->vp[1] + v->vfore*direc[1]; |
| 232 |
< |
orig[2] = v->vp[2] + v->vfore*direc[2]; |
| 290 |
> |
VSUM(orig, v->vp, direc, v->vfore); |
| 291 |
|
return(v->vaft > FTINY ? v->vaft - v->vfore : 0.0); |
| 292 |
|
} |
| 293 |
|
return(-1.0); |
| 294 |
|
} |
| 295 |
|
|
| 296 |
|
|
| 297 |
< |
void |
| 297 |
> |
int |
| 298 |
|
viewloc( /* find image location for point */ |
| 299 |
|
FVECT ip, |
| 300 |
|
VIEW *v, |
| 301 |
|
FVECT p |
| 302 |
< |
) |
| 302 |
> |
) /* Use VL_* flags to interpret return value */ |
| 303 |
|
{ |
| 304 |
+ |
int rflags = VL_GOOD; |
| 305 |
|
double d, d2; |
| 306 |
|
FVECT disp; |
| 307 |
|
|
| 313 |
|
break; |
| 314 |
|
case VT_PER: /* perspective view */ |
| 315 |
|
d = DOT(disp,v->vdir); |
| 316 |
+ |
rflags |= VL_BEYOND*((v->vaft > FTINY) & |
| 317 |
+ |
(d >= v->vaft)); |
| 318 |
|
ip[2] = VLEN(disp); |
| 319 |
< |
if (d < 0.0) { /* fold pyramid */ |
| 319 |
> |
if (d < -FTINY) { /* fold pyramid */ |
| 320 |
|
ip[2] = -ip[2]; |
| 321 |
|
d = -d; |
| 322 |
< |
} |
| 323 |
< |
if (d > FTINY) { |
| 324 |
< |
d = 1.0/d; |
| 325 |
< |
disp[0] *= d; |
| 326 |
< |
disp[1] *= d; |
| 327 |
< |
disp[2] *= d; |
| 328 |
< |
} |
| 322 |
> |
} else if (d <= FTINY) |
| 323 |
> |
return(VL_BAD); /* at infinite edge */ |
| 324 |
> |
d = 1.0/d; |
| 325 |
> |
disp[0] *= d; |
| 326 |
> |
disp[1] *= d; |
| 327 |
> |
disp[2] *= d; |
| 328 |
> |
if (ip[2] < 0.0) d = -d; |
| 329 |
|
ip[2] *= (1.0 - v->vfore*d); |
| 330 |
|
break; |
| 331 |
|
case VT_HEM: /* hemispherical fisheye */ |
| 340 |
|
d = DOT(disp,v->hvec); |
| 341 |
|
d2 = DOT(disp,v->vdir); |
| 342 |
|
ip[0] = 180.0/PI * atan2(d,d2) / v->horiz + 0.5 - v->hoff; |
| 343 |
< |
d = 1.0/sqrt(d*d + d2*d2); |
| 343 |
> |
d2 = d*d + d2*d2; |
| 344 |
> |
if (d2 <= FTINY*FTINY) |
| 345 |
> |
return(VL_BAD); /* at pole */ |
| 346 |
> |
rflags |= VL_BEYOND*((v->vaft > FTINY) & |
| 347 |
> |
(d2 >= v->vaft*v->vaft)); |
| 348 |
> |
d = 1.0/sqrt(d2); |
| 349 |
|
ip[1] = DOT(disp,v->vvec)*d/v->vn2 + 0.5 - v->voff; |
| 350 |
|
ip[2] = VLEN(disp); |
| 351 |
|
ip[2] *= (1.0 - v->vfore*d); |
| 352 |
< |
return; |
| 352 |
> |
goto gotall; |
| 353 |
|
case VT_ANG: /* angular fisheye */ |
| 354 |
|
ip[0] = 0.5 - v->hoff; |
| 355 |
|
ip[1] = 0.5 - v->voff; |
| 356 |
|
ip[2] = normalize(disp) - v->vfore; |
| 357 |
|
d = DOT(disp,v->vdir); |
| 358 |
|
if (d >= 1.0-FTINY) |
| 359 |
< |
return; |
| 359 |
> |
goto gotall; |
| 360 |
|
if (d <= -(1.0-FTINY)) { |
| 361 |
|
ip[0] += 180.0/v->horiz; |
| 362 |
< |
return; |
| 362 |
> |
goto gotall; |
| 363 |
|
} |
| 364 |
|
d = (180.0/PI)*acos(d) / sqrt(1.0 - d*d); |
| 365 |
|
ip[0] += DOT(disp,v->hvec)*d/v->horiz; |
| 366 |
|
ip[1] += DOT(disp,v->vvec)*d/v->vert; |
| 367 |
< |
return; |
| 367 |
> |
goto gotall; |
| 368 |
|
case VT_PLS: /* planispheric fisheye */ |
| 369 |
|
ip[0] = 0.5 - v->hoff; |
| 370 |
|
ip[1] = 0.5 - v->voff; |
| 371 |
|
ip[2] = normalize(disp) - v->vfore; |
| 372 |
|
d = DOT(disp,v->vdir); |
| 373 |
|
if (d >= 1.0-FTINY) |
| 374 |
< |
return; |
| 374 |
> |
goto gotall; |
| 375 |
|
if (d <= -(1.0-FTINY)) |
| 376 |
< |
return; /* really an error */ |
| 377 |
< |
d = sqrt(1.0 - d*d) / (1.0 + d); |
| 378 |
< |
ip[0] += DOT(disp,v->hvec)*d/sqrt(v->hn2); |
| 379 |
< |
ip[1] += DOT(disp,v->vvec)*d/sqrt(v->vn2); |
| 380 |
< |
return; |
| 376 |
> |
return(VL_BAD); |
| 377 |
> |
ip[0] += DOT(disp,v->hvec)/((1. + d)*sqrt(v->hn2)); |
| 378 |
> |
ip[1] += DOT(disp,v->vvec)/((1. + d)*sqrt(v->vn2)); |
| 379 |
> |
goto gotall; |
| 380 |
> |
default: |
| 381 |
> |
return(VL_BAD); |
| 382 |
|
} |
| 383 |
|
ip[0] = DOT(disp,v->hvec)/v->hn2 + 0.5 - v->hoff; |
| 384 |
|
ip[1] = DOT(disp,v->vvec)/v->vn2 + 0.5 - v->voff; |
| 385 |
+ |
gotall: /* add appropriate return flags */ |
| 386 |
+ |
if (ip[2] <= 0.0) |
| 387 |
+ |
rflags |= VL_BEHIND; |
| 388 |
+ |
else if ((v->type != VT_PER) & (v->type != VT_CYL)) |
| 389 |
+ |
rflags |= VL_BEYOND*((v->vaft > FTINY) & |
| 390 |
+ |
(ip[2] >= v->vaft - v->vfore)); |
| 391 |
+ |
rflags |= VL_OUTSIDE*((0.0 >= ip[0]) | (ip[0] >= 1.0) | |
| 392 |
+ |
(0.0 >= ip[1]) | (ip[1] >= 1.0)); |
| 393 |
+ |
return(rflags); |
| 394 |
|
} |
| 395 |
|
|
| 396 |
|
|
| 402 |
|
int py |
| 403 |
|
) |
| 404 |
|
{ |
| 405 |
< |
register int x, y; |
| 405 |
> |
int x, y; |
| 406 |
|
|
| 407 |
|
if (rp->rt & YMAJOR) { |
| 408 |
|
x = px; |
| 428 |
|
double ly |
| 429 |
|
) |
| 430 |
|
{ |
| 431 |
< |
register int x, y; |
| 431 |
> |
int x, y; |
| 432 |
|
|
| 433 |
< |
x = lx * rp->xr; |
| 434 |
< |
y = ly * rp->yr; |
| 433 |
> |
x = (int)(lx*rp->xr + .5 - (lx < 0.0)); |
| 434 |
> |
y = (int)(ly*rp->yr + .5 - (ly < 0.0)); |
| 435 |
> |
|
| 436 |
|
if (rp->rt & XDECR) |
| 437 |
|
x = rp->xr-1 - x; |
| 438 |
|
if (rp->rt & YDECR) |
| 454 |
|
char *av[] |
| 455 |
|
) |
| 456 |
|
{ |
| 457 |
< |
#define check(c,l) if ((av[0][c]&&av[0][c]!=' ') || \ |
| 457 |
> |
#define check(c,l) if ((av[0][c]&&!isspace(av[0][c])) || \ |
| 458 |
|
badarg(ac-1,av+1,l)) return(-1) |
| 459 |
|
|
| 460 |
|
if (ac <= 0 || av[0][0] != '-' || av[0][1] != 'v') |
| 461 |
|
return(-1); |
| 462 |
|
switch (av[0][2]) { |
| 463 |
|
case 't': /* type */ |
| 464 |
< |
if (!av[0][3] || av[0][3]==' ') |
| 464 |
> |
if (!av[0][3] || isspace(av[0][3])) |
| 465 |
|
return(-1); |
| 466 |
|
check(4,""); |
| 467 |
|
v->type = av[0][3]; |
| 575 |
|
) |
| 576 |
|
{ |
| 577 |
|
static char vwstr[128]; |
| 578 |
< |
register char *cp = vwstr; |
| 578 |
> |
char *cp = vwstr; |
| 579 |
|
|
| 580 |
|
*cp = '\0'; |
| 581 |
|
if (vp->type != stdview.type) { |
| 582 |
|
sprintf(cp, " -vt%c", vp->type); |
| 583 |
|
cp += strlen(cp); |
| 584 |
|
} |
| 585 |
< |
if (!VEQ(vp->vp,stdview.vp)) { |
| 585 |
> |
if (!VABSEQ(vp->vp,stdview.vp)) { |
| 586 |
|
sprintf(cp, " -vp %.6g %.6g %.6g", |
| 587 |
|
vp->vp[0], vp->vp[1], vp->vp[2]); |
| 588 |
|
cp += strlen(cp); |
| 589 |
|
} |
| 590 |
< |
if (!FEQ(vp->vdist,stdview.vdist) || !VEQ(vp->vdir,stdview.vdir)) { |
| 590 |
> |
if (!FABSEQ(vp->vdist,stdview.vdist) || !VABSEQ(vp->vdir,stdview.vdir)) { |
| 591 |
|
sprintf(cp, " -vd %.6g %.6g %.6g", |
| 592 |
|
vp->vdir[0]*vp->vdist, |
| 593 |
|
vp->vdir[1]*vp->vdist, |
| 594 |
|
vp->vdir[2]*vp->vdist); |
| 595 |
|
cp += strlen(cp); |
| 596 |
|
} |
| 597 |
< |
if (!VEQ(vp->vup,stdview.vup)) { |
| 597 |
> |
if (!VABSEQ(vp->vup,stdview.vup)) { |
| 598 |
|
sprintf(cp, " -vu %.6g %.6g %.6g", |
| 599 |
|
vp->vup[0], vp->vup[1], vp->vup[2]); |
| 600 |
|
cp += strlen(cp); |
| 601 |
|
} |
| 602 |
< |
if (!FEQ(vp->horiz,stdview.horiz)) { |
| 602 |
> |
if (!FABSEQ(vp->horiz,stdview.horiz)) { |
| 603 |
|
sprintf(cp, " -vh %.6g", vp->horiz); |
| 604 |
|
cp += strlen(cp); |
| 605 |
|
} |
| 606 |
< |
if (!FEQ(vp->vert,stdview.vert)) { |
| 606 |
> |
if (!FABSEQ(vp->vert,stdview.vert)) { |
| 607 |
|
sprintf(cp, " -vv %.6g", vp->vert); |
| 608 |
|
cp += strlen(cp); |
| 609 |
|
} |
| 610 |
< |
if (!FEQ(vp->vfore,stdview.vfore)) { |
| 610 |
> |
if (!FABSEQ(vp->vfore,stdview.vfore)) { |
| 611 |
|
sprintf(cp, " -vo %.6g", vp->vfore); |
| 612 |
|
cp += strlen(cp); |
| 613 |
|
} |
| 614 |
< |
if (!FEQ(vp->vaft,stdview.vaft)) { |
| 614 |
> |
if (!FABSEQ(vp->vaft,stdview.vaft)) { |
| 615 |
|
sprintf(cp, " -va %.6g", vp->vaft); |
| 616 |
|
cp += strlen(cp); |
| 617 |
|
} |
| 618 |
< |
if (!FEQ(vp->hoff,stdview.hoff)) { |
| 618 |
> |
if (!FABSEQ(vp->hoff,stdview.hoff)) { |
| 619 |
|
sprintf(cp, " -vs %.6g", vp->hoff); |
| 620 |
|
cp += strlen(cp); |
| 621 |
|
} |
| 622 |
< |
if (!FEQ(vp->voff,stdview.voff)) { |
| 622 |
> |
if (!FABSEQ(vp->voff,stdview.voff)) { |
| 623 |
|
sprintf(cp, " -vl %.6g", vp->voff); |
| 624 |
|
cp += strlen(cp); |
| 625 |
|
} |
| 632 |
|
char *s |
| 633 |
|
) |
| 634 |
|
{ |
| 635 |
< |
static char *altname[]={NULL,VIEWSTR,"rpict","rview","rvu","rpiece","pinterp",NULL}; |
| 636 |
< |
extern char *progname; |
| 637 |
< |
register char *cp; |
| 561 |
< |
register char **an; |
| 635 |
> |
static char *altname[]={NULL,VIEWSTR,"rpict","rvu","rpiece","rxpiece","pinterp","rview",NULL}; |
| 636 |
> |
char *cp; |
| 637 |
> |
char **an; |
| 638 |
|
/* add program name to list */ |
| 639 |
|
if (altname[0] == NULL) { |
| 640 |
|
for (cp = progname; *cp; cp++) |
| 645 |
|
} |
| 646 |
|
/* skip leading path */ |
| 647 |
|
cp = s; |
| 648 |
< |
while (*cp && *cp != ' ') |
| 648 |
> |
while (*cp && !isspace(*cp)) |
| 649 |
|
cp++; |
| 650 |
|
while (cp > s && !ISDIRSEP(cp[-1])) |
| 651 |
|
cp--; |
| 697 |
|
if (rp != NULL && !fgetsresolu(rp, fp)) |
| 698 |
|
mvs.ok = 0; |
| 699 |
|
|
| 700 |
< |
fclose(fp); |
| 700 |
> |
if (fp != stdin) |
| 701 |
> |
fclose(fp); |
| 702 |
|
|
| 703 |
|
return(mvs.ok); |
| 704 |
|
} |