--- ray/src/cv/bsdfrep.h 2012/10/23 21:09:29 2.4 +++ ray/src/cv/bsdfrep.h 2014/03/08 06:37:59 2.14 @@ -1,4 +1,4 @@ -/* RCSid $Id: bsdfrep.h,v 2.4 2012/10/23 21:09:29 greg Exp $ */ +/* RCSid $Id: bsdfrep.h,v 2.14 2014/03/08 06:37:59 greg Exp $ */ /* * Definitions for BSDF representation used to interpolate measured data. * @@ -10,7 +10,7 @@ #define DEBUG 1 #ifndef GRIDRES -#define GRIDRES 200 /* grid resolution per side */ +#define GRIDRES (1<<8) /* grid resolution per side */ #endif /* convert to/from coded radians */ #define ANG2R(r) (int)((r)*((1<<16)/M_PI)) @@ -18,8 +18,7 @@ typedef struct { float vsum; /* DSF sum */ - unsigned short nval; /* number of values in sum */ - unsigned short crad; /* radius (coded angle) */ + unsigned int nval; /* number of values in sum */ } GRIDVAL; /* grid value */ typedef struct { @@ -57,6 +56,11 @@ typedef struct s_rbfnode { #define INP_QUAD3 4 /* 180-270 degree quadrant */ #define INP_QUAD4 8 /* 270-360 degree quadrant */ + /* name and manufacturer if known */ +extern char bsdf_name[]; +extern char bsdf_manuf[]; + /* active grid resolution */ +extern int grid_res; /* coverage/symmetry using INP_QUAD? flags */ extern int inp_coverage; @@ -67,6 +71,18 @@ extern int single_plane_incident; extern int input_orient; extern int output_orient; + /* log BSDF histogram */ +#define HISTLEN 256 +#define BSDF2BIG (1./M_PI) +#define BSDF2SML 1e-8 +#define HISTLNR 17.2759509 /* log(BSDF2BIG/BSDF2SML) */ +extern unsigned long bsdf_hist[HISTLEN]; +#define histndx(v) (int)(log((v)*(1./BSDF2SML))*(HISTLEN/HISTLNR)) +#define histval(i) (exp(((i)+.5)*(HISTLNR/HISTLEN))*BSDF2SML) + + /* BSDF value for boundary regions */ +extern double bsdf_min; + /* processed incident DSF measurements */ extern RBFNODE *dsf_list; @@ -89,7 +105,7 @@ extern MIGRATION *mig_list; extern char *progname; /* get theta value in degrees [0,180) range */ -#define get_theta180(v) ((180./M_PI)*acos((v)[2])) +#define get_theta180(v) ((180./M_PI)*Acos((v)[2])) /* get phi value in degrees, [0,360) range */ #define get_phi360(v) ((180./M_PI)*atan2((v)[1],(v)[0]) + 360.*((v)[1]<0)) @@ -112,6 +128,9 @@ extern void rev_symmetry(FVECT vec, int sym); /* Reverse symmetry for an RBF distribution */ extern void rev_rbf_symmetry(RBFNODE *rbf, int sym); +/* Rotate RBF to correspond to given incident vector */ +extern void rotate_rbf(RBFNODE *rbf, const FVECT invec); + /* Compute volume associated with Gaussian lobe */ extern double rbf_volume(const RBFVAL *rbfp); @@ -166,5 +185,9 @@ extern void build_mesh(void); /* Find edge(s) for interpolating the given vector, applying symmetry */ extern int get_interp(MIGRATION *miga[3], FVECT invec); +/* Advect and allocate new RBF along edge (internal call) */ +extern RBFNODE * e_advect_rbf(const MIGRATION *mig, + const FVECT invec, int lobe_lim); + /* Partially advect between recorded incident angles and allocate new RBF */ -extern RBFNODE * advect_rbf(const FVECT invec); +extern RBFNODE * advect_rbf(const FVECT invec, int lobe_lim);