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

Comparing ray/src/common/image.c (file contents):
Revision 1.7 by greg, Tue Jan 9 11:37:50 1990 UTC vs.
Revision 1.11 by greg, Fri Sep 21 17:06:31 1990 UTC

# Line 73 | Line 73 | int  *xp, *yp;                 /* x and y resolution in (or out if *
73          if (*ap <= FTINY)
74                  *ap = va * *xp / *yp;           /* compute pixel aspect */
75          else if (va * *xp > *ap * *yp)
76 <                *xp = *yp / va * *ap;           /* reduce x resolution */
76 >                *xp = *yp / va * *ap + .5;      /* reduce x resolution */
77          else
78 <                *yp = *xp * va / *ap;           /* reduce y resolution */
78 >                *yp = *xp * va / *ap + .5;      /* reduce y resolution */
79   }
80  
81  
# Line 119 | Line 119 | FVECT  p;
119                  if (zp != NULL)
120                          *zp = DOT(disp,v->vdir);
121          } else {                        /* perspective view */
122 <                d = 1.0/DOT(disp,v->vdir);
122 >                d = DOT(disp,v->vdir);
123                  if (zp != NULL) {
124                          *zp = sqrt(DOT(disp,disp));
125                          if (d < 0.0)
126                                  *zp = -*zp;
127                  }
128 <                disp[0] *= d;
129 <                disp[1] *= d;
130 <                disp[2] *= d;
128 >                if (d < 0.0)            /* fold pyramid */
129 >                        d = -d;
130 >                if (d > FTINY) {
131 >                        d = 1.0/d;
132 >                        disp[0] *= d;
133 >                        disp[1] *= d;
134 >                        disp[2] *= d;
135 >                }
136          }
137          *xp = DOT(disp,v->hvec)/v->hn2 + 0.5 - v->hoff;
138          *yp = DOT(disp,v->vvec)/v->vn2 + 0.5 - v->voff;
# Line 143 | Line 148 | register char  *av[];
148   #define check(c,n)      if ((av[0][c]&&av[0][c]!=' ') || n>=ac) return(-1)
149          extern double  atof();
150  
151 <        if (av[0][0] != '-' || av[0][1] != 'v')
151 >        if (ac <= 0 || av[0][0] != '-' || av[0][1] != 'v')
152                  return(-1);
153          switch (av[0][2]) {
154          case 't':                       /* type */
# Line 205 | Line 210 | register char  *s;
210  
211          while (*s == ' ')
212                  s++;
213 <        do {
213 >        while (*s) {
214                  ac = 0;
215                  do {
216                          av[ac++] = s;
# Line 218 | Line 223 | register char  *s;
223                          if (na+1 < ac)
224                                  s = av[na+1];
225                          nvopts++;
226 <                }
227 <        } while (*s);
226 >                } else if (ac > 1)
227 >                        s = av[1];
228 >        }
229          return(nvopts);
230   }
231  
# Line 233 | Line 239 | FILE  *fp;
239          fprintf(fp, " -vd %.6g %.6g %.6g", vp->vdir[0], vp->vdir[1], vp->vdir[2]);
240          fprintf(fp, " -vu %.6g %.6g %.6g", vp->vup[0], vp->vup[1], vp->vup[2]);
241          fprintf(fp, " -vh %.6g -vv %.6g", vp->horiz, vp->vert);
242 <        fprintf(fp, " -vs %d -vl %d", vp->hoff, vp->voff);
242 >        fprintf(fp, " -vs %.6g -vl %.6g", vp->hoff, vp->voff);
243   }
244  
245  
# Line 258 | Line 264 | char  *s;
264  
265  
266   int
267 < viewfile(fname, vp)                     /* get view from file */
267 > viewfile(fname, vp, xp, yp)             /* get view from file */
268   char  *fname;
269   VIEW  *vp;
270 + int  *xp, *yp;
271   {
272          extern char  *progname;
273          FILE  *fp;
# Line 273 | Line 280 | VIEW  *vp;
280          gothview = 0;
281  
282          getheader(fp, gethview);
283 +
284 +        if (xp != NULL && yp != NULL
285 +                        && fgetresolu(xp, yp, fp) == -1)
286 +                gothview = 0;
287  
288          fclose(fp);
289  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines