29 |
|
const SimpleStats SSinit = {FHUGE, -FHUGE, .0, 0}; |
30 |
|
|
31 |
|
/* relative difference formula */ |
32 |
< |
#define rdiff(a,b) ((a)>(b) ? ((a)-(b))/(a) : ((b)-(a))/(b)) |
32 |
> |
#define rdiff(a,b) ((a)>(b) ? ((a)-(b))/((a)+FTINY) : ((b)-(a))/((b)+FTINY)) |
33 |
|
|
34 |
|
/* Figure out BSDF type (and optionally determine if in color) */ |
35 |
|
const char * |
80 |
|
void |
81 |
|
detailComponent(const char *nm, const SDValue *lamb, const SDSpectralDF *df) |
82 |
|
{ |
83 |
< |
printf("%s\t%4.1f %4.1f %4.1f\t\t", nm, |
83 |
> |
double Lamb = 0; |
84 |
> |
|
85 |
> |
fputs(nm, stdout); |
86 |
> |
if (lamb->spec.flags) { |
87 |
> |
printf("\t%4.1f %4.1f %4.1f\t\t", |
88 |
|
100.*lamb->cieY*lamb->spec.cx/lamb->spec.cy, |
89 |
|
100.*lamb->cieY, |
90 |
|
100.*lamb->cieY*(1.f - lamb->spec.cx - lamb->spec.cy)/lamb->spec.cy); |
91 |
+ |
Lamb = lamb->cieY; |
92 |
+ |
} else |
93 |
+ |
fputs("\t 0 0 0\t\t", stdout); |
94 |
|
if (df) |
95 |
< |
printf("%5.1f%%\t\t%.2f deg\n", 100.*df->maxHemi, |
95 |
> |
printf("%5.1f%%\t\t%.2f deg\n", 100.*(Lamb+df->maxHemi), |
96 |
|
sqrt(df->minProjSA/M_PI)*(360./M_PI)); |
97 |
|
else |
98 |
< |
puts("0%\t\t180"); |
98 |
> |
printf("%5.1f%%\t\t180 deg\n", Lamb); |
99 |
|
} |
100 |
|
|
101 |
|
/* Add a value to stats */ |
229 |
|
return; |
230 |
|
} |
231 |
|
nothing2do: |
232 |
< |
printf("%s\t0\t0\t0\n", nm); |
232 |
> |
printf("%s\t 0\t 0\t 0\n", nm); |
233 |
|
} |
234 |
|
|
235 |
|
/* Report on the given BSDF XML file */ |
243 |
|
puts("====================================================="); |
244 |
|
printf("File: '%s'\n", fname); |
245 |
|
SDclearBSDF(&myBSDF, fname); |
246 |
< |
pth = getpath(fname, getrlibpath(), R_OK); |
246 |
> |
pth = getpath(fname, getrlibpath(), 0); |
247 |
|
if (!pth) { |
248 |
|
fprintf(stderr, "Cannot find file '%s'\n", fname); |
249 |
|
return 0; |
257 |
|
printf("Type: %s\n", getBSDFtype(&myBSDF, &flags)); |
258 |
|
printf("Color: %d\n", (flags & F_IN_COLOR) != 0); |
259 |
|
printf("Has Geometry: %d\n", (myBSDF.mgf != NULL)); |
260 |
< |
puts("Component\tLambertian XYZ %\tMax. Dir\tMin. Angle"); |
260 |
> |
puts("Component\tLambertian XYZ (%)\tMax. Tot. Dir\tMin. Angle"); |
261 |
|
detailComponent("Interior Refl", &myBSDF.rLambFront, myBSDF.rf); |
262 |
|
detailComponent("Exterior Refl", &myBSDF.rLambBack, myBSDF.rb); |
263 |
|
detailComponent("Int->Ext Trans", &myBSDF.tLambFront, myBSDF.tf); |