12 |
|
|
13 |
|
#include "glare.h" |
14 |
|
|
15 |
– |
#include "random.h" |
16 |
– |
|
15 |
|
#define FEQ(a,b) ((a)-(b)<=FTINY&&(a)-(b)<=FTINY) |
16 |
|
#define VEQ(v1,v2) (FEQ((v1)[0],(v2)[0])&&FEQ((v1)[1],(v2)[1]) \ |
17 |
|
&&FEQ((v1)[2],(v2)[2])) |
290 |
|
FVECT vd; |
291 |
|
int x, y; |
292 |
|
{ |
293 |
+ |
static int cury = 10000; |
294 |
+ |
static double err, cmpval; |
295 |
|
long t; |
296 |
|
FVECT org; /* dummy variable */ |
297 |
|
|
305 |
|
(double)y/(2*sampdens)+.5)); |
306 |
|
/* central region */ |
307 |
|
/* avoid over-counting of poles */ |
308 |
< |
t = random() % vsize; |
309 |
< |
if (t*t >= (long)vsize*vsize - (long)y*y) |
308 |
> |
if (cury != y) { |
309 |
> |
err = 0.0; |
310 |
> |
cmpval = sqrt(1.0 - (double)((long)y*y)/((long)vsize*vsize)); |
311 |
> |
cury = y; |
312 |
> |
} |
313 |
> |
err += cmpval; |
314 |
> |
if (err <= 0.5) |
315 |
|
return(-1); |
316 |
+ |
err -= 1.0; |
317 |
|
if (viewray(org, vd, &ourview, .5, (double)y/(2*sampdens)+.5) < 0) |
318 |
|
return(-1); |
319 |
|
spinvector(vd, vd, ourview.vup, h_theta(x)); |