132 |
|
free(ptr); |
133 |
|
} |
134 |
|
|
135 |
+ |
/* compute square of real value */ |
136 |
+ |
static double sq(double x) { return x*x; } |
137 |
+ |
|
138 |
|
/* Get vector for this angle basis index (front exiting) */ |
139 |
|
int |
140 |
|
fo_getvec(FVECT v, double ndxr, void *p) |
144 |
|
double randX = ndxr - ndx; |
145 |
|
double rx[2]; |
146 |
|
int li; |
147 |
< |
double pol, azi, d; |
147 |
> |
double azi, d; |
148 |
|
|
149 |
|
if ((ndxr < 0) | (ndx >= ab->nangles)) |
150 |
|
return RC_FAIL; |
151 |
|
for (li = 0; ndx >= ab->lat[li].nphis; li++) |
152 |
|
ndx -= ab->lat[li].nphis; |
153 |
|
SDmultiSamp(rx, 2, randX); |
154 |
< |
pol = M_PI/180.*( (1.-rx[0])*ab->lat[li].tmin + |
155 |
< |
rx[0]*ab->lat[li+1].tmin ); |
154 |
> |
d = (1. - randX)*sq(cos(M_PI/180.*ab->lat[li].tmin)) + |
155 |
> |
randX*sq(cos(M_PI/180.*ab->lat[li+1].tmin)); |
156 |
> |
v[2] = d = sqrt(d); /* cos(pol) */ |
157 |
|
azi = 2.*M_PI*(ndx + rx[1] - .5)/ab->lat[li].nphis; |
154 |
– |
v[2] = d = cos(pol); |
158 |
|
d = sqrt(1. - d*d); /* sin(pol) */ |
159 |
|
v[0] = cos(azi)*d; |
160 |
|
v[1] = sin(azi)*d; |
186 |
|
ndx += ab->lat[li].nphis; |
187 |
|
return ndx; |
188 |
|
} |
186 |
– |
|
187 |
– |
/* compute square of real value */ |
188 |
– |
static double sq(double x) { return x*x; } |
189 |
|
|
190 |
|
/* Get projected solid angle for this angle basis index (universal) */ |
191 |
|
double |