--- ray/src/cv/bsdfrep.c 2014/03/21 16:28:23 2.22 +++ ray/src/cv/bsdfrep.c 2014/03/25 14:55:35 2.24 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: bsdfrep.c,v 2.22 2014/03/21 16:28:23 greg Exp $"; +static const char RCSid[] = "$Id: bsdfrep.c,v 2.24 2014/03/25 14:55:35 greg Exp $"; #endif /* * Support BSDF representation as radial basis functions. @@ -198,7 +198,7 @@ rotate_rbf(RBFNODE *rbf, const FVECT invec) int pos[2]; int n; - for (n = ((-.01 > phi) | (phi > .01))*rbf->nrbf; n-- > 0; ) { + for (n = (cos(phi) < 1.-FTINY)*rbf->nrbf; n-- > 0; ) { ovec_from_pos(outvec, rbf->rbfa[n].gx, rbf->rbfa[n].gy); spinvector(outvec, outvec, vnorm, phi); pos_from_vec(pos, outvec); @@ -612,7 +612,8 @@ load_bsdf_rep(FILE *ifp) if (ifp == NULL) return(0); if (getheader(ifp, headline, NULL) < 0 || (single_plane_incident < 0) | - !input_orient | !output_orient) { + !input_orient | !output_orient | + (grid_res < 16) | (grid_res > 256)) { fprintf(stderr, "%s: missing/bad format for BSDF interpolant\n", progname); return(0);