--- ray/src/cv/bsdfrbf.c 2016/02/03 18:42:13 2.28 +++ ray/src/cv/bsdfrbf.c 2018/08/01 17:00:22 2.31 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: bsdfrbf.c,v 2.28 2016/02/03 18:42:13 greg Exp $"; +static const char RCSid[] = "$Id: bsdfrbf.c,v 2.31 2018/08/01 17:00:22 greg Exp $"; #endif /* * Radial basis function representation for BSDF data. @@ -31,11 +31,14 @@ static const char RCSid[] = "$Id: bsdfrbf.c,v 2.28 201 #ifndef RSCA #define RSCA 2.0 /* radius scaling factor (empirical) */ #endif +#ifndef MAXSLOPE +#define MAXSLOPE 200.0 /* maximum slope for smooth region */ +#endif #ifndef SMOOTH_MSE #define SMOOTH_MSE 5e-5 /* acceptable mean squared error */ #endif #ifndef SMOOTH_MSER -#define SMOOTH_MSER 0.03 /* acceptable relative MSE */ +#define SMOOTH_MSER 0.01 /* acceptable relative MSE */ #endif #define MAX_RAD (GRIDRES/8) /* maximum lobe radius */ @@ -209,6 +212,8 @@ smooth_region(int x0, int x1, int y0, int y1) return(1); /* colinear values */ A = DOT(rMtx[0], xvec); B = DOT(rMtx[1], xvec); + if (A*A + B*B > MAXSLOPE*MAXSLOPE) /* too steep? */ + return(0); C = DOT(rMtx[2], xvec); sqerr = 0.0; /* compute mean squared error */ for (x = x0; x < x1; x++)