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.45 by schorsch, Sat Oct 23 18:55:53 2004 UTC vs.
Revision 2.49 by schorsch, Thu Apr 24 10:28:25 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 +
13 + #include "platform.h"
14   #ifndef NON_POSIX /* XXX need abstraction for process management */
15   #include <sys/wait.h>
16   #endif
17  
16 #include "platform.h"
18   #include "standard.h"
19   #include "color.h"
20   #include "view.h"
# Line 248 | Line 249 | init(                  /* set up output file and start rpict */
249                                          /* compute piece size */
250          hres /= hmult;
251          vres /= vmult;
252 +        if (hres <= 0 || vres <= 0) {
253 +                fprintf(stderr, "%s: illegal resolution/subdivision\n", progname);
254 +                exit(1);
255 +        }
256          normaspect(viewaspect(&ourview)*hmult/vmult, &pixaspect, &hres, &vres);
257          sprintf(hrbuf, "%d", hres);
258          rpargv[rpargc++] = "-x"; rpargv[rpargc++] = hrbuf;
# Line 433 | Line 438 | rpiece(void)                   /* render picture piece by piece */
438          pview = ourview;
439          switch (ourview.type) {
440          case VT_PER:
441 <                pview.horiz = 2.*180./PI*atan(
442 <                                tan(PI/180./2.*ourview.horiz)/hmult );
443 <                pview.vert = 2.*180./PI*atan(
444 <                                tan(PI/180./2.*ourview.vert)/vmult );
441 >                pview.horiz = (2.*180./PI)*atan(
442 >                                tan((PI/180./2.)*ourview.horiz)/hmult );
443 >                pview.vert = (2.*180./PI)*atan(
444 >                                tan((PI/180./2.)*ourview.vert)/vmult );
445                  break;
446          case VT_PAR:
447          case VT_ANG:
# Line 445 | Line 450 | rpiece(void)                   /* render picture piece by piece */
450                  break;
451          case VT_CYL:
452                  pview.horiz = ourview.horiz / hmult;
453 <                pview.vert = 2.*180./PI*atan(
454 <                                tan(PI/180./2.*ourview.vert)/vmult );
453 >                pview.vert = (2.*180./PI)*atan(
454 >                                tan((PI/180./2.)*ourview.vert)/vmult );
455                  break;
456          case VT_HEM:
457 <                pview.horiz = 2.*180./PI*asin(
458 <                                sin(PI/180./2.*ourview.horiz)/hmult );
459 <                pview.vert = 2.*180./PI*asin(
460 <                                sin(PI/180./2.*ourview.vert)/vmult );
457 >                pview.horiz = (2.*180./PI)*asin(
458 >                                sin((PI/180./2.)*ourview.horiz)/hmult );
459 >                pview.vert = (2.*180./PI)*asin(
460 >                                sin((PI/180./2.)*ourview.vert)/vmult );
461 >                break;
462 >        case VT_PLS:
463 >                pview.horiz = sin((PI/180./2.)*ourview.horiz) /
464 >                                (1.0 + cos((PI/180./2.)*ourview.horiz)) / hmult;
465 >                pview.horiz *= pview.horiz;
466 >                pview.horiz = (2.*180./PI)*acos((1. - pview.horiz) /
467 >                                                (1. + pview.horiz));
468 >                pview.vert = sin((PI/180./2.)*ourview.vert) /
469 >                                (1.0 + cos((PI/180./2.)*ourview.vert)) / vmult;
470 >                pview.vert *= pview.vert;
471 >                pview.vert = (2.*180./PI)*acos((1. - pview.vert) /
472 >                                                (1. + pview.vert));
473                  break;
474          default:
475                  fprintf(stderr, "%s: unknown view type '-vt%c'\n",

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines