(2d) perlin-noise: dot product of a gradient and a

2019-08-22 10:36发布

I am looking for a function that takes the coordinates of a current pixel and the coordinates of a corner (for a gradient), and returns the dot product of the gradient of that corner and the direction vector between the pixel and a corner. So the function would look like this: dot-grid-gradient: number number number number -> number

64 grids and 81 gradients:

enter image description here

I already made a list of 81 gradients whose x and y coordinates were between 0 and 1 and all randomly generated. A gradient would be the structure: eg. (make-gradient 0.1223 0.8824). How would I implement something like this? I think my main problem is to "connect" the x and y values of a corner with its gradient. Can someone help?

Thank you so much :)

0条回答
登录 后发表回答