Closed benfrankel closed 3 years ago
Right now WrappingBlueNoise
seems about 2x slower than BlueNoise
on my machine, which makes sense. I think it could be optimized by adding a 2-wide border of cells around the grid, then duplicating points that are near the border in insert_point
so that the distance calculations in is_valid
can be much faster.
Right now
WrappingBlueNoise
seems about 2x slower thanBlueNoise
on my machine, which makes sense. I think it could be optimized by adding a 2-wide border of cells around the grid, then duplicating points that are near the border ininsert_point
so that the distance calculations inis_valid
can be much faster.
I think for now the hit is okay. If you would like to create an issue just to keep track we can decide if it needs to be changed down the line.
Updated the PR, and created an issue: #7.
Good stuff, thanks for the patch!
WrappingBlueNoise
is likeBlueNoise
, but it considers points on opposite edges of the box to be near each other. This allows the generated blue noise to tile with itself without forming clusters of points at the edges / corners where tiles meet.I tried to avoid performance regressions for the non-wrapping blue noise case, keep the API simple, and avoid code duplication in that order. There's probably a better way to implement this, though.