| 116 |
|
VCOPY(myray.rdir, sdir); |
| 117 |
|
myray.rmax = 0.; |
| 118 |
|
ray_trace(&myray); |
| 119 |
< |
setcolr(leaf->val, colval(myray.rcol,RED), |
| 120 |
< |
colval(myray.rcol,GRN), |
| 121 |
< |
colval(myray.rcol,BLU)); |
| 119 |
> |
scolor_colr(leaf->val, myray.rcol); |
| 120 |
|
} |
| 121 |
|
|
| 122 |
|
/* Initialize a branch node contained in the given spherical triangle */ |
| 185 |
|
|
| 186 |
|
/* Sample sphere using triangular geodesic mesh */ |
| 187 |
|
TRITREE * |
| 188 |
< |
geosample(int nsamps) |
| 188 |
> |
geosample(long nsamps) |
| 189 |
|
{ |
| 190 |
|
int depth; |
| 191 |
|
TRITREE *tree; |
| 194 |
|
/* figure out depth */ |
| 195 |
|
if ((nsamps -= 4) < 0) |
| 196 |
|
error(USER, "minimum number of samples is 4"); |
| 197 |
< |
nsamps = nsamps*3/NTRUNKBR; /* round up */ |
| 197 |
> |
nsamps = nsamps*(NTRUNKBR-1)/NTRUNKBR; /* round up */ |
| 198 |
|
for (depth = 0; nsamps > 1; depth++) |
| 199 |
|
nsamps >>= 2; |
| 200 |
|
/* make base tetrahedron */ |
| 396 |
|
void |
| 397 |
|
mksources(TRITREE *samptree, double thresh, double maxang) |
| 398 |
|
{ |
| 399 |
+ |
#define MAXITER 100 |
| 400 |
|
const int ethresh = (int)(log(thresh)/log(2.) + (COLXS+.5)); |
| 401 |
|
const double maxomega = 2.*PI*(1. - cos(PI/180./2.*maxang)); |
| 402 |
|
const double minintens = .05*thresh*maxomega; |
| 403 |
+ |
int niter = MAXITER; |
| 404 |
|
int nsrcs = 0; |
| 405 |
|
LOSTLIGHT *lostlightlist = NULL; |
| 406 |
|
int emax; |
| 426 |
|
*/ |
| 427 |
|
if (thresh <= FTINY) |
| 428 |
|
return; |
| 429 |
< |
for ( ; ; ) { |
| 429 |
> |
while (niter--) { |
| 430 |
|
emax = ethresh; /* find brightest unclaimed */ |
| 431 |
|
startleaf = NULL; |
| 432 |
|
for (i = 0; i < NTRUNKBR; i++) { |
| 457 |
|
thisethresh); |
| 458 |
|
if (normalize(vsum) == .0) |
| 459 |
|
break; |
| 460 |
< |
movedist = acos(DOT(vsum,curcent)); |
| 460 |
> |
movedist = Acos(DOT(vsum,curcent)); |
| 461 |
|
if (movedist > growstep) { |
| 462 |
|
VSUB(vsum, vsum, curcent); |
| 463 |
|
movedist = growstep/VLEN(vsum); |
| 489 |
|
printf("0\n0\n4 %f %f %f %f\n", |
| 490 |
|
curcent[0], curcent[1], curcent[2], |
| 491 |
|
2.*180./PI*currad); |
| 492 |
+ |
niter = MAXITER; |
| 493 |
|
} |
| 494 |
+ |
#undef MAXITER |
| 495 |
|
} |
| 496 |
|
|
| 497 |
|
int |
| 556 |
|
} |
| 557 |
|
|
| 558 |
|
void |
| 559 |
< |
eputs(char *s) |
| 559 |
> |
eputs(const char *s) |
| 560 |
|
{ |
| 561 |
|
static int midline = 0; |
| 562 |
|
|
| 574 |
|
} |
| 575 |
|
|
| 576 |
|
void |
| 577 |
< |
wputs(char *s) |
| 577 |
> |
wputs(const char *s) |
| 578 |
|
{ |
| 579 |
|
/* no warnings */ |
| 580 |
|
} |