--- ray/src/common/testBSDF.c 2017/02/02 04:46:38 1.9 +++ ray/src/common/testBSDF.c 2017/04/11 16:14:05 1.11 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: testBSDF.c,v 1.9 2017/02/02 04:46:38 greg Exp $"; +static const char RCSid[] = "$Id: testBSDF.c,v 1.11 2017/04/11 16:14:05 greg Exp $"; #endif /* * Simple test program to demonstrate BSDF operation. @@ -24,10 +24,10 @@ Usage(const char *prog) printf(" i\t\t\t\t Report general information (metadata)\n"); printf(" c\t\t\t\t Report diffuse and specular components\n"); printf(" q theta_i phi_i theta_o phi_o\t Query BSDF for given path (CIE-XYZ)\n"); - printf(" s[r|t][s|d] N theta phi\t\t\t Generate N ray directions & colors at given incidence\n"); - printf(" h[s|d] theta phi\t\t\t Report hemispherical scatteromg at given incidence\n"); - printf(" r[s|d] theta phi\t\t\t Report hemispherical reflection at given incidence\n"); - printf(" t[s|d] theta phi\t\t\t Report hemispherical transmission at given incidence\n"); + printf(" s[r|t][s|d] N theta phi\t Generate N ray directions & colors at given incidence\n"); + printf(" h[s|d] theta phi\t\t Report hemispherical scattering at given incidence\n"); + printf(" r[s|d] theta phi\t\t Report hemispherical reflection at given incidence\n"); + printf(" t[s|d] theta phi\t\t Report hemispherical transmission at given incidence\n"); printf(" a theta phi [t2 p2]\t\t Report resolution (in proj. steradians) for given direction(s)\n"); printf(" ^D\t\t\t\t Quit program\n"); } @@ -47,6 +47,10 @@ vec_from_deg(FVECT v, double theta, double phi) static void printXYZ(const char *intro, const SDValue *vp) { + if (vp->cieY <= 1e-9) { + printf("%s0 0 0\n", intro); + return; + } printf("%s%.3e %.3e %.3e\n", intro, vp->spec.cx/vp->spec.cy*vp->cieY, vp->cieY,