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

Comparing ray/src/cv/pabopto2bsdf.c (file contents):
Revision 2.20 by greg, Thu Mar 20 16:54:23 2014 UTC vs.
Revision 2.24 by greg, Mon Mar 24 02:31:02 2014 UTC

# Line 77 | Line 77 | init_pabopto_inp(const int i, const char *fname)
77                                  inpfile[i].isDSF = 1;
78                                  continue;
79                          }
80 <                        if (!strcasecmp(typ, "BSDF")) {
80 >                        if (!strcasecmp(typ, "BSDF") ||
81 >                                        !strcasecmp(typ, "BRDF") ||
82 >                                        !strcasecmp(typ, "BTDF")) {
83                                  inpfile[i].isDSF = 0;
84                                  continue;
85                          }
# Line 129 | Line 131 | add_pabopto_inp(const int i)
131                  if (i)                  /* process previous incidence */
132                          make_rbfrep();
133   #ifdef DEBUG
134 <                fprintf(stderr, "New incident (theta,phi)=(%f,%f)\n",
134 >                fprintf(stderr, "New incident (theta,phi)=(%.1f,%.1f)\n",
135                                          inpfile[i].theta, inpfile[i].phi);
136   #endif
137                  new_bsdf_data(inpfile[i].theta, inpfile[i].phi);
# Line 210 | Line 212 | main(int argc, char *argv[])
212          FVECT   dir;
213          int     i, j, n;
214  
215 +        progname = argv[0];
216          if (argc != 2) {
217 <                fprintf(stderr, "Usage: %s input.dat > output.rad\n", argv[0]);
217 >                fprintf(stderr, "Usage: %s input.dat > output.rad\n", progname);
218                  return(1);
219          }
220          ninpfiles = 1;
# Line 219 | Line 222 | main(int argc, char *argv[])
222          if (!init_pabopto_inp(0, argv[1]) || !add_pabopto_inp(0))
223                  return(1);
224                                                  /* reduce data set */
225 <        make_rbfrep();
225 >        if (make_rbfrep() == NULL) {
226 >                fprintf(stderr, "%s: nothing to plot!\n", progname);
227 >                exit(1);
228 >        }
229   #ifdef DEBUG
230          fprintf(stderr, "Minimum BSDF = %.4f\n", bsdf_min);
231   #endif
# Line 232 | Line 238 | main(int argc, char *argv[])
238                  if (dsf_grid[i][j].sum.n > 0) {
239                          ovec_from_pos(dir, i, j);
240                          bsdf = dsf_grid[i][j].sum.v /
241 <                                (dsf_grid[i][j].sum.n*output_orient*dir[2]);
241 >                           ((double)dsf_grid[i][j].sum.n*output_orient*dir[2]);
242                          if (bsdf <= bsdf_min*.6)
243                                  continue;
244                          bsdf = log(bsdf + 1e-5) - min_log;
# Line 262 | Line 268 | main(int argc, char *argv[])
268          sprintf(buf, "gensurf tgreen bsdf - - - %d %d", GRIDRES-1, GRIDRES-1);
269          pfp = popen(buf, "w");
270          if (pfp == NULL) {
271 <                fprintf(stderr, "%s: cannot open '| %s'\n", argv[0], buf);
271 >                fprintf(stderr, "%s: cannot open '| %s'\n", progname, buf);
272                  return(1);
273          }
274          for (i = 0; i < GRIDRES; i++)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines