258 |
|
double |
259 |
|
eval_rbfrep(const RBFNODE *rp, const FVECT outvec) |
260 |
|
{ |
261 |
+ |
const double rfact2 = (38./M_PI/M_PI)*(grid_res*grid_res); |
262 |
|
double minval = bsdf_min*output_orient*outvec[2]; |
263 |
|
int pos[2]; |
264 |
|
double res = 0; |
281 |
|
(pos[1]-rbfp->gy)*(pos[1]-rbfp->gy); |
282 |
|
rad2 = R2ANG(rbfp->crad); |
283 |
|
rad2 *= rad2; |
284 |
< |
if (d2 > (38.*GRIDRES*GRIDRES/M_PI/M_PI)*rad2) |
284 |
> |
if (d2 > rad2*rfact2) |
285 |
|
continue; |
286 |
|
ovec_from_pos(odir, rbfp->gx, rbfp->gy); |
287 |
|
res += rbfp->peak * exp((DOT(odir,outvec) - 1.) / rad2); |
513 |
|
progname); |
514 |
|
return(0); |
515 |
|
} |
516 |
< |
rbfh.next = NULL; /* read each DSF */ |
516 |
< |
rbfh.ejl = NULL; |
516 |
> |
memset(&rbfh, 0, sizeof(rbfh)); /* read each DSF */ |
517 |
|
while ((rbfh.ord = getint(4, ifp)) >= 0) { |
518 |
|
RBFNODE *newrbf; |
519 |
|
|
530 |
|
sizeof(RBFVAL)*(rbfh.nrbf-1)); |
531 |
|
if (newrbf == NULL) |
532 |
|
goto memerr; |
533 |
< |
memcpy(newrbf, &rbfh, sizeof(RBFNODE)-sizeof(RBFVAL)); |
533 |
> |
*newrbf = rbfh; |
534 |
|
for (i = 0; i < rbfh.nrbf; i++) { |
535 |
|
newrbf->rbfa[i].peak = getflt(ifp); |
536 |
|
newrbf->rbfa[i].crad = getint(2, ifp) & 0xffff; |