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.8 by greg, Tue Oct 22 04:29:27 2013 UTC

# Line 145 | Line 145 | add_pabopto_inp(const int i)
145          return(1);
146   }
147  
148 < #if 1
148 > #ifndef TEST_MAIN
149   /* Read in PAB-Opto BSDF files and output RBF interpolant */
150   int
151   main(int argc, char *argv[])
# Line 216 | Line 216 | main(int argc, char *argv[])
216          make_rbfrep();
217                                                  /* produce spheres at meas. */
218          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");
219          min_log = log(bsdf_min*.5);
220          n = 0;
221          for (i = 0; i < GRIDRES; i++)
222              for (j = 0; j < GRIDRES; j++)
223 <                if (dsf_grid[i][j].vsum > .0f) {
223 >                if (dsf_grid[i][j].nval > 0) {
224                          ovec_from_pos(dir, i, j);
225 <                        bsdf = dsf_grid[i][j].vsum / dir[2];
225 >                        bsdf = dsf_grid[i][j].vsum /
226 >                                (dsf_grid[i][j].nval*output_orient*dir[2]);
227                          if (bsdf <= bsdf_min*.6)
228                                  continue;
229                          bsdf = log(bsdf) - min_log;
230 <                        if (dsf_grid[i][j].nval) {
231 <                                printf("pink cone c%04d\n0\n0\n8\n", ++n);
232 <                                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",
230 >                        ovec_from_pos(dir, i, j);
231 >                        printf("yellow sphere s%04d\n0\n0\n", ++n);
232 >                        printf("4 %.6g %.6g %.6g %.6g\n\n",
233                                          dir[0]*bsdf, dir[1]*bsdf, dir[2]*bsdf,
234 <                                        .01*bsdf);
244 <                        }
234 >                                        .007*bsdf);
235                  }
236                                                  /* output continuous surface */
237          puts("void trans tgreen\n0\n0\n7 .7 1 .7 .04 .04 .9 1\n");
# Line 249 | Line 239 | main(int argc, char *argv[])
239          sprintf(buf, "gensurf tgreen bsdf - - - %d %d", GRIDRES-1, GRIDRES-1);
240          pfp = popen(buf, "w");
241          if (pfp == NULL) {
242 <                fputs(buf, stderr);
253 <                fputs(": cannot start command\n", stderr);
242 >                fprintf(stderr, "%s: cannot open '| %s'\n", argv[0], buf);
243                  return(1);
244          }
245          for (i = 0; i < GRIDRES; i++)
246              for (j = 0; j < GRIDRES; j++) {
247                  ovec_from_pos(dir, i, j);
248 <                bsdf = eval_rbfrep(dsf_list, dir) / dir[2];
248 >                bsdf = eval_rbfrep(dsf_list, dir) / (output_orient*dir[2]);
249                  bsdf = log(bsdf) - min_log;
250                  fprintf(pfp, "%.8e %.8e %.8e\n",
251                                  dir[0]*bsdf, dir[1]*bsdf, dir[2]*bsdf);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines