cemyuksel / cyCodeBase

An open source programming resource intended for graphics programmers.
MIT License
271 stars 60 forks source link

Bug in GetMaxPoissonDiskRadius in Weighted Sample Elimination #17

Closed graphitemaster closed 2 years ago

graphitemaster commented 2 years ago

When omitting the domain size to GetMaxPoissonDiskRadius this function computes the area or N-dimensional volume of the box, except the loop which goes over all the dimensions fails to index the bounds array and always uses the first axis, as can be seen here https://github.com/cemyuksel/cyCodeBase/blob/master/cySampleElim.h#L279

Trivial patch provided

- for ( int d=1; d<DIMENSIONS; d++ ) domainSize *= boundsMax[0] - boundsMin[0];
+ for ( int d=1; d<DIMENSIONS; d++ ) domainSize *= boundsMax[d] - boundsMin[d];
cemyuksel commented 2 years ago

Nice catch! This is fixed in the latest update.