| 268 |
|
{ |
| 269 |
|
VIEW pview; |
| 270 |
|
int xorg, yorg; |
| 271 |
< |
|
| 271 |
> |
/* compute view parameters */ |
| 272 |
> |
copystruct(&pview, &ourview); |
| 273 |
> |
switch (ourview.type) { |
| 274 |
> |
case VT_PER: |
| 275 |
> |
pview.horiz = 2.*180./PI*atan( |
| 276 |
> |
tan(PI/180./2.*ourview.horiz)/hmult ); |
| 277 |
> |
pview.vert = 2.*180./PI*atan( |
| 278 |
> |
tan(PI/180./2.*ourview.vert)/vmult ); |
| 279 |
> |
break; |
| 280 |
> |
case VT_PAR: |
| 281 |
> |
case VT_ANG: |
| 282 |
> |
pview.horiz = ourview.horiz / hmult; |
| 283 |
> |
pview.vert = ourview.vert / vmult; |
| 284 |
> |
break; |
| 285 |
> |
case VT_HEM: |
| 286 |
> |
pview.horiz = 2.*180./PI*asin( |
| 287 |
> |
sin(PI/180./2.*ourview.horiz)/hmult ); |
| 288 |
> |
pview.vert = 2.*180./PI*asin( |
| 289 |
> |
sin(PI/180./2.*ourview.vert)/vmult ); |
| 290 |
> |
break; |
| 291 |
> |
default: |
| 292 |
> |
fprintf(stderr, "%s: unknown view type '-vt%c'\n", |
| 293 |
> |
progname, ourview.type); |
| 294 |
> |
exit(cleanup(1)); |
| 295 |
> |
} |
| 296 |
> |
/* render each piece */ |
| 297 |
|
while (nextpiece(&xorg, &yorg)) { |
| 298 |
< |
copystruct(&pview, &ourview); /* compute view for piece */ |
| 299 |
< |
switch (ourview.type) { |
| 275 |
< |
case VT_PER: |
| 276 |
< |
pview.horiz = 2.*180./PI*atan( |
| 277 |
< |
tan(PI/180./2.*ourview.horiz)/hmult ); |
| 278 |
< |
pview.vert = 2.*180./PI*atan( |
| 279 |
< |
tan(PI/180./2.*ourview.vert)/vmult ); |
| 280 |
< |
break; |
| 281 |
< |
case VT_PAR: |
| 282 |
< |
case VT_ANG: |
| 283 |
< |
pview.horiz = ourview.horiz / hmult; |
| 284 |
< |
pview.vert = ourview.vert / vmult; |
| 285 |
< |
break; |
| 286 |
< |
case VT_HEM: |
| 287 |
< |
pview.horiz = 2.*180./PI*asin( |
| 288 |
< |
sin(PI/180./2.*ourview.horiz)/hmult ); |
| 289 |
< |
pview.vert = 2.*180./PI*asin( |
| 290 |
< |
sin(PI/180./2.*ourview.vert)/vmult ); |
| 291 |
< |
break; |
| 292 |
< |
default: |
| 293 |
< |
fprintf(stderr, "%s: unknown view type '-vt%c'\n", |
| 294 |
< |
progname, ourview.type); |
| 295 |
< |
exit(cleanup(1)); |
| 296 |
< |
} |
| 297 |
< |
pview.hoff += xorg - 0.5*(hmult-1); |
| 298 |
< |
pview.voff += yorg - 0.5*(vmult-1); |
| 298 |
> |
pview.hoff = ourview.hoff + xorg - 0.5*(hmult-1); |
| 299 |
> |
pview.voff = ourview.voff + yorg - 0.5*(vmult-1); |
| 300 |
|
fputs(VIEWSTR, torp); |
| 301 |
|
fprintview(&pview, torp); |
| 302 |
|
putc('\n', torp); |
| 303 |
< |
fflush(torp); /* assign piece to rpict */ |
| 303 |
> |
fflush(torp); /* assigns piece to rpict */ |
| 304 |
|
putpiece(xorg, yorg); /* place piece in output */ |
| 305 |
|
if (verbose) { /* notify caller */ |
| 306 |
|
printf("%d %d done\n", xorg, yorg); |
| 326 |
|
} |
| 327 |
|
/* check header from rpict */ |
| 328 |
|
getheader(fromrp, NULL); |
| 329 |
< |
if (fscnresolu(&hr, &vr, fromrp) < 0 || hr != hres || vr != vres) { |
| 329 |
> |
if (fscnresolu(&hr, &vr, fromrp) < 0 || hr != hres | vr != vres) { |
| 330 |
|
fprintf(stderr, "%s: resolution mismatch from %s\n", |
| 331 |
|
progname, rpargv[0]); |
| 332 |
|
exit(cleanup(1)); |