ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/vwright.c
Revision: 2.1
Committed: Mon Nov 21 16:49:44 1994 UTC (29 years, 5 months ago) by greg
Content type: text/plain
Branch: MAIN
Log Message:
Initial revision

File Contents

# User Rev Content
1 greg 2.1 /* Copyright (c) 1994 Regents of the University of California */
2    
3     #ifndef lint
4     static char SCCSid[] = "$SunId$ LBL";
5     #endif
6    
7     /*
8     * Move a viewpoint the given distance to the right
9     */
10    
11    
12     #include "standard.h"
13    
14     #include "view.h"
15    
16     VIEW leftview = STDVIEW;
17    
18     VIEW rightview;
19    
20     char *progname;
21    
22    
23     main(argc, argv)
24     int argc;
25     char *argv[];
26     {
27     char linebuf[256];
28     int gotview = 0;
29     double dist;
30     FVECT v1;
31     register int i;
32    
33     progname = argv[0];
34     if (argc != 2 || !isflt(argv[1])) {
35     fprintf(stderr, "Usage: %s offset\n", progname);
36     exit(1);
37     }
38     while (fgets(linebuf, sizeof(linebuf), stdin) != NULL) {
39     if (linebuf[0] == '\n')
40     break;
41     if (isview(linebuf) && sscanview(&leftview, linebuf) > 0)
42     gotview++;
43     }
44     if (!gotview) {
45     fprintf(stderr, "%s: no view on standard input\n", progname);
46     exit(1);
47     }
48     fcross(v1, leftview.vdir, leftview.vup);
49     if (normalize(v1) == 0.) {
50     fprintf(stderr,
51     "%s: view direction parallel to view up vector\n",
52     progname);
53     exit(1);
54     }
55     copystruct(&rightview, &leftview);
56     dist = atof(argv[1]);
57     for (i = 0; i < 3; i++)
58     rightview.vp[i] += dist*v1[i];
59     fputs(VIEWSTR, stdout);
60     fprintview(&rightview, stdout);
61     putchar('\n');
62     exit(0);
63     }