| 22 |
|
#define WFLUSH 30 /* flush after this many rays */ |
| 23 |
|
#endif |
| 24 |
|
|
| 25 |
+ |
#ifdef SMLFLT |
| 26 |
+ |
#define sscanvec(s,v) (sscanf(s,"%f %f %f",v,v+1,v+2)==3) |
| 27 |
+ |
#else |
| 28 |
+ |
#define sscanvec(s,v) (sscanf(s,"%lf %lf %lf",v,v+1,v+2)==3) |
| 29 |
+ |
#endif |
| 30 |
|
|
| 31 |
+ |
|
| 32 |
|
getrect(s, r) /* get a box */ |
| 33 |
|
char *s; |
| 34 |
|
register RECT *r; |
| 93 |
|
error(COMMAND, "illegal magnification"); |
| 94 |
|
return(-1); |
| 95 |
|
} |
| 96 |
< |
if (sscanf(s, "%*lf %lf %lf %lf", &vec[0], &vec[1], &vec[2]) != 3) { |
| 96 |
> |
if (!sscanvec(sskip(s), vec)) { |
| 97 |
|
if (dev->getcur == NULL) |
| 98 |
|
return(-1); |
| 99 |
|
(*dev->comout)("Pick view center\n"); |
| 163 |
|
setcolor(thisray.rcol, 0.0, 0.0, 0.0); |
| 164 |
|
} else { |
| 165 |
|
rayorigin(&thisray, NULL, PRIMARY, 1.0); |
| 166 |
+ |
samplendx++; |
| 167 |
|
rayvalue(&thisray); |
| 168 |
|
} |
| 169 |
|
|
| 185 |
|
{ |
| 186 |
|
/* free old image */ |
| 187 |
|
freepkids(&ptrunk); |
| 188 |
+ |
/* save reserve memory */ |
| 189 |
+ |
fillreserves(); |
| 190 |
|
/* compute resolution */ |
| 191 |
|
hresolu = dev->xsiz; |
| 192 |
|
vresolu = dev->ysiz; |
| 381 |
|
double angle, elev, mag; |
| 382 |
|
FVECT vc; |
| 383 |
|
{ |
| 375 |
– |
extern double sqrt(), dist2(); |
| 384 |
|
double d; |
| 385 |
|
FVECT v1; |
| 386 |
|
VIEW nv; |
| 440 |
|
vp->vert = asin(vp->vert) / (PI/180./2.); |
| 441 |
|
return; |
| 442 |
|
} |
| 435 |
– |
} |
| 436 |
– |
|
| 437 |
– |
|
| 438 |
– |
spinvector(vres, vorig, vnorm, theta) /* rotate vector around normal */ |
| 439 |
– |
FVECT vres, vorig, vnorm; |
| 440 |
– |
double theta; |
| 441 |
– |
{ |
| 442 |
– |
extern double sin(), cos(); |
| 443 |
– |
double sint, cost, dotp; |
| 444 |
– |
FVECT vperp; |
| 445 |
– |
register int i; |
| 446 |
– |
|
| 447 |
– |
if (theta == 0.0) { |
| 448 |
– |
VCOPY(vres, vorig); |
| 449 |
– |
return; |
| 450 |
– |
} |
| 451 |
– |
sint = sin(theta); |
| 452 |
– |
cost = cos(theta); |
| 453 |
– |
dotp = DOT(vorig, vnorm); |
| 454 |
– |
fcross(vperp, vnorm, vorig); |
| 455 |
– |
for (i = 0; i < 3; i++) |
| 456 |
– |
vres[i] = vnorm[i]*dotp*(1.-cost) + |
| 457 |
– |
vorig[i]*cost + vperp[i]*sint; |
| 443 |
|
} |