145 |
|
return(1); |
146 |
|
} |
147 |
|
|
148 |
< |
#if 1 |
148 |
> |
#ifndef TEST_MAIN |
149 |
|
/* Read in PAB-Opto BSDF files and output RBF interpolant */ |
150 |
|
int |
151 |
|
main(int argc, char *argv[]) |
214 |
|
return(1); |
215 |
|
/* reduce data set */ |
216 |
|
make_rbfrep(); |
217 |
+ |
#ifdef DEBUG |
218 |
+ |
fprintf(stderr, "Minimum BSDF = %.4f\n", bsdf_min); |
219 |
+ |
#endif |
220 |
|
/* produce spheres at meas. */ |
221 |
|
puts("void plastic yellow\n0\n0\n5 .6 .4 .01 .04 .08\n"); |
222 |
|
min_log = log(bsdf_min*.5); |
225 |
|
for (j = 0; j < GRIDRES; j++) |
226 |
|
if (dsf_grid[i][j].nval > 0) { |
227 |
|
ovec_from_pos(dir, i, j); |
228 |
< |
bsdf = dsf_grid[i][j].vsum/(dsf_grid[i][j].nval*dir[2]); |
228 |
> |
bsdf = dsf_grid[i][j].vsum / |
229 |
> |
(dsf_grid[i][j].nval*output_orient*dir[2]); |
230 |
|
if (bsdf <= bsdf_min*.6) |
231 |
|
continue; |
232 |
|
bsdf = log(bsdf) - min_log; |
242 |
|
sprintf(buf, "gensurf tgreen bsdf - - - %d %d", GRIDRES-1, GRIDRES-1); |
243 |
|
pfp = popen(buf, "w"); |
244 |
|
if (pfp == NULL) { |
245 |
< |
fputs(buf, stderr); |
242 |
< |
fputs(": cannot start command\n", stderr); |
245 |
> |
fprintf(stderr, "%s: cannot open '| %s'\n", argv[0], buf); |
246 |
|
return(1); |
247 |
|
} |
248 |
|
for (i = 0; i < GRIDRES; i++) |
249 |
|
for (j = 0; j < GRIDRES; j++) { |
250 |
|
ovec_from_pos(dir, i, j); |
251 |
< |
bsdf = eval_rbfrep(dsf_list, dir) / dir[2]; |
251 |
> |
bsdf = eval_rbfrep(dsf_list, dir) / (output_orient*dir[2]); |
252 |
|
bsdf = log(bsdf) - min_log; |
253 |
|
fprintf(pfp, "%.8e %.8e %.8e\n", |
254 |
|
dir[0]*bsdf, dir[1]*bsdf, dir[2]*bsdf); |