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

Comparing ray/src/rt/data.c (file contents):
Revision 1.4 by greg, Tue Apr 3 17:24:35 1990 UTC vs.
Revision 1.5 by greg, Tue Apr 3 17:48:46 1990 UTC

# Line 125 | Line 125 | scanerr:
125   }
126  
127  
128 + static double  inpaspect;               /* aspect ratio of input picture */
129 +
130 + static
131 + headaspect(s)                           /* check string for aspect ratio */
132 + char  *s;
133 + {
134 +        if (isaspect(s))
135 +                inpaspect *= aspectval(s);
136 + }
137 +
138 +
139   DATARRAY *
140   getpict(pname)                          /* get picture pname */
141   char  *pname;
# Line 158 | Line 169 | char  *pname;
169                  error(SYSTEM, errmsg);
170          }
171                                                  /* get dimensions */
172 <        getheader(fp, NULL);
172 >        inpaspect = 1.0;
173 >        getheader(fp, headaspect);
174          if (fgetresolu(&width, &height, fp) != (YMAJOR|YDECR))
175                  goto readerr;
176          for (i = 0; i < 3; i++) {
# Line 167 | Line 179 | char  *pname;
179                  pp[i].dim[1].ne = height;
180                  pp[i].dim[0].org =
181                  pp[i].dim[1].org = 0.0;
182 <                if (width <= height) {
182 >                if (width <= height*inpaspect) {
183                          pp[i].dim[0].siz = 1.0;
184 <                        pp[i].dim[1].siz = (double)height/width;
184 >                        pp[i].dim[1].siz = inpaspect*(double)height/width;
185                  } else {
186 <                        pp[i].dim[0].siz = (double)width/height;
186 >                        pp[i].dim[0].siz = (double)width/height/inpaspect;
187                          pp[i].dim[1].siz = 1.0;
188                  }
189                  pp[i].arr = (DATATYPE *)malloc(width*height*sizeof(DATATYPE));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines