| 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 |
> |
fputs(nm, stdout); |
| 84 |
> |
if (lamb->spec.flags) |
| 85 |
> |
printf("\t%4.1f %4.1f %4.1f\t\t", |
| 86 |
|
100.*lamb->cieY*lamb->spec.cx/lamb->spec.cy, |
| 87 |
|
100.*lamb->cieY, |
| 88 |
|
100.*lamb->cieY*(1.f - lamb->spec.cx - lamb->spec.cy)/lamb->spec.cy); |
| 89 |
+ |
else |
| 90 |
+ |
fputs("\t 0 0 0\t\t", stdout); |
| 91 |
|
if (df) |
| 92 |
|
printf("%5.1f%%\t\t%.2f deg\n", 100.*df->maxHemi, |
| 93 |
|
sqrt(df->minProjSA/M_PI)*(360./M_PI)); |
| 94 |
|
else |
| 95 |
< |
puts("0%\t\t180"); |
| 95 |
> |
puts(" 0%\t\t180 deg"); |
| 96 |
|
} |
| 97 |
|
|
| 98 |
|
/* Add a value to stats */ |
| 226 |
|
return; |
| 227 |
|
} |
| 228 |
|
nothing2do: |
| 229 |
< |
printf("%s\t0\t0\t0\n", nm); |
| 229 |
> |
printf("%s\t 0\t 0\t 0\n", nm); |
| 230 |
|
} |
| 231 |
|
|
| 232 |
|
/* Report on the given BSDF XML file */ |
| 240 |
|
puts("====================================================="); |
| 241 |
|
printf("File: '%s'\n", fname); |
| 242 |
|
SDclearBSDF(&myBSDF, fname); |
| 243 |
< |
pth = getpath(fname, getrlibpath(), R_OK); |
| 243 |
> |
pth = getpath(fname, getrlibpath(), 0); |
| 244 |
|
if (!pth) { |
| 245 |
|
fprintf(stderr, "Cannot find file '%s'\n", fname); |
| 246 |
|
return 0; |