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

Comparing ray/src/cv/bsdfrep.h (file contents):
Revision 2.3 by greg, Tue Oct 23 05:10:42 2012 UTC vs.
Revision 2.20 by greg, Thu Aug 21 10:33:48 2014 UTC

# Line 5 | Line 5
5   *      G. Ward
6   */
7  
8 + #ifndef _BSDFREP_H_
9 + #define _BSDFREP_H_
10 +
11   #include "bsdf.h"
12  
13 < #define DEBUG           1
13 > #ifdef __cplusplus
14 > extern "C" {
15 > #endif
16  
17   #ifndef GRIDRES
18 < #define GRIDRES         200             /* grid resolution per side */
18 > #define GRIDRES         (1<<8)          /* grid resolution per side */
19   #endif
20                                          /* convert to/from coded radians */
21   #define ANG2R(r)        (int)((r)*((1<<16)/M_PI))
22   #define R2ANG(c)        (((c)+.5)*(M_PI/(1<<16)))
23  
24 < typedef struct {
25 <        float           vsum;           /* DSF sum */
26 <        unsigned short  nval;           /* number of values in sum */
27 <        unsigned short  crad;           /* radius (coded angle) */
24 > typedef union {
25 >        struct {
26 >                float           v;              /* DSF sum */
27 >                unsigned int    n;              /* number of values in sum */
28 >        }       sum;                    /* sum for averaging */
29 >        float   val[2];                 /* comparison values */
30   } GRIDVAL;                      /* grid value */
31  
32   typedef struct {
# Line 57 | Line 64 | typedef struct s_rbfnode {
64   #define INP_QUAD3       4               /* 180-270 degree quadrant */
65   #define INP_QUAD4       8               /* 270-360 degree quadrant */
66  
67 +                                /* name and manufacturer if known */
68 + extern char             bsdf_name[];
69 + extern char             bsdf_manuf[];
70 +                                /* active grid resolution */
71 + extern int              grid_res;
72                                  /* coverage/symmetry using INP_QUAD? flags */
73   extern int              inp_coverage;
74  
# Line 67 | Line 79 | extern int             single_plane_incident;
79   extern int              input_orient;
80   extern int              output_orient;
81  
82 +                                /* log BSDF histogram */
83 + #define HISTLEN         256
84 + #define BSDF2BIG        (1./M_PI)
85 + #define BSDF2SML        1e-8
86 + #define HISTLNR         17.2759509              /* log(BSDF2BIG/BSDF2SML) */
87 + extern unsigned long    bsdf_hist[HISTLEN];
88 + #define histndx(v)      (int)(log((v)*(1./BSDF2SML))*(HISTLEN/HISTLNR))
89 + #define histval(i)      (exp(((i)+.5)*(HISTLNR/HISTLEN))*BSDF2SML)
90 +
91 +                                /* BSDF value for boundary regions */
92 + extern double           bsdf_min;
93 + extern float            bsdf_spec_peak;
94 + extern int              bsdf_spec_crad;
95 +
96                                  /* processed incident DSF measurements */
97   extern RBFNODE          *dsf_list;
98  
# Line 89 | Line 115 | extern MIGRATION       *mig_list;
115   extern char             *progname;
116  
117                                  /* get theta value in degrees [0,180) range */
118 < #define get_theta180(v) ((180./M_PI)*acos((v)[2]))
118 > #define get_theta180(v) ((180./M_PI)*Acos((v)[2]))
119                                  /* get phi value in degrees, [0,360) range */
120 < #define get_phi360(v)   ((180./M_PI)*atan2((v)[1],(v)[0]) + 180.)
120 > #define get_phi360(v)   ((180./M_PI)*atan2((v)[1],(v)[0]) + 360.*((v)[1]<0))
121  
122                                  /* our loaded grid for this incident angle */
123   extern double           theta_in_deg, phi_in_deg;
# Line 112 | Line 138 | extern void            rev_symmetry(FVECT vec, int sym);
138   /* Reverse symmetry for an RBF distribution */
139   extern void             rev_rbf_symmetry(RBFNODE *rbf, int sym);
140  
141 + /* Rotate RBF to correspond to given incident vector */
142 + extern void             rotate_rbf(RBFNODE *rbf, const FVECT invec);
143 +
144   /* Compute volume associated with Gaussian lobe */
145   extern double           rbf_volume(const RBFVAL *rbfp);
146  
# Line 121 | Line 150 | extern void            ovec_from_pos(FVECT vec, int xpos, int yp
150   /* Compute grid position from normalized input/output vector */
151   extern void             pos_from_vec(int pos[2], const FVECT vec);
152  
153 < /* Evaluate RBF for DSF at the given normalized outgoing direction */
153 > /* Evaluate BSDF at the given normalized outgoing direction */
154   extern double           eval_rbfrep(const RBFNODE *rp, const FVECT outvec);
155  
156   /* Insert a new directional scattering function in our global list */
# Line 166 | Line 195 | extern void            build_mesh(void);
195   /* Find edge(s) for interpolating the given vector, applying symmetry */
196   extern int              get_interp(MIGRATION *miga[3], FVECT invec);
197  
198 + /* Return single-lobe specular RBF for the given incident direction */
199 + extern RBFNODE *        def_rbf_spec(const FVECT invec);
200 +
201 + /* Advect and allocate new RBF along edge (internal call) */
202 + extern RBFNODE *        e_advect_rbf(const MIGRATION *mig,
203 +                                        const FVECT invec, int lobe_lim);
204 +
205 + /* Compute distance between two RBF lobes (internal call) */
206 + extern double           lobe_distance(RBFVAL *rbf1, RBFVAL *rbf2);
207 +
208 + /* Compute mass transport plan (internal call) */
209 + extern void             plan_transport(MIGRATION *mig);
210 +
211   /* Partially advect between recorded incident angles and allocate new RBF */
212 < extern RBFNODE *        advect_rbf(const FVECT invec);
212 > extern RBFNODE *        advect_rbf(const FVECT invec, int lobe_lim);
213 >
214 > #ifdef __cplusplus
215 > }
216 > #endif
217 > #endif  /* _BSDFREP_H_ */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines