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

Comparing ray/src/cv/bsdfrep.c (file contents):
Revision 2.11 by greg, Thu Nov 22 06:07:17 2012 UTC vs.
Revision 2.13 by greg, Sun Mar 24 17:22:23 2013 UTC

# Line 26 | Line 26 | int                    single_plane_incident = -1;
26   int                     input_orient = 0;
27   int                     output_orient = 0;
28  
29 +                                /* BSDF histogram */
30 + int                     bsdf_hist[HISTLEN];
31 +
32 +                                /* BSDF value for boundary regions */
33 + double                  bsdf_min = 0;
34 +
35                                  /* processed incident DSF measurements */
36   RBFNODE                 *dsf_list = NULL;
37  
# Line 241 | Line 247 | pos_from_vec(int pos[2], const FVECT vec)
247   double
248   eval_rbfrep(const RBFNODE *rp, const FVECT outvec)
249   {
250 +        double          minval = bsdf_min*output_orient*outvec[2];
251          double          res = 0;
252          const RBFVAL    *rbfp;
253          FVECT           odir;
254          double          sig2;
255          int             n;
256 <
257 <        if (rp == NULL)
258 <                return(.0);
256 >                                /* use minimum if no information avail. */
257 >        if (rp == NULL) {
258 >                if (outvec[2] > 0 ^ output_orient > 0)
259 >                        return(.0);
260 >                return(minval);
261 >        }
262          rbfp = rp->rbfa;
263          for (n = rp->nrbf; n--; rbfp++) {
264                  ovec_from_pos(odir, rbfp->gx, rbfp->gy);
# Line 257 | Line 267 | eval_rbfrep(const RBFNODE *rp, const FVECT outvec)
267                  if (sig2 > -19.)
268                          res += rbfp->peak * exp(sig2);
269          }
270 +        if (res < minval)       /* never return less than minval */
271 +                return(minval);
272          return(res);
273   }
274  
# Line 390 | Line 402 | save_bsdf_rep(FILE *ofp)
402          fprintf(ofp, "SYMMETRY=%d\n", !single_plane_incident * inp_coverage);
403          fprintf(ofp, "IO_SIDES= %d %d\n", input_orient, output_orient);
404          fprintf(ofp, "GRIDRES=%d\n", grid_res);
405 +        fprintf(ofp, "BSDFMIN=%g\n", bsdf_min);
406          fputformat(BSDFREP_FMT, ofp);
407          fputc('\n', ofp);
408                                          /* write each DSF */
# Line 453 | Line 466 | headline(char *s, void *p)
466          }
467          if (!strncmp(s, "GRIDRES=", 8)) {
468                  sscanf(s+8, "%d", &grid_res);
469 +                return(0);
470 +        }
471 +        if (!strncmp(s, "BSDFMIN=", 8)) {
472 +                sscanf(s+8, "%lf", &bsdf_min);
473                  return(0);
474          }
475          if (formatval(fmt, s) && strcmp(fmt, BSDFREP_FMT))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines