| 242 |
|
double |
| 243 |
|
get_threshold(const TRITREE *tree) |
| 244 |
|
{ |
| 245 |
+ |
long samptotal = 0; |
| 246 |
|
long exphisto[256]; |
| 246 |
– |
long samptotal; |
| 247 |
|
int i; |
| 248 |
|
/* compute sample histogram */ |
| 249 |
< |
memset((void *)exphisto, 0, sizeof(exphisto)); |
| 249 |
> |
memset(exphisto, 0, sizeof(exphisto)); |
| 250 |
|
for (i = 0; i < NTRUNKBR; i++) |
| 251 |
|
get_ehisto(&tree->kid[i], exphisto); |
| 252 |
|
/* use 98th percentile */ |
| 355 |
|
if (remaining) |
| 356 |
|
return; |
| 357 |
|
/* consolidate empties */ |
| 358 |
< |
free((void *)node->kid); node->kid = NULL; |
| 358 |
> |
free(node->kid); node->kid = NULL; |
| 359 |
|
copycolr(node->val, blkclr); |
| 360 |
|
node->sd = node->gdv[0]; /* doesn't really matter */ |
| 361 |
|
} |
| 387 |
|
if (fdir2diff(thisp->sd,cent) <= maxr2) { |
| 388 |
|
LOSTLIGHT *mynext = thisp->next; |
| 389 |
|
addcolor(intens, thisp->intens); |
| 390 |
< |
free((void *)thisp); |
| 390 |
> |
free(thisp); |
| 391 |
|
lastp->next = mynext; |
| 392 |
|
} else |
| 393 |
|
lastp = thisp; |
| 398 |
|
void |
| 399 |
|
mksources(TRITREE *samptree, double thresh, double maxang) |
| 400 |
|
{ |
| 401 |
+ |
#define MAXITER 100 |
| 402 |
|
const int ethresh = (int)(log(thresh)/log(2.) + (COLXS+.5)); |
| 403 |
|
const double maxomega = 2.*PI*(1. - cos(PI/180./2.*maxang)); |
| 404 |
|
const double minintens = .05*thresh*maxomega; |
| 405 |
+ |
int niter = MAXITER; |
| 406 |
|
int nsrcs = 0; |
| 407 |
|
LOSTLIGHT *lostlightlist = NULL; |
| 408 |
|
int emax; |
| 428 |
|
*/ |
| 429 |
|
if (thresh <= FTINY) |
| 430 |
|
return; |
| 431 |
< |
for ( ; ; ) { |
| 431 |
> |
while (niter--) { |
| 432 |
|
emax = ethresh; /* find brightest unclaimed */ |
| 433 |
|
startleaf = NULL; |
| 434 |
|
for (i = 0; i < NTRUNKBR; i++) { |
| 459 |
|
thisethresh); |
| 460 |
|
if (normalize(vsum) == .0) |
| 461 |
|
break; |
| 462 |
< |
movedist = acos(DOT(vsum,curcent)); |
| 462 |
> |
movedist = Acos(DOT(vsum,curcent)); |
| 463 |
|
if (movedist > growstep) { |
| 464 |
|
VSUB(vsum, vsum, curcent); |
| 465 |
|
movedist = growstep/VLEN(vsum); |
| 491 |
|
printf("0\n0\n4 %f %f %f %f\n", |
| 492 |
|
curcent[0], curcent[1], curcent[2], |
| 493 |
|
2.*180./PI*currad); |
| 494 |
+ |
niter = MAXITER; |
| 495 |
|
} |
| 496 |
+ |
#undef MAXITER |
| 497 |
|
} |
| 498 |
|
|
| 499 |
|
int |