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

*爱你&永不变心* 提交于 2019-12-11 15:04:17

问题


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:

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 :)

来源:https://stackoverflow.com/questions/47499759/2d-perlin-noise-dot-product-of-a-gradient-and-a-direction-vector

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!