| 25 |
|
#define MINADIV 7 /* minimum # divisions in each dimension */ |
| 26 |
|
#endif |
| 27 |
|
#ifndef MINSDIST |
| 28 |
< |
#define MINSDIST 0.25 /* def. min. spacing = 1/4th division */ |
| 28 |
> |
#define MINSDIST 0.2 /* def. min. spacing = 1/5th division */ |
| 29 |
|
#endif |
| 30 |
|
|
| 31 |
|
typedef struct { |
| 81 |
|
trade_patchsamp(double ss[2]) /* trade in problem patch position */ |
| 82 |
|
{ |
| 83 |
|
static float tradelot[XLOTSIZ][2]; |
| 84 |
< |
static short gterm[COTHER+1]; |
| 84 |
> |
static int gterm[COTHER+1]; |
| 85 |
|
double repl[2]; |
| 86 |
|
int sclass, rclass; |
| 87 |
|
int x; |
| 88 |
< |
/* initialize lot? */ |
| 88 |
> |
re_initialize: /* initialize lot? */ |
| 89 |
|
while (gterm[COTHER] < XLOTSIZ) { |
| 90 |
|
tradelot[gterm[COTHER]][0] = frandom(); |
| 91 |
|
tradelot[gterm[COTHER]][1] = frandom(); |
| 106 |
|
x += (x >= gterm[sclass-1])*(gterm[sclass] - gterm[sclass-1]); |
| 107 |
|
break; |
| 108 |
|
} |
| 109 |
+ |
if (x >= XLOTSIZ) { /* uh-oh... trapped in a corner! */ |
| 110 |
+ |
memset(gterm, 0, sizeof(gterm)); |
| 111 |
+ |
goto re_initialize; |
| 112 |
+ |
} |
| 113 |
|
repl[0] = tradelot[x][0]; /* save selected replacement (result) */ |
| 114 |
|
repl[1] = tradelot[x][1]; |
| 115 |
|
/* identify replacement class */ |
| 221 |
|
spt[1]*hp->uy[ii] + |
| 222 |
|
zd*hp->onrm[ii]; |
| 223 |
|
checknorm(ar.rdir); |
| 224 |
< |
dimlist[ndims_inc] = AI(hp,i,j) + 90171; |
| 224 |
> |
dimlist[ndims_inc()] = AI(hp,i,j) + 90171; |
| 225 |
|
rayvalue(&ar); /* evaluate ray */ |
| 226 |
< |
dec_ndims; |
| 226 |
> |
dec_ndims(); |
| 227 |
|
zd = raydistance(&ar); |
| 228 |
|
if (zd <= FTINY) |
| 229 |
|
return(0); /* should never happen */ |