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.6 by greg, Sat Oct 19 00:11:50 2013 UTC vs.
Revision 2.10 by greg, Sat Nov 9 05:47:49 2013 UTC

# Line 70 | Line 70 | init_pabopto_inp(const int i, const char *fname)
70                          fclose(fp);
71                          return(0);
72                  }
73 +                if (sscanf(buf, "sample_name \"%[^\"]\"", bsdf_name) == 1)
74 +                        continue;
75                  if (sscanf(buf, "format: theta phi %s", typ) == 1) {
76                          if (!strcasecmp(typ, "DSF")) {
77                                  inpfile[i].isDSF = 1;
# Line 145 | Line 147 | add_pabopto_inp(const int i)
147          return(1);
148   }
149  
150 < #if 1
150 > #ifndef TEST_MAIN
151   /* Read in PAB-Opto BSDF files and output RBF interpolant */
152   int
153   main(int argc, char *argv[])
# Line 214 | Line 216 | main(int argc, char *argv[])
216                  return(1);
217                                                  /* reduce data set */
218          make_rbfrep();
219 + #ifdef DEBUG
220 +        fprintf(stderr, "Minimum BSDF = %.4f\n", bsdf_min);
221 + #endif
222                                                  /* produce spheres at meas. */
223          puts("void plastic yellow\n0\n0\n5 .6 .4 .01 .04 .08\n");
219        puts("void plastic pink\n0\n0\n5 .5 .05 .9 .04 .08\n");
224          min_log = log(bsdf_min*.5);
225          n = 0;
226          for (i = 0; i < GRIDRES; i++)
227              for (j = 0; j < GRIDRES; j++)
228 <                if (dsf_grid[i][j].vsum > .0f) {
228 >                if (dsf_grid[i][j].nval > 0) {
229                          ovec_from_pos(dir, i, j);
230 <                        bsdf = dsf_grid[i][j].vsum / dir[2];
230 >                        bsdf = dsf_grid[i][j].vsum /
231 >                                (dsf_grid[i][j].nval*output_orient*dir[2]);
232                          if (bsdf <= bsdf_min*.6)
233                                  continue;
234                          bsdf = log(bsdf) - min_log;
235 <                        if (dsf_grid[i][j].nval) {
236 <                                printf("pink cone c%04d\n0\n0\n8\n", ++n);
237 <                                printf("\t%.6g %.6g %.6g\n",
233 <                                        dir[0]*bsdf, dir[1]*bsdf, dir[2]*bsdf);
234 <                                printf("\t%.6g %.6g %.6g\n",
235 <                                        dir[0]*bsdf*1.02, dir[1]*bsdf*1.02,
236 <                                        dir[2]*bsdf*1.02);
237 <                                printf("\t%.6g\t0\n", .02*bsdf);
238 <                        } else {
239 <                                ovec_from_pos(dir, i, j);
240 <                                printf("yellow sphere s%04d\n0\n0\n", ++n);
241 <                                printf("4 %.6g %.6g %.6g %.6g\n\n",
235 >                        ovec_from_pos(dir, i, j);
236 >                        printf("yellow sphere s%04d\n0\n0\n", ++n);
237 >                        printf("4 %.6g %.6g %.6g %.6g\n\n",
238                                          dir[0]*bsdf, dir[1]*bsdf, dir[2]*bsdf,
239 <                                        .01*bsdf);
244 <                        }
239 >                                        .007*bsdf);
240                  }
241                                                  /* output continuous surface */
242          puts("void trans tgreen\n0\n0\n7 .7 1 .7 .04 .04 .9 1\n");
# Line 249 | Line 244 | main(int argc, char *argv[])
244          sprintf(buf, "gensurf tgreen bsdf - - - %d %d", GRIDRES-1, GRIDRES-1);
245          pfp = popen(buf, "w");
246          if (pfp == NULL) {
247 <                fputs(buf, stderr);
253 <                fputs(": cannot start command\n", stderr);
247 >                fprintf(stderr, "%s: cannot open '| %s'\n", argv[0], buf);
248                  return(1);
249          }
250          for (i = 0; i < GRIDRES; i++)
251              for (j = 0; j < GRIDRES; j++) {
252                  ovec_from_pos(dir, i, j);
253 <                bsdf = eval_rbfrep(dsf_list, dir) / dir[2];
253 >                bsdf = eval_rbfrep(dsf_list, dir) / (output_orient*dir[2]);
254                  bsdf = log(bsdf) - min_log;
255                  fprintf(pfp, "%.8e %.8e %.8e\n",
256                                  dir[0]*bsdf, dir[1]*bsdf, dir[2]*bsdf);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines