--- ray/src/cv/bsdfmesh.c 2014/03/08 18:16:48 2.19 +++ ray/src/cv/bsdfmesh.c 2014/03/24 06:07:46 2.25 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: bsdfmesh.c,v 2.19 2014/03/08 18:16:48 greg Exp $"; +static const char RCSid[] = "$Id: bsdfmesh.c,v 2.25 2014/03/24 06:07:46 greg Exp $"; #endif /* * Create BSDF advection mesh from radial basis functions. @@ -20,7 +20,7 @@ static const char RCSid[] = "$Id: bsdfmesh.c,v 2.19 20 #include "bsdfrep.h" #ifndef NEIGH_FACT2 -#define NEIGH_FACT2 0.2 /* empirical neighborhood distance weight */ +#define NEIGH_FACT2 0.1 /* empirical neighborhood distance weight */ #endif /* number of processes to run */ int nprocs = 1; @@ -150,9 +150,9 @@ compute_nDSFs(const RBFNODE *rbf0, const RBFNODE *rbf1 for (x = GRIDRES; x--; ) for (y = GRIDRES; y--; ) { - ovec_from_pos(dv, x, y); - dsf_grid[x][y].val[0] = nf0 * eval_rbfrep(rbf0, dv); - dsf_grid[x][y].val[1] = nf1 * eval_rbfrep(rbf1, dv); + ovec_from_pos(dv, x, y); /* cube root (brightness) */ + dsf_grid[x][y].val[0] = pow(nf0*eval_rbfrep(rbf0, dv), .3333); + dsf_grid[x][y].val[1] = pow(nf1*eval_rbfrep(rbf1, dv), .3333); } } @@ -165,9 +165,6 @@ neighborhood_dist2(int x0, int y0, int x1, int y1) double d; int p[4]; int i, j; - - if ((x0 == x1) & (y0 == y1)) - return(0.); /* check radius */ p[0] = x0; p[1] = y0; p[2] = x1; p[3] = y1; for (i = 4; i--; ) { @@ -225,7 +222,7 @@ price_routes(PRICEMAT *pm, const RBFNODE *from_rbf, co pm->prow = pricerow(pm,i); srow = psortrow(pm,i); for (j = to_rbf->nrbf; j--; ) { - double d; /* quadratic cost function */ + double d; /* quadratic cost function */ d = Acos(DOT(vfrom, vto[j])); pm->prow[j] = d*d; d = R2ANG(to_rbf->rbfa[j].crad) - from_ang; @@ -556,7 +553,7 @@ mesh_from_edge(MIGRATION *edge) static void check_normal_incidence(void) { - static const FVECT norm_vec = {.0, .0, 1.}; + static FVECT norm_vec = {.0, .0, 1.}; const int saved_nprocs = nprocs; RBFNODE *near_rbf, *mir_rbf, *rbf; double bestd; @@ -606,11 +603,12 @@ check_normal_incidence(void) memcpy(mir_rbf, near_rbf, n); mir_rbf->ord = near_rbf->ord - 1; /* not used, I think */ mir_rbf->next = NULL; + mir_rbf->ejl = NULL; rev_rbf_symmetry(mir_rbf, MIRROR_X|MIRROR_Y); nprocs = 1; /* compute migration matrix */ - if (mig_list != create_migration(mir_rbf, near_rbf)) + if (create_migration(mir_rbf, near_rbf) == NULL) exit(1); /* XXX should never happen! */ - /* interpolate normal dist. */ + norm_vec[2] = input_orient; /* interpolate normal dist. */ rbf = e_advect_rbf(mig_list, norm_vec, 2*near_rbf->nrbf); nprocs = saved_nprocs; /* final clean-up */ free(mir_rbf);