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.12 by greg, Sat Oct 13 20:56:01 1990 UTC vs.
Revision 1.14 by greg, Mon Mar 18 13:48:05 1991 UTC

# Line 27 | Line 27 | register VIEW  *v;
27          if (normalize(v->vdir) == 0.0)          /* normalize direction */
28                  return("zero view direction");
29  
30 +        if (normalize(v->vup) == 0.0)           /* normalize view up */
31 +                return("zero view up vector");
32 +
33          fcross(v->hvec, v->vdir, v->vup);       /* compute horiz dir */
34  
35          if (normalize(v->hvec) == 0.0)
36 <                return("illegal view up vector");
36 >                return("view up parallel to view direction");
37  
38          fcross(v->vvec, v->hvec, v->vdir);      /* compute vert dir */
39  
# Line 71 | Line 74 | register VIEW  *v;
74          default:
75                  return("unknown view type");
76          }
77 <        if (v->type == VT_PAR || v->type == VT_PER) {
77 >        if (v->type != VT_ANG) {
78                  v->hvec[0] *= v->hn2;
79                  v->hvec[1] *= v->hn2;
80                  v->hvec[2] *= v->hn2;
# Line 125 | Line 128 | double  x, y;
128                  normalize(direc);
129                  return(0);
130          case VT_HEM:                    /* hemispherical fisheye */
131 <                x *= v->horiz/90.0;
129 <                y *= v->vert/90.0;
130 <                z = 1.0 - x*x - y*y;
131 >                z = 1.0 - x*x*v->hn2 - y*y*v->vn2;
132                  if (z < 0.0)
133                          return(-1);
134                  z = sqrt(z);
# Line 177 | Line 178 | FVECT  p;
178          case VT_PAR:                    /* parallel view */
179                  if (zp != NULL)
180                          *zp = DOT(disp,v->vdir);
181 <                *xp = DOT(disp,v->hvec)/v->hn2 + 0.5 - v->hoff;
181 <                *yp = DOT(disp,v->vvec)/v->vn2 + 0.5 - v->voff;
182 <                return;
181 >                break;
182          case VT_PER:                    /* perspective view */
183                  d = DOT(disp,v->vdir);
184                  if (zp != NULL) {
# Line 195 | Line 194 | FVECT  p;
194                          disp[1] *= d;
195                          disp[2] *= d;
196                  }
197 <                *xp = DOT(disp,v->hvec)/v->hn2 + 0.5 - v->hoff;
199 <                *yp = DOT(disp,v->vvec)/v->vn2 + 0.5 - v->voff;
200 <                return;
197 >                break;
198          case VT_HEM:                    /* hemispherical fisheye */
199                  d = normalize(disp);
200                  if (zp != NULL) {
# Line 206 | Line 203 | FVECT  p;
203                          else
204                                  *zp = d;
205                  }
206 <                *xp = DOT(disp,v->hvec)*90.0/v->horiz + 0.5 - v->hoff;
210 <                *yp = DOT(disp,v->vvec)*90.0/v->vert + 0.5 - v->voff;
211 <                return;
206 >                break;
207          case VT_ANG:                    /* angular fisheye */
208                  d = normalize(disp);
209                  if (zp != NULL)
# Line 228 | Line 223 | FVECT  p;
223                  *yp += DOT(disp,v->vvec)*d*180.0/v->vert;
224                  return;
225          }
226 +        *xp = DOT(disp,v->hvec)/v->hn2 + 0.5 - v->hoff;
227 +        *yp = DOT(disp,v->vvec)/v->vn2 + 0.5 - v->voff;
228   }
229  
230  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines