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.9 by greg, Tue Nov 13 04:23:38 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 82 | Line 88 | new_input_direction(double new_theta, double new_phi)
88   int
89   use_symmetry(FVECT vec)
90   {
91 <        double  phi = get_phi360(vec);
91 >        const double    phi = get_phi360(vec);
92  
93          switch (inp_coverage) {
94          case INP_QUAD1|INP_QUAD2|INP_QUAD3|INP_QUAD4:
# Line 189 | Line 195 | rotate_rbf(RBFNODE *rbf, const FVECT invec)
195          int                     pos[2];
196          int                     n;
197  
198 <        for (n = rbf->nrbf; n-- > 0; ) {
198 >        for (n = ((-.01 > phi) | (phi > .01))*rbf->nrbf; n-- > 0; ) {
199                  ovec_from_pos(outvec, rbf->rbfa[n].gx, rbf->rbfa[n].gy);
200                  spinvector(outvec, outvec, vnorm, phi);
201                  pos_from_vec(pos, outvec);
# 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