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

Comparing ray/src/util/rpiece.c (file contents):
Revision 2.44 by greg, Tue Jun 8 19:48:31 2004 UTC vs.
Revision 2.48 by greg, Tue Mar 11 02:21:47 2008 UTC

# Line 9 | Line 9 | static const char      RCSid[] = "$Id$";
9   #include <stdio.h>
10   #include <signal.h>
11   #include <sys/types.h>
12 < #include <sys/wait.h>
12 > #ifndef NON_POSIX /* XXX need abstraction for process management */
13 > #include <sys/wait.h>
14 > #endif
15  
16   #include "platform.h"
17   #include "standard.h"
# Line 246 | Line 248 | init(                  /* set up output file and start rpict */
248                                          /* compute piece size */
249          hres /= hmult;
250          vres /= vmult;
251 +        if (hres <= 0 || vres <= 0) {
252 +                fprintf(stderr, "%s: illegal resolution/subdivision\n", progname);
253 +                exit(1);
254 +        }
255          normaspect(viewaspect(&ourview)*hmult/vmult, &pixaspect, &hres, &vres);
256          sprintf(hrbuf, "%d", hres);
257          rpargv[rpargc++] = "-x"; rpargv[rpargc++] = hrbuf;
# Line 431 | Line 437 | rpiece(void)                   /* render picture piece by piece */
437          pview = ourview;
438          switch (ourview.type) {
439          case VT_PER:
440 <                pview.horiz = 2.*180./PI*atan(
441 <                                tan(PI/180./2.*ourview.horiz)/hmult );
442 <                pview.vert = 2.*180./PI*atan(
443 <                                tan(PI/180./2.*ourview.vert)/vmult );
440 >                pview.horiz = (2.*180./PI)*atan(
441 >                                tan((PI/180./2.)*ourview.horiz)/hmult );
442 >                pview.vert = (2.*180./PI)*atan(
443 >                                tan((PI/180./2.)*ourview.vert)/vmult );
444                  break;
445          case VT_PAR:
446          case VT_ANG:
# Line 443 | Line 449 | rpiece(void)                   /* render picture piece by piece */
449                  break;
450          case VT_CYL:
451                  pview.horiz = ourview.horiz / hmult;
452 <                pview.vert = 2.*180./PI*atan(
453 <                                tan(PI/180./2.*ourview.vert)/vmult );
452 >                pview.vert = (2.*180./PI)*atan(
453 >                                tan((PI/180./2.)*ourview.vert)/vmult );
454                  break;
455          case VT_HEM:
456 <                pview.horiz = 2.*180./PI*asin(
457 <                                sin(PI/180./2.*ourview.horiz)/hmult );
458 <                pview.vert = 2.*180./PI*asin(
459 <                                sin(PI/180./2.*ourview.vert)/vmult );
456 >                pview.horiz = (2.*180./PI)*asin(
457 >                                sin((PI/180./2.)*ourview.horiz)/hmult );
458 >                pview.vert = (2.*180./PI)*asin(
459 >                                sin((PI/180./2.)*ourview.vert)/vmult );
460 >                break;
461 >        case VT_PLS:
462 >                pview.horiz = sin((PI/180./2.)*ourview.horiz) /
463 >                                (1.0 + cos((PI/180./2.)*ourview.horiz)) / hmult;
464 >                pview.horiz *= pview.horiz;
465 >                pview.horiz = (2.*180./PI)*acos((1. - pview.horiz) /
466 >                                                (1. + pview.horiz));
467 >                pview.vert = sin((PI/180./2.)*ourview.vert) /
468 >                                (1.0 + cos((PI/180./2.)*ourview.vert)) / vmult;
469 >                pview.vert *= pview.vert;
470 >                pview.vert = (2.*180./PI)*acos((1. - pview.vert) /
471 >                                                (1. + pview.vert));
472                  break;
473          default:
474                  fprintf(stderr, "%s: unknown view type '-vt%c'\n",

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines