--- ray/src/cv/bsdf2rad.c 2014/03/30 17:28:04 2.11 +++ ray/src/cv/bsdf2rad.c 2016/03/06 01:13:17 2.15 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: bsdf2rad.c,v 2.11 2014/03/30 17:28:04 greg Exp $"; +static const char RCSid[] = "$Id: bsdf2rad.c,v 2.15 2016/03/06 01:13:17 schorsch Exp $"; #endif /* * Plot 3-D BSDF output based on scattering interpolant or XML representation @@ -22,7 +22,7 @@ const float colarr[6][3] = { .5, 1., 1. }; -#ifdef _WIN32 +#if defined(_WIN32) || defined(_WIN64) char validf[] = "-e \"valid(s,t)=X`SYS(s,t)^2+Y`SYS(s,t)^2+Z`SYS(s,t)^2-1e-7\""; #else char validf[] = "-e 'valid(s,t)=X`SYS(s,t)^2+Y`SYS(s,t)^2+Z`SYS(s,t)^2-1e-7'"; @@ -124,17 +124,21 @@ main(int argc, char *argv[]) #ifdef DEBUG if (inpXML) fprintf(stderr, "Hemispherical %s: %.3f\n", - (output_orient > 0 ? "reflection" : "transmission"), + (output_orient > 0 ^ input_orient > 0 ? + "transmission" : "reflection"), SDdirectHemi(idir, SDsampSp|SDsampDf | - (output_orient > 0 ? - SDsampR : SDsampT), &myBSDF)); + (output_orient > 0 ^ input_orient > 0 ? + SDsampT : SDsampR), &myBSDF)); else if (rbf == NULL) fputs("Empty RBF\n", stderr); else fprintf(stderr, "Hemispherical %s: %.3f\n", - (output_orient > 0 ? "reflection" : "transmission"), + (output_orient > 0 ^ input_orient > 0 ? + "transmission" : "reflection"), rbf->vtotal); #endif + printf("# Incident direction (theta,phi) = (%.2f,%.2f) deg.\n\n", + (180./M_PI)*theta, (180./M_PI)*phi); printf("void trans tmat\n0\n0\n7 %f %f %f .04 .04 .9 1\n", colarr[n][0], colarr[n][1], colarr[n][2]); if (showPeaks && rbf != NULL) { @@ -142,7 +146,7 @@ main(int argc, char *argv[]) 1.-colarr[n][0], 1.-colarr[n][1], 1.-colarr[n][2]); for (i = 0; i < rbf->nrbf; i++) { ovec_from_pos(odir, rbf->rbfa[i].gx, rbf->rbfa[i].gy); - bsdf = eval_rbfrep(rbf, odir) / (output_orient*odir[2]); + bsdf = eval_rbfrep(rbf, odir); bsdf = log(bsdf + 1e-5) - min_log; printf("pmat sphere p%d\n0\n0\n4 %f %f %f %f\n", i+1, odir[0]*bsdf, odir[1]*bsdf, odir[2]*bsdf, @@ -167,8 +171,7 @@ main(int argc, char *argv[]) return(1); bsdf = sval.cieY; } else - bsdf = eval_rbfrep(rbf, odir) / - (output_orient*odir[2]); + bsdf = eval_rbfrep(rbf, odir); bsdf = log(bsdf + 1e-5) - min_log; fprintf(fp, "%.8e %.8e %.8e\n", odir[0]*bsdf, odir[1]*bsdf, odir[2]*bsdf);