| 9 |
|
|
| 10 |
|
#define _USE_MATH_DEFINES |
| 11 |
|
#include "rtio.h" |
| 12 |
+ |
#include "fvect.h" |
| 13 |
|
#include <stdlib.h> |
| 14 |
|
#include <ctype.h> |
| 15 |
|
#include <math.h> |
| 40 |
|
float *va; /* corresponding value array */ |
| 41 |
|
} PGINTERP; |
| 42 |
|
|
| 42 |
– |
extern void SDdisk2square(double sq[2], double diskx, double disky); |
| 43 |
– |
|
| 43 |
|
char *progname; /* global argv[0] */ |
| 44 |
|
|
| 45 |
|
int incident_side = 0; /* signum(intheta) */ |
| 129 |
|
|
| 130 |
|
/* Compute square location from normalized input/output vector */ |
| 131 |
|
static void |
| 132 |
< |
sq_from_ang(double sq[2], double theta, double phi) |
| 132 |
> |
sq_from_ang(RREAL sq[2], double theta, double phi) |
| 133 |
|
{ |
| 134 |
|
double vec[3]; |
| 135 |
|
double norm; |
| 140 |
|
vec[2] = sqrt(1. - vec[2]*vec[2]); |
| 141 |
|
norm = 1./sqrt(1. + vec[2]); |
| 142 |
|
|
| 143 |
< |
SDdisk2square(sq, vec[0]*norm, vec[1]*norm); |
| 143 |
> |
disk2square(sq, vec[0]*norm, vec[1]*norm); |
| 144 |
|
} |
| 145 |
|
|
| 146 |
|
/* Compute quantized grid position from normalized input/output vector */ |
| 147 |
|
static void |
| 148 |
|
pos_from_ang(int gp[2], double theta, double phi) |
| 149 |
|
{ |
| 150 |
< |
double sq[2]; |
| 150 |
> |
RREAL sq[2]; |
| 151 |
|
|
| 152 |
|
sq_from_ang(sq, theta, phi); |
| 153 |
|
gp[0] = (int)(sq[0]*ANGRES); |
| 464 |
|
int |
| 465 |
|
main(int argc, char *argv[]) |
| 466 |
|
{ |
| 468 |
– |
char *flist[MAX_INPUTS]; |
| 467 |
|
PGINPUT *slist[3]; |
| 468 |
|
int i, j; |
| 469 |
|
int ndx[3]; |
| 489 |
|
default: |
| 490 |
|
goto userr; |
| 491 |
|
} |
| 492 |
< |
if (i > argc-3) |
| 492 |
> |
if (i != argc-3) |
| 493 |
|
goto userr; |
| 494 |
|
for (j = 0; j < 3; j++) { /* prep input channels */ |
| 495 |
+ |
char *flist[MAX_INPUTS]; |
| 496 |
|
int k, n; |
| 497 |
|
n = wordfile(flist, MAX_INPUTS, argv[i+j]); |
| 498 |
< |
if (n <= 0) { |
| 498 |
> |
if ((n <= 0) | (n >= MAX_INPUTS-1)) { |
| 499 |
|
fputs(argv[i+j], stderr); |
| 500 |
< |
fputs(": cannot load input file names\n", stderr); |
| 500 |
> |
if (n < 0) |
| 501 |
> |
fputs(": cannot load input file names\n", stderr); |
| 502 |
> |
else if (n == 0) |
| 503 |
> |
fputs(": empty file\n", stderr); |
| 504 |
> |
else /* n >= MAX_INPUTS-1 */ |
| 505 |
> |
fputs(": too many file names\n", stderr); |
| 506 |
|
return(1); |
| 507 |
|
} |
| 508 |
|
slist[j] = (PGINPUT *)malloc(sizeof(PGINPUT)*(n+1)); |