perlin-numpy icon indicating copy to clipboard operation
perlin-numpy copied to clipboard

Numerical issues

Open dli7319 opened this issue 1 year ago • 0 comments

When I run generate_perlin_noise_2d((721, 1281), (7, 7), (True, True)) I get the following issue: ValueError: operands could not be broadcast together with shapes (722,1281,2) (721,1281,2)

This can be fixed by enumerating the grid manually instead of using np.mgrid:

    grid = np.stack(np.meshgrid(
        np.arange(0, shape[1]) * res[1] / shape[1],
        np.arange(0, shape[0]) * res[0] / shape[0],
    )[::-1], axis=-1)

dli7319 avatar Apr 21 '23 15:04 dli7319