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 { |
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 */ |
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 |
+ |
|
94 |
|
/* processed incident DSF measurements */ |
95 |
|
extern RBFNODE *dsf_list; |
96 |
|
|
113 |
|
extern char *progname; |
114 |
|
|
115 |
|
/* get theta value in degrees [0,180) range */ |
116 |
< |
#define get_theta180(v) ((180./M_PI)*acos((v)[2])) |
116 |
> |
#define get_theta180(v) ((180./M_PI)*Acos((v)[2])) |
117 |
|
/* get phi value in degrees, [0,360) range */ |
118 |
|
#define get_phi360(v) ((180./M_PI)*atan2((v)[1],(v)[0]) + 360.*((v)[1]<0)) |
119 |
|
|
136 |
|
/* Reverse symmetry for an RBF distribution */ |
137 |
|
extern void rev_rbf_symmetry(RBFNODE *rbf, int sym); |
138 |
|
|
139 |
+ |
/* Rotate RBF to correspond to given incident vector */ |
140 |
+ |
extern void rotate_rbf(RBFNODE *rbf, const FVECT invec); |
141 |
+ |
|
142 |
|
/* Compute volume associated with Gaussian lobe */ |
143 |
|
extern double rbf_volume(const RBFVAL *rbfp); |
144 |
|
|
193 |
|
/* Find edge(s) for interpolating the given vector, applying symmetry */ |
194 |
|
extern int get_interp(MIGRATION *miga[3], FVECT invec); |
195 |
|
|
196 |
+ |
/* Advect and allocate new RBF along edge (internal call) */ |
197 |
+ |
extern RBFNODE * e_advect_rbf(const MIGRATION *mig, |
198 |
+ |
const FVECT invec, int lobe_lim); |
199 |
+ |
|
200 |
+ |
/* Compute distance between two RBF lobes (internal call) */ |
201 |
+ |
extern double lobe_distance(RBFVAL *rbf1, RBFVAL *rbf2); |
202 |
+ |
|
203 |
+ |
/* Compute mass transport plan (internal call) */ |
204 |
+ |
extern void plan_transport(MIGRATION *mig); |
205 |
+ |
|
206 |
|
/* Partially advect between recorded incident angles and allocate new RBF */ |
207 |
< |
extern RBFNODE * advect_rbf(const FVECT invec); |
207 |
> |
extern RBFNODE * advect_rbf(const FVECT invec, int lobe_lim); |
208 |
> |
|
209 |
> |
#ifdef __cplusplus |
210 |
> |
} |
211 |
> |
#endif |
212 |
> |
#endif /* _BSDFREP_H_ */ |