26 |
|
|
27 |
|
/* reference width maximum (1.0) */ |
28 |
|
static const unsigned iwbits = sizeof(unsigned)*4; |
29 |
< |
static const unsigned iwmax = (1<<(sizeof(unsigned)*4))-1; |
29 |
> |
static const unsigned iwmax = 1<<(sizeof(unsigned)*4); |
30 |
|
/* maximum cumulative value */ |
31 |
|
static const unsigned cumlmax = ~0; |
32 |
|
/* constant z-vector */ |
33 |
|
static const FVECT zvec = {.0, .0, 1.}; |
34 |
+ |
/* quantization value */ |
35 |
+ |
static double quantum = 1./256.; |
36 |
|
|
37 |
|
/* Struct used for our distribution-building callback */ |
38 |
|
typedef struct { |
609 |
|
SDgetTreCDist(const FVECT inVec, SDComponent *sdc) |
610 |
|
{ |
611 |
|
const SDTre *sdt; |
612 |
< |
double inCoord[2], quantum; |
612 |
> |
double inCoord[2]; |
613 |
|
int i; |
614 |
|
SDTreCDst *cd, *cdlast; |
615 |
|
/* check arguments */ |
623 |
|
} else |
624 |
|
return NULL; /* should be internal error */ |
625 |
|
/* quantize to avoid f.p. errors */ |
624 |
– |
quantum = SDsmallestLeaf(sdt->st); |
626 |
|
for (i = sdt->st->ndim - 2; i--; ) |
627 |
|
inCoord[i] = floor(inCoord[i]/quantum)*quantum + .5*quantum; |
628 |
|
cdlast = NULL; /* check for direction in cache list */ |
846 |
|
double stepWidth, dhemi, bmin[4], bmax[4]; |
847 |
|
|
848 |
|
stepWidth = SDsmallestLeaf(st); |
849 |
+ |
if (quantum > stepWidth) /* adjust quantization factor */ |
850 |
+ |
quantum = stepWidth; |
851 |
|
df->minProjSA = M_PI*stepWidth*stepWidth; |
852 |
|
if (stepWidth < .03125) |
853 |
|
stepWidth = .03125; /* 1/32 resolution good enough */ |