| 1 |
< |
/* Copyright (c) 1994 Regents of the University of California */ |
| 1 |
> |
/* Copyright (c) 1996 Regents of the University of California */ |
| 2 |
|
|
| 3 |
|
#ifndef lint |
| 4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
| 6 |
|
|
| 7 |
|
/* |
| 8 |
|
* image.c - routines for image generation. |
| 9 |
– |
* |
| 10 |
– |
* 10/17/85 |
| 9 |
|
*/ |
| 10 |
|
|
| 11 |
|
#include "standard.h" |
| 16 |
|
|
| 17 |
|
#include "paths.h" |
| 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 |
+ |
|
| 23 |
|
VIEW stdview = STDVIEW; /* default view parameters */ |
| 24 |
|
|
| 25 |
|
|
| 242 |
|
case VT_CYL: /* cylindrical panorama */ |
| 243 |
|
ip[2] = DOT(disp,v->vdir); |
| 244 |
|
d = DOT(disp,v->hvec); |
| 245 |
< |
ip[0] = 180.0/PI * atan2(ip[2],d) / v->horiz + 0.5 - v->hoff; |
| 245 |
> |
ip[0] = 180.0/PI * atan2(d,ip[2]) / v->horiz + 0.5 - v->hoff; |
| 246 |
|
ip[1] = DOT(disp,v->vvec)/v->vn2 + 0.5 - v->voff; |
| 247 |
|
if (v->vfore > FTINY) |
| 248 |
|
ip[2] = sqrt(DOT(disp,disp)) * |
| 427 |
|
fprintf(fp, " -vh %.6g -vv %.6g", vp->horiz, vp->vert); |
| 428 |
|
fprintf(fp, " -vo %.6g -va %.6g", vp->vfore, vp->vaft); |
| 429 |
|
fprintf(fp, " -vs %.6g -vl %.6g", vp->hoff, vp->voff); |
| 430 |
+ |
} |
| 431 |
+ |
|
| 432 |
+ |
|
| 433 |
+ |
char * |
| 434 |
+ |
viewopt(vp) /* translate to minimal view string */ |
| 435 |
+ |
register VIEW *vp; |
| 436 |
+ |
{ |
| 437 |
+ |
static char vwstr[128]; |
| 438 |
+ |
register char *cp = vwstr; |
| 439 |
+ |
|
| 440 |
+ |
if (vp->type != stdview.type) { |
| 441 |
+ |
sprintf(cp, " -vt%c", vp->type); |
| 442 |
+ |
cp += strlen(cp); |
| 443 |
+ |
} |
| 444 |
+ |
if (!VEQ(vp->vp,stdview.vp)) { |
| 445 |
+ |
sprintf(cp, " -vp %.6g %.6g %.6g", |
| 446 |
+ |
vp->vp[0], vp->vp[1], vp->vp[2]); |
| 447 |
+ |
cp += strlen(cp); |
| 448 |
+ |
} |
| 449 |
+ |
if (!VEQ(vp->vdir,stdview.vdir)) { |
| 450 |
+ |
sprintf(cp, " -vd %.6g %.6g %.6g", |
| 451 |
+ |
vp->vdir[0], vp->vdir[1], vp->vdir[2]); |
| 452 |
+ |
cp += strlen(cp); |
| 453 |
+ |
} |
| 454 |
+ |
if (!VEQ(vp->vup,stdview.vup)) { |
| 455 |
+ |
sprintf(cp, " -vu %.6g %.6g %.6g", |
| 456 |
+ |
vp->vup[0], vp->vup[1], vp->vup[2]); |
| 457 |
+ |
cp += strlen(cp); |
| 458 |
+ |
} |
| 459 |
+ |
if (!FEQ(vp->horiz,stdview.horiz)) { |
| 460 |
+ |
sprintf(cp, " -vh %.6g", vp->horiz); |
| 461 |
+ |
cp += strlen(cp); |
| 462 |
+ |
} |
| 463 |
+ |
if (!FEQ(vp->vert,stdview.vert)) { |
| 464 |
+ |
sprintf(cp, " -vv %.6g", vp->vert); |
| 465 |
+ |
cp += strlen(cp); |
| 466 |
+ |
} |
| 467 |
+ |
if (!FEQ(vp->vfore,stdview.vfore)) { |
| 468 |
+ |
sprintf(cp, " -vo %.6g", vp->vfore); |
| 469 |
+ |
cp += strlen(cp); |
| 470 |
+ |
} |
| 471 |
+ |
if (!FEQ(vp->vaft,stdview.vaft)) { |
| 472 |
+ |
sprintf(cp, " -va %.6g", vp->vaft); |
| 473 |
+ |
cp += strlen(cp); |
| 474 |
+ |
} |
| 475 |
+ |
if (!FEQ(vp->hoff,stdview.hoff)) { |
| 476 |
+ |
sprintf(cp, " -vs %.6g", vp->hoff); |
| 477 |
+ |
cp += strlen(cp); |
| 478 |
+ |
} |
| 479 |
+ |
if (!FEQ(vp->voff,stdview.voff)) { |
| 480 |
+ |
sprintf(cp, " -vl %.6g", vp->voff); |
| 481 |
+ |
cp += strlen(cp); |
| 482 |
+ |
} |
| 483 |
+ |
return(vwstr); |
| 484 |
|
} |
| 485 |
|
|
| 486 |
|
|