| 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 (1<<8) /* grid resolution per side */ |
| 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 int 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 { |
| 90 |
|
|
| 91 |
|
/* BSDF value for boundary regions */ |
| 92 |
|
extern double bsdf_min; |
| 93 |
+ |
extern double bsdf_spec_peak; |
| 94 |
+ |
extern double bsdf_spec_rad; |
| 95 |
|
|
| 96 |
|
/* processed incident DSF measurements */ |
| 97 |
|
extern RBFNODE *dsf_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]) + 360.*((v)[1]<0)) |
| 121 |
|
|
| 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 */ |
| 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, int lobe_lim); |
| 213 |
+ |
|
| 214 |
+ |
#ifdef __cplusplus |
| 215 |
+ |
} |
| 216 |
+ |
#endif |
| 217 |
+ |
#endif /* _BSDFREP_H_ */ |