76 |
|
int main (int argc, char** argv) |
77 |
|
{ |
78 |
|
char format [128]; |
79 |
< |
RREAL rad, radScale = RADSCALE, vol, dumpRatio; |
80 |
< |
unsigned arg, j, ptype; |
79 |
> |
RREAL rad, radScale = RADSCALE, extent, dumpRatio; |
80 |
> |
unsigned arg, j, ptype, dim; |
81 |
|
long numSpheres = NSPHERES; |
82 |
|
FILE *pmapFile; |
83 |
|
PhotonMap pm; |
172 |
|
for (j = 0; j < 4; j++) |
173 |
|
getflt(pmapFile); |
174 |
|
|
175 |
< |
/* Sphere radius based on avg intersphere dist |
176 |
< |
(= sphere distrib density ^-1/3) */ |
177 |
< |
vol = (pm.maxPos [0] - pm.minPos [0]) * (pm.maxPos [1] - pm.minPos [1]) * |
178 |
< |
(pm.maxPos [2] - pm.minPos [2]); |
179 |
< |
rad = radScale * RADCOEFF * pow(vol / numSpheres, 1./3.); |
175 |
> |
/* Sphere radius based on avg intersphere dist depending on |
176 |
> |
whether the distribution occupies a 1D line (!), a 2D plane, |
177 |
> |
or 3D volume (= sphere distrib density ^-1/d, where d is the |
178 |
> |
dimensionality of the distribution) */ |
179 |
> |
for (j = 0, extent = 1.0, dim = 0; j < 3; j++) { |
180 |
> |
rad = pm.maxPos [j] - pm.minPos [j]; |
181 |
> |
|
182 |
> |
if (rad > FTINY) { |
183 |
> |
dim++; |
184 |
> |
extent *= rad; |
185 |
> |
} |
186 |
> |
} |
187 |
> |
|
188 |
> |
rad = radScale * RADCOEFF * pow(extent / numSpheres, 1./dim); |
189 |
|
|
190 |
|
/* Photon dump probability to satisfy target sphere count */ |
191 |
|
dumpRatio = numSpheres < pm.numPhotons |