86 |
|
return (a <= 1e-6) & (a >= -1e-6); |
87 |
|
} |
88 |
|
|
89 |
< |
/* returns the name of the given tag */ |
89 |
> |
/* Returns the name of the given tag */ |
90 |
|
#ifdef ezxml_name |
91 |
|
#undef ezxml_name |
92 |
|
static char * |
98 |
|
} |
99 |
|
#endif |
100 |
|
|
101 |
< |
/* returns the given tag's character content or empty string if none */ |
101 |
> |
/* Returns the given tag's character content or empty string if none */ |
102 |
|
#ifdef ezxml_txt |
103 |
|
#undef ezxml_txt |
104 |
|
static char * |
159 |
|
|
160 |
|
/* get vector for this angle basis index (front exiting) */ |
161 |
|
static int |
162 |
< |
fo_getvec(FVECT v, int ndx, double randX, void *p) |
162 |
> |
fo_getvec(FVECT v, double ndxr, void *p) |
163 |
|
{ |
164 |
< |
ANGLE_BASIS *ab = (ANGLE_BASIS *)p; |
164 |
> |
ANGLE_BASIS *ab = (ANGLE_BASIS *)p; |
165 |
> |
int ndx = (int)ndxr; |
166 |
> |
double randX = ndxr - ndx; |
167 |
|
double rx[2]; |
168 |
|
int li; |
169 |
|
double pol, azi, d; |
170 |
|
|
171 |
< |
if ((ndx < 0) | (ndx >= ab->nangles)) |
171 |
> |
if ((ndxr < 0) | (ndx >= ab->nangles)) |
172 |
|
return RC_FAIL; |
173 |
|
for (li = 0; ndx >= ab->lat[li].nphis; li++) |
174 |
|
ndx -= ab->lat[li].nphis; |
187 |
|
static int |
188 |
|
fo_getndx(const FVECT v, void *p) |
189 |
|
{ |
190 |
< |
ANGLE_BASIS *ab = (ANGLE_BASIS *)p; |
190 |
> |
ANGLE_BASIS *ab = (ANGLE_BASIS *)p; |
191 |
|
int li, ndx; |
192 |
|
double pol, azi, d; |
193 |
|
|
239 |
|
|
240 |
|
/* get vector for this angle basis index (back incident) */ |
241 |
|
static int |
242 |
< |
bi_getvec(FVECT v, int ndx, double randX, void *p) |
242 |
> |
bi_getvec(FVECT v, double ndxr, void *p) |
243 |
|
{ |
244 |
< |
if (!fo_getvec(v, ndx, randX, p)) |
244 |
> |
if (!fo_getvec(v, ndxr, p)) |
245 |
|
return RC_FAIL; |
246 |
|
|
247 |
|
v[0] = -v[0]; |
266 |
|
|
267 |
|
/* get vector for this angle basis index (back exiting) */ |
268 |
|
static int |
269 |
< |
bo_getvec(FVECT v, int ndx, double randX, void *p) |
269 |
> |
bo_getvec(FVECT v, double ndxr, void *p) |
270 |
|
{ |
271 |
< |
if (!fo_getvec(v, ndx, randX, p)) |
271 |
> |
if (!fo_getvec(v, ndxr, p)) |
272 |
|
return RC_FAIL; |
273 |
|
|
274 |
|
v[2] = -v[2]; |
291 |
|
|
292 |
|
/* get vector for this angle basis index (front incident) */ |
293 |
|
static int |
294 |
< |
fi_getvec(FVECT v, int ndx, double randX, void *p) |
294 |
> |
fi_getvec(FVECT v, double ndxr, void *p) |
295 |
|
{ |
296 |
< |
if (!fo_getvec(v, ndx, randX, p)) |
296 |
> |
if (!fo_getvec(v, ndxr, p)) |
297 |
|
return RC_FAIL; |
298 |
|
|
299 |
|
v[0] = -v[0]; |
420 |
|
sdata = ezxml_txt(ezxml_child(wdb, "WavelengthDataDirection")); |
421 |
|
/* |
422 |
|
* Remember that front and back are reversed from WINDOW 6 orientations |
423 |
+ |
* Favor their "Front" (incoming light) since that's more often valid |
424 |
|
*/ |
425 |
< |
if ((tfront = !strcasecmp(sdata, "Transmission Back")) || |
426 |
< |
(sd->tf == NULL && |
427 |
< |
!strcasecmp(sdata, "Transmission Front"))) { |
425 |
> |
tfront = !strcasecmp(sdata, "Transmission Back"); |
426 |
> |
if (!strcasecmp(sdata, "Transmission Front") || |
427 |
> |
tfront & (sd->tf == NULL)) { |
428 |
|
if (sd->tf != NULL) |
429 |
|
SDfreeSpectralDF(sd->tf); |
430 |
|
if ((sd->tf = SDnewSpectralDF(1)) == NULL) |
798 |
|
randX = (randX*maxval - mcd->carr[ilower]) / |
799 |
|
(double)(mcd->carr[iupper] - mcd->carr[ilower]); |
800 |
|
/* convert index to vector */ |
801 |
< |
if ((*mcd->ob_vec)(outVec, i, randX, mcd->ob_priv)) |
801 |
> |
if ((*mcd->ob_vec)(outVec, i+randX, mcd->ob_priv)) |
802 |
|
return SDEnone; |
803 |
|
strcpy(SDerrorDetail, "BSDF sampling fault"); |
804 |
|
return SDEinternal; |