56 |
|
new_theta = -new_theta; |
57 |
|
new_phi += 180.; |
58 |
|
} |
59 |
+ |
if ((theta_in_deg = new_theta) < 1.0) |
60 |
+ |
return(1); /* don't rely on phi near normal */ |
61 |
|
while (new_phi < 0) |
62 |
|
new_phi += 360.; |
63 |
|
while (new_phi >= 360.) |
66 |
|
single_plane_incident = (round(new_phi) == round(phi_in_deg)); |
67 |
|
else if (single_plane_incident < 0) |
68 |
|
single_plane_incident = 1; |
67 |
– |
theta_in_deg = new_theta; /* assume it's OK */ |
69 |
|
phi_in_deg = new_phi; |
70 |
|
if ((1. < new_phi) & (new_phi < 89.)) |
71 |
|
inp_coverage |= INP_QUAD1; |
176 |
|
if (sym & MIRROR_Y) |
177 |
|
for (n = rbf->nrbf; n-- > 0; ) |
178 |
|
rbf->rbfa[n].gy = grid_res-1 - rbf->rbfa[n].gy; |
179 |
+ |
} |
180 |
+ |
|
181 |
+ |
/* Rotate RBF to correspond to given incident vector */ |
182 |
+ |
void |
183 |
+ |
rotate_rbf(RBFNODE *rbf, const FVECT invec) |
184 |
+ |
{ |
185 |
+ |
static const FVECT vnorm = {.0, .0, 1.}; |
186 |
+ |
const double phi = atan2(invec[1],invec[0]) - |
187 |
+ |
atan2(rbf->invec[1],rbf->invec[0]); |
188 |
+ |
FVECT outvec; |
189 |
+ |
int pos[2]; |
190 |
+ |
int n; |
191 |
+ |
#ifdef DEBUG |
192 |
+ |
{ |
193 |
+ |
double tdiff = 180./M_PI*fabs(acos(invec[2])-acos(rbf->invec[2])); |
194 |
+ |
if (tdiff >= 1.5) |
195 |
+ |
fprintf(stderr, |
196 |
+ |
"%s: Warning - rotated theta differs by %.1f degrees\n", |
197 |
+ |
progname, tdiff); |
198 |
+ |
} |
199 |
+ |
#endif |
200 |
+ |
for (n = rbf->nrbf; n-- > 0; ) { |
201 |
+ |
ovec_from_pos(outvec, rbf->rbfa[n].gx, rbf->rbfa[n].gy); |
202 |
+ |
spinvector(outvec, outvec, vnorm, phi); |
203 |
+ |
pos_from_vec(pos, outvec); |
204 |
+ |
rbf->rbfa[n].gx = pos[0]; |
205 |
+ |
rbf->rbfa[n].gy = pos[1]; |
206 |
+ |
} |
207 |
+ |
VCOPY(rbf->invec, invec); |
208 |
|
} |
209 |
|
|
210 |
|
/* Compute volume associated with Gaussian lobe */ |