19 |
|
#include "random.h" |
20 |
|
|
21 |
|
#ifndef WFLUSH |
22 |
< |
#define WFLUSH 30 /* flush after this many rays */ |
22 |
> |
#ifdef SPEED |
23 |
> |
#define WFLUSH (5*SPEED) |
24 |
> |
#else |
25 |
> |
#define WFLUSH 100 /* flush after this many rays */ |
26 |
|
#endif |
27 |
+ |
#endif |
28 |
|
|
29 |
+ |
#ifdef SMLFLT |
30 |
+ |
#define sscanvec(s,v) (sscanf(s,"%f %f %f",v,v+1,v+2)==3) |
31 |
+ |
#else |
32 |
+ |
#define sscanvec(s,v) (sscanf(s,"%lf %lf %lf",v,v+1,v+2)==3) |
33 |
+ |
#endif |
34 |
|
|
35 |
+ |
|
36 |
|
getrect(s, r) /* get a box */ |
37 |
|
char *s; |
38 |
|
register RECT *r; |
97 |
|
error(COMMAND, "illegal magnification"); |
98 |
|
return(-1); |
99 |
|
} |
100 |
< |
if (sscanf(s, "%*lf %lf %lf %lf", &vec[0], &vec[1], &vec[2]) != 3) { |
100 |
> |
if (!sscanvec(sskip(s), vec)) { |
101 |
|
if (dev->getcur == NULL) |
102 |
|
return(-1); |
103 |
|
(*dev->comout)("Pick view center\n"); |
167 |
|
setcolor(thisray.rcol, 0.0, 0.0, 0.0); |
168 |
|
} else { |
169 |
|
rayorigin(&thisray, NULL, PRIMARY, 1.0); |
170 |
+ |
samplendx++; |
171 |
|
rayvalue(&thisray); |
172 |
|
} |
173 |
|
|
189 |
|
{ |
190 |
|
/* free old image */ |
191 |
|
freepkids(&ptrunk); |
192 |
+ |
/* save reserve memory */ |
193 |
+ |
fillreserves(); |
194 |
|
/* compute resolution */ |
195 |
|
hresolu = dev->xsiz; |
196 |
|
vresolu = dev->ysiz; |
385 |
|
double angle, elev, mag; |
386 |
|
FVECT vc; |
387 |
|
{ |
375 |
– |
extern double sqrt(), dist2(); |
388 |
|
double d; |
389 |
|
FVECT v1; |
390 |
|
VIEW nv; |
444 |
|
vp->vert = asin(vp->vert) / (PI/180./2.); |
445 |
|
return; |
446 |
|
} |
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; |
447 |
|
} |