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.12 by greg, Wed Jan 17 10:55:40 1996 UTC vs.
Revision 2.15 by gwlarson, Fri Feb 26 12:24:07 1999 UTC

# Line 30 | Line 30 | register VIEW  *v;
30          static char  ill_horiz[] = "illegal horizontal view size";
31          static char  ill_vert[] = "illegal vertical view size";
32          
33 <        if (v->vfore < -FTINY || v->vaft < -FTINY ||
34 <                        (v->vaft > FTINY && v->vaft <= v->vfore))
33 >        if (v->vaft < -FTINY || (v->vaft > FTINY && v->vaft <= v->vfore))
34                  return("illegal fore/aft clipping plane");
35  
36          if (normalize(v->vdir) == 0.0)          /* normalize direction */
# Line 205 | Line 204 | FVECT  ip;
204   register VIEW  *v;
205   FVECT  p;
206   {
207 <        double  d;
207 >        double  d, d2;
208          FVECT  disp;
209  
210          disp[0] = p[0] - v->vp[0];
# Line 218 | Line 217 | FVECT  p;
217                  break;
218          case VT_PER:                    /* perspective view */
219                  d = DOT(disp,v->vdir);
220 <                ip[2] = sqrt(DOT(disp,disp));
220 >                ip[2] = VLEN(disp);
221                  if (d < 0.0) {          /* fold pyramid */
222                          ip[2] = -ip[2];
223                          d = -d;
# Line 240 | Line 239 | FVECT  p;
239                  ip[2] -= v->vfore;
240                  break;
241          case VT_CYL:                    /* cylindrical panorama */
243                ip[2] = DOT(disp,v->vdir);
242                  d = DOT(disp,v->hvec);
243 <                ip[0] = 180.0/PI * atan2(d,ip[2]) / v->horiz + 0.5 - v->hoff;
244 <                ip[1] = DOT(disp,v->vvec)/v->vn2 + 0.5 - v->voff;
245 <                if (v->vfore > FTINY)
246 <                        ip[2] = sqrt(DOT(disp,disp)) *
247 <                                (1.0 - v->vfore/sqrt(d*d + ip[2]*ip[2]));
248 <                else
251 <                        ip[2] = sqrt(DOT(disp,disp));
243 >                d2 = DOT(disp,v->vdir);
244 >                ip[0] = 180.0/PI * atan2(d,d2) / v->horiz + 0.5 - v->hoff;
245 >                d = 1.0/sqrt(d*d + d2*d2);
246 >                ip[1] = DOT(disp,v->vvec)*d/v->vn2 + 0.5 - v->voff;
247 >                ip[2] = VLEN(disp);
248 >                ip[2] *= (1.0 - v->vfore*d);
249                  return;
250          case VT_ANG:                    /* angular fisheye */
251                  ip[0] = 0.5 - v->hoff;
# Line 519 | Line 516 | struct myview {
516   };
517  
518  
519 < static
519 > static int
520   gethview(s, v)                          /* get view from header */
521   char  *s;
522   register struct myview  *v;
523   {
524          if (isview(s) && sscanview(v->hv, s) > 0)
525                  v->ok++;
526 +        return(0);
527   }
528  
529  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines