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.9 by greg, Tue Jan 16 16:21:07 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;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines