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.56 by greg, Tue Jun 3 21:31:51 2025 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  
# Line 314 | Line 313 | FVECT  p
313                  break;
314          case VT_PER:                    /* perspective view */
315                  d = DOT(disp,v->vdir);
316 <                if ((v->vaft > FTINY) & (d >= v->vaft))
317 <                        rflags |= VL_BEYOND;
316 >                rflags |= VL_BEYOND*((v->vaft > FTINY) &
317 >                                        (d >= v->vaft));
318                  ip[2] = VLEN(disp);
319                  if (d < -FTINY) {       /* fold pyramid */
320                          ip[2] = -ip[2];
# Line 344 | Line 343 | FVECT  p
343                  d2 = d*d + d2*d2;
344                  if (d2 <= FTINY*FTINY)
345                          return(VL_BAD); /* at pole */
346 <                if ((v->vaft > FTINY) & (d2 >= v->vaft*v->vaft))
347 <                        rflags |= VL_BEYOND;
346 >                rflags |= VL_BEYOND*((v->vaft > FTINY) &
347 >                                        (d2 >= v->vaft*v->vaft));
348                  d = 1.0/sqrt(d2);
349                  ip[1] = DOT(disp,v->vvec)*d/v->vn2 + 0.5 - v->voff;
350                  ip[2] = VLEN(disp);
# Line 634 | Line 633 | char  *s
633   )
634   {
635          static char  *altname[]={NULL,VIEWSTR,"rpict","rview","rvu","rpiece","pinterp",NULL};
637        extern char  *progname;
636          char  *cp;
637          char  **an;
638                                          /* add program name to list */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines