ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/rv3.c
(Generate patch)

Comparing ray/src/rt/rv3.c (file contents):
Revision 1.17 by greg, Sun Oct 14 11:06:27 1990 UTC vs.
Revision 2.4 by greg, Thu Feb 11 16:42:22 1993 UTC

# Line 19 | Line 19 | static char SCCSid[] = "$SunId$ LBL";
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;
# Line 87 | Line 97 | double  *mp;
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");
# Line 157 | Line 167 | int  xmin, ymin, xmax, ymax;
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  
# Line 178 | Line 189 | newimage()                             /* start a new image */
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;
# Line 372 | Line 385 | moveview(angle, elev, mag, vc)                 /* move viewpoint */
385   double  angle, elev, mag;
386   FVECT  vc;
387   {
375        extern double  sqrt(), dist2();
388          double  d;
389          FVECT  v1;
390          VIEW  nv;
# Line 432 | Line 444 | double  zf;
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   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines