--- ray/src/util/findglare.c 1991/04/02 14:29:15 1.13 +++ ray/src/util/findglare.c 1991/04/05 14:26:47 1.15 @@ -290,6 +290,9 @@ compdir(vd, x, y) /* compute direction for x,y */ FVECT vd; int x, y; { + static int cury = 10000; + static double err, cmpval; + long t; FVECT org; /* dummy variable */ if (x <= -hlim) /* left region */ @@ -300,7 +303,17 @@ int x, y; return(viewray(org, vd, &rightview, (double)(x-hlim)/(2*sampdens)+.5, (double)y/(2*sampdens)+.5)); - /* central region */ + /* central region */ + /* avoid over-counting of poles */ + if (cury != y) { + err = 0.0; + cmpval = sqrt(1.0 - (double)((long)y*y)/((long)vsize*vsize)); + cury = y; + } + err += cmpval; + if (err <= 0.5) + return(-1); + err -= 1.0; if (viewray(org, vd, &ourview, .5, (double)y/(2*sampdens)+.5) < 0) return(-1); spinvector(vd, vd, ourview.vup, h_theta(x));