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.53 by greg, Wed Jan 12 21:07:39 2022 UTC vs.
Revision 2.54 by greg, Thu Jan 13 00:26:09 2022 UTC

# Line 129 | Line 129 | double x1,
129   double y1
130   )
131   {
132        static char     ill_crop[] = "zero crop area";
132          static char     ill_hemi[] = "illegal crop for hemispherical view";
133          double  d;
134                                          /* order crop extrema */
135          if (x0 > x1) { d=x0; x0=x1; x1=d; }
136          if (y0 > y1) { d=y0; y0=y1; y1=d; }
137  
138 <        d = x1 - x0;
139 <        if (d == .0)
140 <                return(ill_crop);
141 <        if (!FABSEQ(d, 1.))             /* adjust horizontal size? */
138 >        if ((x1-x0 <= FTINY) | (y1-y0 <= FTINY))
139 >                return("zero crop area");
140 >
141 >        d = x1 - x0;                    /* adjust horizontal size? */
142 >        if (!FABSEQ(d, 1.))
143                  switch (v->type) {
144                  case VT_PER:
145                          v->horiz = 360./PI*atan( d*tan(PI/360.*v->horiz) );
# Line 161 | Line 161 | double y1
161                          v->horiz = 360./PI*acos( (1. - d*d) / (1. + d*d) );
162                          break;
163                  }
164 <        d = y1 - y0;
165 <        if (d == .0)
166 <                return(ill_crop);
167 <        if (!FABSEQ(d, 1.))             /* adjust vertical size? */
164 >
165 >        d = y1 - y0;                    /* adjust vertical size? */
166 >        if (!FABSEQ(d, 1.))
167                  switch (v->type) {
168                  case VT_PER:
169                  case VT_CYL:
# Line 186 | Line 185 | double y1
185                          v->vert = 360./PI*acos( (1. - d*d) / (1. + d*d) );
186                          break;
187                  }
188 <                                        /* fix offsets */
188 >                                        /* adjust offsets */
189          v->hoff = ((x0 + x1)*.5 - .5 + v->hoff) / (x1 - x0);
190          v->voff = ((y0 + y1)*.5 - .5 + v->voff) / (y1 - y0);
191  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines