725 |
|
const double max_d = 1.0/(minarad*ambacc + 0.001); |
726 |
|
const double ang_res = 0.5*PI/(hp->ns-1); |
727 |
|
const double ang_step = ang_res/((int)(16/PI*ang_res) + (1+FTINY)); |
728 |
+ |
double avg_d = 0; |
729 |
|
uint32 flgs = 0; |
730 |
|
int i, j; |
731 |
< |
/* circle around perimeter */ |
731 |
> |
/* don't bother for a few samples */ |
732 |
> |
if (hp->ns < 12) |
733 |
> |
return(0); |
734 |
> |
/* check distances overhead */ |
735 |
> |
for (i = hp->ns*3/4; i-- > hp->ns>>2; ) |
736 |
> |
for (j = hp->ns*3/4; j-- > hp->ns>>2; ) |
737 |
> |
avg_d += ambsam(hp,i,j).d; |
738 |
> |
avg_d *= 4.0/(hp->ns*hp->ns); |
739 |
> |
if (avg_d*r0 >= 1.0) /* ceiling too low for corral? */ |
740 |
> |
return(0); |
741 |
> |
if (avg_d >= max_d) /* insurance */ |
742 |
> |
return(0); |
743 |
> |
/* else circle around perimeter */ |
744 |
|
for (i = 0; i < hp->ns; i++) |
745 |
|
for (j = 0; j < hp->ns; j += !i|(i==hp->ns-1) ? 1 : hp->ns-1) { |
746 |
|
AMBSAMP *ap = &ambsam(hp,i,j); |