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.43 by schorsch, Fri Mar 26 21:36:20 2004 UTC vs.
Revision 2.51 by greg, Mon May 17 17:03:53 2010 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  
13   #include "platform.h"
14 < #include "rtio.h"
15 < #include "rtmisc.h"
14 > #ifndef NON_POSIX /* XXX need abstraction for process management */
15 > #include <sys/wait.h>
16 > #endif
17 >
18 > #include "standard.h"
19   #include "color.h"
20   #include "view.h"
21   #include "rtprocess.h"
# Line 106 | Line 108 | main(
108                  while ((rval = expandarg(&argc, &argv, i)) > 0)
109                          ;
110                  if (rval < 0) {
111 <                        fprintf(stderr, "%s: cannot expand '%s'",
111 >                        fprintf(stderr, "%s: cannot expand '%s'\n",
112                                          argv[0], argv[i]);
113                          exit(1);
114                  }
# Line 134 | Line 136 | main(
136                                  }
137                                  break;
138                          case 'p':               /* pixel aspect ratio? */
139 +                                if (argv[i][2] == 'm') {
140 +                                        fprintf(stderr, "%s: -pm unsupported\n",
141 +                                                argv[0]);
142 +                                        ++i;
143 +                                        continue;
144 +                                }
145                                  if (argv[i][2] != 'a' || argv[i][3])
146                                          break;
147                                  pixaspect = atof(argv[++i]);
# Line 142 | Line 150 | main(
150                                  if (argv[i][2])
151                                          break;
152                                  timelim = atof(argv[++i])*3600. + .5;
153 <                                break;
153 >                                continue;
154                          case 'x':               /* overall x resolution */
155                                  if (argv[i][2])
156                                          break;
# Line 247 | Line 255 | init(                  /* set up output file and start rpict */
255                                          /* compute piece size */
256          hres /= hmult;
257          vres /= vmult;
258 +        if (hres <= 0 || vres <= 0) {
259 +                fprintf(stderr, "%s: illegal resolution/subdivision\n", progname);
260 +                exit(1);
261 +        }
262          normaspect(viewaspect(&ourview)*hmult/vmult, &pixaspect, &hres, &vres);
263          sprintf(hrbuf, "%d", hres);
264          rpargv[rpargc++] = "-x"; rpargv[rpargc++] = hrbuf;
# Line 432 | Line 444 | rpiece(void)                   /* render picture piece by piece */
444          pview = ourview;
445          switch (ourview.type) {
446          case VT_PER:
447 <                pview.horiz = 2.*180./PI*atan(
448 <                                tan(PI/180./2.*ourview.horiz)/hmult );
449 <                pview.vert = 2.*180./PI*atan(
450 <                                tan(PI/180./2.*ourview.vert)/vmult );
447 >                pview.horiz = (2.*180./PI)*atan(
448 >                                tan((PI/180./2.)*ourview.horiz)/hmult );
449 >                pview.vert = (2.*180./PI)*atan(
450 >                                tan((PI/180./2.)*ourview.vert)/vmult );
451                  break;
452          case VT_PAR:
453          case VT_ANG:
# Line 444 | Line 456 | rpiece(void)                   /* render picture piece by piece */
456                  break;
457          case VT_CYL:
458                  pview.horiz = ourview.horiz / hmult;
459 <                pview.vert = 2.*180./PI*atan(
460 <                                tan(PI/180./2.*ourview.vert)/vmult );
459 >                pview.vert = (2.*180./PI)*atan(
460 >                                tan((PI/180./2.)*ourview.vert)/vmult );
461                  break;
462          case VT_HEM:
463 <                pview.horiz = 2.*180./PI*asin(
464 <                                sin(PI/180./2.*ourview.horiz)/hmult );
465 <                pview.vert = 2.*180./PI*asin(
466 <                                sin(PI/180./2.*ourview.vert)/vmult );
463 >                pview.horiz = (2.*180./PI)*asin(
464 >                                sin((PI/180./2.)*ourview.horiz)/hmult );
465 >                pview.vert = (2.*180./PI)*asin(
466 >                                sin((PI/180./2.)*ourview.vert)/vmult );
467 >                break;
468 >        case VT_PLS:
469 >                pview.horiz = sin((PI/180./2.)*ourview.horiz) /
470 >                                (1.0 + cos((PI/180./2.)*ourview.horiz)) / hmult;
471 >                pview.horiz *= pview.horiz;
472 >                pview.horiz = (2.*180./PI)*acos((1. - pview.horiz) /
473 >                                                (1. + pview.horiz));
474 >                pview.vert = sin((PI/180./2.)*ourview.vert) /
475 >                                (1.0 + cos((PI/180./2.)*ourview.vert)) / vmult;
476 >                pview.vert *= pview.vert;
477 >                pview.vert = (2.*180./PI)*acos((1. - pview.vert) /
478 >                                                (1. + pview.vert));
479                  break;
480          default:
481                  fprintf(stderr, "%s: unknown view type '-vt%c'\n",

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines