ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cv/bsdf2rad.c
(Generate patch)

Comparing ray/src/cv/bsdf2rad.c (file contents):
Revision 2.36 by greg, Fri Jul 19 17:37:56 2019 UTC vs.
Revision 2.41 by greg, Tue Jun 3 21:31:51 2025 UTC

# Line 41 | Line 41 | const double   sph_xoffset = 15.;
41   #define bsdf_rad        (sph_rad*.25)
42   #define arrow_rad       (bsdf_rad*.015)
43  
44 #define FEQ(a,b)        ((a)-(b) <= 1e-7 && (b)-(a) <= 1e-7)
45
44   #define set_minlog()    overall_min = (overall_min < 1e-5) ? 1e-5 : overall_min; \
45                                  min_log10 = log10(overall_min) - .1
46  
49 char    *progname;
50
47   /* Get Fibonacci sphere vector (0 to NINCIDENT-1) */
48   static RREAL *
49   get_ivector(FVECT iv, int i)
# Line 146 | Line 142 | plotBSDF(const char *fname, const FVECT ivec, int dfl,
142                  SDValue sval;
143                  double  bsdf;
144                  ovec_from_pos(ovec, i*GRIDSTEP, j*GRIDSTEP);
145 <                if (SDreportError(SDevalBSDF(&sval, ovec,
146 <                                                ivec, sd), stderr))
145 >                if (SDreportError(SDevalBSDF(&sval, ivec,
146 >                                                ovec, sd), stderr))
147                          return(0);
148                  if (sval.cieY > overall_max)
149                          overall_max = sval.cieY;
# Line 348 | Line 344 | addrot(char *xf, const FVECT xp, const FVECT yp, const
344                  return(4);
345          }
346          theta = atan2(yp[2], zp[2]);
347 <        if (!FEQ(theta,0.0)) {
347 >        if (!FABSEQ(theta,0.0)) {
348                  sprintf(xf, " -rx %f", theta*(180./PI));
349                  while (*xf) ++xf;
350                  n += 2;
351          }
352          theta = Asin(-xp[2]);
353 <        if (!FEQ(theta,0.0)) {
353 >        if (!FABSEQ(theta,0.0)) {
354                  sprintf(xf, " -ry %f", theta*(180./PI));
355                  while (*xf) ++xf;
356                  n += 2;
357          }
358          theta = atan2(xp[1], xp[0]);
359 <        if (!FEQ(theta,0.0)) {
359 >        if (!FABSEQ(theta,0.0)) {
360                  sprintf(xf, " -rz %f", theta*(180./PI));
361                  /* while (*xf) ++xf; */
362                  n += 2;
# Line 640 | Line 636 | convert_mgf(const char *mgfdata)
636          if ((fp = popen(cmdbuf, "r")) == NULL ||
637                          fscanf(fp, "%f %f %f %f %f %f",
638                                  &xmin, &xmax, &ymin, &ymax, &zmin, &zmax) != 6
639 <                        || pclose(fp) < 0) {
639 >                        || pclose(fp) != 0) {
640                  fprintf(stderr, "%s: error reading from command: %s\n",
641                                  progname, cmdbuf);
642                  return;
# Line 711 | Line 707 | main(int argc, char *argv[])
707          double  myLim[2];
708          SDData  myBSDF;
709          int     a, n;
710 +                                                /* set global progname */
711 +        fixargv0(argv[0]);
712                                                  /* check arguments */
715        progname = argv[0];
713          a = 1;
714          myLim[0] = -1; myLim[1] = -2;           /* specified BSDF range? */
715          if (argc > a+3 && argv[a][0] == '-' && argv[a][1] == 'r') {
# Line 754 | Line 751 | main(int argc, char *argv[])
751                                  overall_min = myBSDF.rLambFront.cieY/PI;
752                          if (back_comp & SDsampR && myBSDF.rLambBack.cieY < overall_min*PI)
753                                  overall_min = myBSDF.rLambBack.cieY/PI;
754 <                        if ((front_comp|back_comp) & SDsampT &&
755 <                                        myBSDF.tLamb.cieY < overall_min*PI)
756 <                                overall_min = myBSDF.tLamb.cieY/PI;
754 >                        if (front_comp & SDsampT && myBSDF.tLambFront.cieY < overall_min*PI)
755 >                                overall_min = myBSDF.tLambFront.cieY/PI;
756 >                        if (back_comp & SDsampT && myBSDF.tLambBack.cieY < overall_min*PI)
757 >                                overall_min = myBSDF.tLambBack.cieY/PI;
758                  }
759                  set_minlog();
760                  if (!build_wBSDF(&myBSDF))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines