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 2.36 by greg, Wed Mar 2 17:24:55 2011 UTC vs.
Revision 2.39 by greg, Sun Mar 24 19:40:26 2013 UTC

# Line 33 | Line 33 | VIEW  *v
33          static char  ill_horiz[] = "illegal horizontal view size";
34          static char  ill_vert[] = "illegal vertical view size";
35          
36 <        if (v->vaft < -FTINY || (v->vaft > FTINY && v->vaft <= v->vfore))
36 >        if ((v->vfore < -FTINY) | (v->vaft < -FTINY) ||
37 >                        (v->vaft > FTINY) & (v->vaft <= v->vfore))
38                  return("illegal fore/aft clipping plane");
39  
40          if (v->vdist <= FTINY)
# Line 221 | Line 222 | double  y
222                  y *= sqrt(v->vn2);
223                  d = x*x + y*y;
224                  z = (1. - d)/(1. + d);
225 <                d = d <= FTINY*FTINY ? PI : sqrt((1.0 - z*z)/d);
226 <                x *= d;
226 <                y *= d;
225 >                x *= (1. + z);
226 >                y *= (1. + z);
227                  direc[0] = z*v->vdir[0] + x*v->hvec[0] + y*v->vvec[0];
228                  direc[1] = z*v->vdir[1] + x*v->hvec[1] + y*v->vvec[1];
229                  direc[2] = z*v->vdir[2] + x*v->hvec[2] + y*v->vvec[2];
# Line 308 | Line 308 | FVECT  p
308                          return;
309                  if (d <= -(1.0-FTINY))
310                          return;         /* really an error */
311 <                d = sqrt(1.0 - d*d) / (1.0 + d);
312 <                ip[0] += DOT(disp,v->hvec)*d/sqrt(v->hn2);
313 <                ip[1] += DOT(disp,v->vvec)*d/sqrt(v->vn2);
311 >                ip[0] += DOT(disp,v->hvec)/((1. + d)*sqrt(v->hn2));
312 >                ip[1] += DOT(disp,v->vvec)/((1. + d)*sqrt(v->vn2));
313                  return;
314          }
315          ip[0] = DOT(disp,v->hvec)/v->hn2 + 0.5 - v->hoff;
# Line 354 | Line 353 | double  ly
353   {
354          int  x, y;
355  
356 <        x = (lx >= 0.0) ? (int)(lx * rp->xr) : -(int)(-lx * rp->xr);
357 <        y = (ly >= 0.0) ? (int)(ly * rp->yr) : -(int)(-ly * rp->yr);
356 >        x = (int)(lx*rp->xr + .5 - (lx < 0.0));
357 >        y = (int)(ly*rp->yr + .5 - (ly < 0.0));
358 >
359          if (rp->rt & XDECR)
360                  x = rp->xr-1 - x;
361          if (rp->rt & YDECR)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines