104 |
|
int |
105 |
|
use_symmetry(FVECT vec) |
106 |
|
{ |
107 |
< |
const double phi = get_phi360(vec); |
107 |
> |
double phi = get_phi360(vec); |
108 |
> |
/* because of -0. issue */ |
109 |
> |
while (phi >= 360.) phi -= 360.; |
110 |
> |
while (phi < 0.) phi += 360.; |
111 |
|
|
112 |
|
switch (inp_coverage) { |
113 |
|
case INP_QUAD1|INP_QUAD2|INP_QUAD3|INP_QUAD4: |
228 |
|
void |
229 |
|
ovec_from_pos(FVECT vec, int xpos, int ypos) |
230 |
|
{ |
231 |
< |
double uv[2]; |
231 |
> |
RREAL uv[2]; |
232 |
|
double r2; |
233 |
|
|
234 |
< |
SDsquare2disk(uv, (xpos+.5)/grid_res, (ypos+.5)/grid_res); |
234 |
> |
square2disk(uv, (xpos+.5)/grid_res, (ypos+.5)/grid_res); |
235 |
|
/* uniform hemispherical projection */ |
236 |
|
r2 = uv[0]*uv[0] + uv[1]*uv[1]; |
237 |
|
vec[0] = vec[1] = sqrt(2. - r2); |
244 |
|
void |
245 |
|
pos_from_vec(int pos[2], const FVECT vec) |
246 |
|
{ |
247 |
< |
double sq[2]; /* uniform hemispherical projection */ |
247 |
> |
RREAL sq[2]; /* uniform hemispherical projection */ |
248 |
|
double norm = 1./sqrt(1. + fabs(vec[2])); |
249 |
|
|
250 |
< |
SDdisk2square(sq, vec[0]*norm, vec[1]*norm); |
250 |
> |
disk2square(sq, vec[0]*norm, vec[1]*norm); |
251 |
|
|
252 |
|
pos[0] = (int)(sq[0]*grid_res); |
253 |
|
pos[1] = (int)(sq[1]*grid_res); |
481 |
|
double t, full_dist; |
482 |
|
/* get relative position */ |
483 |
|
t = Acos(DOT(invec, mig->rbfv[0]->invec)); |
484 |
< |
if (t < M_PI/grid_res) { /* near first DSF */ |
484 |
> |
if (t <= .001) { /* near first DSF */ |
485 |
|
n = sizeof(RBFNODE) + sizeof(RBFVAL)*(mig->rbfv[0]->nrbf-1); |
486 |
|
rbf = (RBFNODE *)malloc(n); |
487 |
|
if (rbf == NULL) |
491 |
|
return(rbf); |
492 |
|
} |
493 |
|
full_dist = acos(DOT(mig->rbfv[0]->invec, mig->rbfv[1]->invec)); |
494 |
< |
if (t > full_dist-M_PI/grid_res) { /* near second DSF */ |
494 |
> |
if (t >= full_dist-.001) { /* near second DSF */ |
495 |
|
n = sizeof(RBFNODE) + sizeof(RBFVAL)*(mig->rbfv[1]->nrbf-1); |
496 |
|
rbf = (RBFNODE *)malloc(n); |
497 |
|
if (rbf == NULL) |