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.35 by greg, Thu Aug 2 18:33:42 2018 UTC vs.
Revision 2.42 by greg, Sat Jun 7 05:09:45 2025 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines