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

Comparing ray/src/util/vwright.c (file contents):
Revision 2.1 by greg, Mon Nov 21 16:49:44 1994 UTC vs.
Revision 2.2 by greg, Thu Sep 14 21:36:32 1995 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1994 Regents of the University of California */
1 > /* Copyright (c) 1995 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 13 | Line 13 | static char SCCSid[] = "$SunId$ LBL";
13  
14   #include "view.h"
15  
16 < VIEW    leftview = STDVIEW;
16 > VIEW    vw = STDVIEW;
17  
18 VIEW    rightview;
19
18   char    *progname;
19  
20  
# Line 25 | Line 23 | int    argc;
23   char    *argv[];
24   {
25          char    linebuf[256];
26 +        char    *err;
27          int     gotview = 0;
28          double  dist;
30        FVECT   v1;
29          register int    i;
30  
31          progname = argv[0];
# Line 38 | Line 36 | char   *argv[];
36          while (fgets(linebuf, sizeof(linebuf), stdin) != NULL) {
37                  if (linebuf[0] == '\n')
38                          break;
39 <                if (isview(linebuf) && sscanview(&leftview, linebuf) > 0)
39 >                if (isview(linebuf) && sscanview(&vw, linebuf) > 0)
40                          gotview++;
41          }
42          if (!gotview) {
43                  fprintf(stderr, "%s: no view on standard input\n", progname);
44                  exit(1);
45          }
46 <        fcross(v1, leftview.vdir, leftview.vup);
47 <        if (normalize(v1) == 0.) {
50 <                fprintf(stderr,
51 <                        "%s: view direction parallel to view up vector\n",
52 <                                progname);
46 >        if ((err= setview(&vw)) != NULL) {
47 >                fprintf(stderr, "%s: %s\n", progname, err);
48                  exit(1);
49          }
50 <        copystruct(&rightview, &leftview);
56 <        dist = atof(argv[1]);
50 >        dist = atof(argv[1])/sqrt(vw.hn2);
51          for (i = 0; i < 3; i++)
52 <                rightview.vp[i] += dist*v1[i];
52 >                vw.vp[i] += dist*vw.hvec[i];
53          fputs(VIEWSTR, stdout);
54 <        fprintview(&rightview, stdout);
54 >        fprintview(&vw, stdout);
55          putchar('\n');
56          exit(0);
57   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines