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.78 by greg, Tue Apr 22 16:39:20 2025 UTC vs.
Revision 2.79 by greg, Fri May 2 23:56:18 2025 UTC

# Line 374 | Line 374 | getorigin(                             /* origin viewpoint */
374   )
375   {
376          VIEW    nv = ourview;
377 +        FVECT   voff;
378 +        int     i;
379          double  d;
380 <                                        /* get new view origin */
381 <        if (sscanf(s, "%lf %lf", &d, &d) == 1) {
382 <                                        /* just moving some distance */
383 <                VSUM(nv.vp, nv.vp, nv.vdir, d);
384 <        } else if (!sscanvec(s, nv.vp)) {
385 <                int     x, y;           /* need to pick origin */
380 >                                        /* check for view origin shift */
381 >        if (sscanf(s, "%lf", &d) == 1) {
382 >                double  d_fore=d, d_right=0, d_up=0;
383 >                sscanf(s, "%*f %lf %lf", &d_right, &d_up);
384 >                d_right /= sqrt(nv.hn2);
385 >                for (i = 3; i--; )
386 >                        nv.vp[i] += d_fore*nv.vdir[i] +
387 >                                        d_right*nv.hvec[i] +
388 >                                        d_up*nv.vup[i];
389 >        } else {                        /* else pick new origin */
390 >                int     x, y;
391                  RAY     thisray;
392                  if (dev->getcur == NULL)
393                          return;
# Line 401 | Line 408 | getorigin(                             /* origin viewpoint */
408                          flipsurface(&thisray);
409                  VSUM(nv.vp, thisray.rop, thisray.ron, 20.0*FTINY);
410                  VCOPY(nv.vdir, thisray.ron);
411 <        } else if (!sscanvec(sskip2(s,3), nv.vdir) || normalize(nv.vdir) == 0.0)
412 <                VCOPY(nv.vdir, ourview.vdir);
413 <
414 <        d = DOT(nv.vdir, nv.vup);       /* need different up vector? */
415 <        if (d*d >= 1.-2.*FTINY) {
416 <                int     i;
417 <                nv.vup[0] = nv.vup[1] = nv.vup[2] = 0.0;
418 <                for (i = 3; i--; )
419 <                        if (nv.vdir[i]*nv.vdir[i] < 0.34)
413 <                                break;
414 <                nv.vup[i] = 1.;
411 >                d = DOT(nv.vdir, nv.vup);
412 >                if (d*d >= 1.-2.*FTINY) {
413 >                                        /* need different up vector */
414 >                        nv.vup[0] = nv.vup[1] = nv.vup[2] = 0.0;
415 >                        for (i = 3; i--; )
416 >                                if (nv.vdir[i]*nv.vdir[i] < 0.34)
417 >                                        break;
418 >                        nv.vup[i] = 1.;
419 >                }
420          }
421          newview(&nv);
422   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines