17 |
|
#ifndef RSCA |
18 |
|
#define RSCA 2.7 /* radius scaling factor (empirical) */ |
19 |
|
#endif |
20 |
+ |
#ifndef MAXFRAC |
21 |
+ |
#define MAXFRAC 0.5 /* maximum contribution to neighbor */ |
22 |
+ |
#endif |
23 |
+ |
#ifndef NNEIGH |
24 |
+ |
#define NNEIGH 10 /* number of neighbors to consider */ |
25 |
+ |
#endif |
26 |
|
/* our loaded grid for this incident angle */ |
27 |
|
GRIDVAL dsf_grid[GRIDRES][GRIDRES]; |
28 |
|
|
54 |
|
ovec[1] = sin((M_PI/180.)*phi_out) * ovec[2]; |
55 |
|
ovec[2] = sqrt(1. - ovec[2]*ovec[2]); |
56 |
|
|
57 |
< |
if (!isDSF) |
57 |
> |
if (val <= 0) /* truncate to zero */ |
58 |
> |
val = 0; |
59 |
> |
else if (!isDSF) |
60 |
|
val *= ovec[2]; /* convert from BSDF to DSF */ |
61 |
|
|
62 |
|
/* update BSDF histogram */ |
253 |
|
static int |
254 |
|
adj_coded_radius(const int i, const int j) |
255 |
|
{ |
248 |
– |
const double max_frac = 0.33; |
256 |
|
const double rad0 = R2ANG(dsf_grid[i][j].crad); |
257 |
|
double currad = RSCA * rad0; |
258 |
< |
int neigh[5][2]; |
258 |
> |
int neigh[NNEIGH][2]; |
259 |
|
int n; |
260 |
|
FVECT our_dir; |
261 |
|
|
262 |
|
ovec_from_pos(our_dir, i, j); |
263 |
< |
n = get_neighbors(neigh, 5, i, j); |
263 |
> |
n = get_neighbors(neigh, NNEIGH, i, j); |
264 |
|
while (n--) { |
265 |
|
FVECT their_dir; |
266 |
|
double max_ratio, rad_ok2; |
267 |
|
/* check our value at neighbor */ |
268 |
|
ovec_from_pos(their_dir, neigh[n][0], neigh[n][1]); |
269 |
< |
max_ratio = max_frac * dsf_grid[neigh[n][0]][neigh[n][1]].vsum |
269 |
> |
max_ratio = MAXFRAC * dsf_grid[neigh[n][0]][neigh[n][1]].vsum |
270 |
|
/ dsf_grid[i][j].vsum; |
271 |
|
if (max_ratio >= 1) |
272 |
|
continue; |