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

Comparing ray/src/rt/rv2.c (file contents):
Revision 2.62 by greg, Wed Oct 5 17:20:55 2011 UTC vs.
Revision 2.65 by greg, Fri Apr 11 20:27:23 2014 UTC

# Line 26 | Line 26 | extern double  maxdiff;                        /* max. sample difference */
26  
27   #define  CTRL(c)        ((c)-'@')
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
29 > #define  sscanvec(s,v)  (sscanf(s,FVFORMAT,v,v+1,v+2)==3)
30  
31   extern char  rifname[128];              /* rad input file name */
32  
# Line 337 | Line 333 | getrotate(                             /* rotate camera */
333   )
334   {
335          VIEW  nv = ourview;
340        FVECT  v1;
336          double  angle, elev, zfact;
337          
338          elev = 0.0; zfact = 1.0;
# Line 346 | Line 341 | getrotate(                             /* rotate camera */
341                  return;
342          }
343          spinvector(nv.vdir, ourview.vdir, ourview.vup, angle*(PI/180.));
344 <        if (elev != 0.0) {
345 <                fcross(v1, nv.vdir, ourview.vup);
346 <                normalize(v1);
352 <                spinvector(nv.vdir, nv.vdir, v1, elev*(PI/180.));
353 <        }
344 >        if (elev != 0.0)
345 >                geodesic(nv.vdir, nv.vdir, nv.vup, elev*(PI/180.), GEOD_RAD);
346 >        
347          zoomview(&nv, zfact);
348          newview(&nv);
349   }
# Line 372 | Line 365 | getpivot(                              /* pivot viewpoint */
365          if (getinterest(sskip2(s,2), 0, vc, &mag) < 0)
366                  return;
367          moveview(angle, elev, mag, vc);
368 + }
369 +
370 +
371 + void
372 + getorigin(                              /* origin viewpoint */
373 +        char  *s
374 + )
375 + {
376 +        VIEW    nv = ourview;
377 +        double  d;
378 +                                        /* get new view origin */
379 +        if (!sscanvec(s, nv.vp)) {
380 +                int     x, y;
381 +                RAY     thisray;
382 +                if (dev->getcur == NULL)
383 +                        return;
384 +                (*dev->comout)("Pick point on surface for new origin\n");
385 +                if ((*dev->getcur)(&x, &y) == ABORT)
386 +                        return;
387 +                if ((thisray.rmax = viewray(thisray.rorg, thisray.rdir,
388 +                        &ourview, (x+.5)/hresolu, (y+.5)/vresolu)) < -FTINY) {
389 +                        error(COMMAND, "not on image");
390 +                        return;
391 +                }
392 +                rayorigin(&thisray, PRIMARY, NULL, NULL);
393 +                if (!localhit(&thisray, &thescene)) {
394 +                        error(COMMAND, "not a local object");
395 +                        return;
396 +                }
397 +                if (thisray.rod < 0.0)  /* don't look through other side */
398 +                        flipsurface(&thisray);
399 +                VSUM(nv.vp, thisray.rop, thisray.ron, 2.0*FTINY);
400 +                VCOPY(nv.vdir, thisray.ron);
401 +        } else if (!sscanvec(sskip2(s,3), nv.vdir) || normalize(nv.vdir) == 0.0)
402 +                VCOPY(nv.vdir, ourview.vdir);
403 +
404 +        d = DOT(nv.vdir, nv.vup);       /* need different up vector? */
405 +        if (d*d >= 1.-2.*FTINY) {
406 +                int     i;
407 +                nv.vup[0] = nv.vup[1] = nv.vup[2] = 0.0;
408 +                for (i = 3; i--; )
409 +                        if (nv.vdir[i]*nv.vdir[i] < 0.34)
410 +                                break;
411 +                nv.vup[i] = 1.;
412 +        }
413 +        newview(&nv);
414   }
415  
416  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines