9 |
|
#include <stdio.h> |
10 |
|
#include <signal.h> |
11 |
|
#include <sys/types.h> |
12 |
– |
#include <sys/wait.h> |
12 |
|
|
13 |
|
#include "platform.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" |
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 |
|
} |
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]); |
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; |
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; |
278 |
|
fputs(VIEWSTR, fp); |
279 |
|
fprintview(&ourview, fp); |
280 |
|
putc('\n', fp); |
281 |
+ |
fputnow(fp); |
282 |
|
if (pixaspect < .99 || pixaspect > 1.01) |
283 |
|
fputaspect(pixaspect, fp); |
284 |
|
fputformat(COLRFMT, fp); |
445 |
|
pview = ourview; |
446 |
|
switch (ourview.type) { |
447 |
|
case VT_PER: |
448 |
< |
pview.horiz = 2.*180./PI*atan( |
449 |
< |
tan(PI/180./2.*ourview.horiz)/hmult ); |
450 |
< |
pview.vert = 2.*180./PI*atan( |
451 |
< |
tan(PI/180./2.*ourview.vert)/vmult ); |
448 |
> |
pview.horiz = (2.*180./PI)*atan( |
449 |
> |
tan((PI/180./2.)*ourview.horiz)/hmult ); |
450 |
> |
pview.vert = (2.*180./PI)*atan( |
451 |
> |
tan((PI/180./2.)*ourview.vert)/vmult ); |
452 |
|
break; |
453 |
|
case VT_PAR: |
454 |
|
case VT_ANG: |
457 |
|
break; |
458 |
|
case VT_CYL: |
459 |
|
pview.horiz = ourview.horiz / hmult; |
460 |
< |
pview.vert = 2.*180./PI*atan( |
461 |
< |
tan(PI/180./2.*ourview.vert)/vmult ); |
460 |
> |
pview.vert = (2.*180./PI)*atan( |
461 |
> |
tan((PI/180./2.)*ourview.vert)/vmult ); |
462 |
|
break; |
463 |
|
case VT_HEM: |
464 |
< |
pview.horiz = 2.*180./PI*asin( |
465 |
< |
sin(PI/180./2.*ourview.horiz)/hmult ); |
466 |
< |
pview.vert = 2.*180./PI*asin( |
467 |
< |
sin(PI/180./2.*ourview.vert)/vmult ); |
464 |
> |
pview.horiz = (2.*180./PI)*asin( |
465 |
> |
sin((PI/180./2.)*ourview.horiz)/hmult ); |
466 |
> |
pview.vert = (2.*180./PI)*asin( |
467 |
> |
sin((PI/180./2.)*ourview.vert)/vmult ); |
468 |
> |
break; |
469 |
> |
case VT_PLS: |
470 |
> |
pview.horiz = sin((PI/180./2.)*ourview.horiz) / |
471 |
> |
(1.0 + cos((PI/180./2.)*ourview.horiz)) / hmult; |
472 |
> |
pview.horiz *= pview.horiz; |
473 |
> |
pview.horiz = (2.*180./PI)*acos((1. - pview.horiz) / |
474 |
> |
(1. + pview.horiz)); |
475 |
> |
pview.vert = sin((PI/180./2.)*ourview.vert) / |
476 |
> |
(1.0 + cos((PI/180./2.)*ourview.vert)) / vmult; |
477 |
> |
pview.vert *= pview.vert; |
478 |
> |
pview.vert = (2.*180./PI)*acos((1. - pview.vert) / |
479 |
> |
(1. + pview.vert)); |
480 |
|
break; |
481 |
|
default: |
482 |
|
fprintf(stderr, "%s: unknown view type '-vt%c'\n", |