Talk:Perlin noise: Difference between revisions

Line 21:
:: OK, I have added a post-condition and a comment in the opCall function in the D code. The image now looks smooth and nice, thank you. Do you also want to tell me what's the pre-condition of the "noise(double x, double y, double z)" Java method (this means, what's the allowed input range for those arguments x y z)? (Generally the more semantics you put in the code, then less likely is for people like me to use it wrongly). -[[User:Bearophile|bearophile]] ([[User talk:Bearophile|talk]])
::: x, y and z can be any real numbers. Notice that the noise will be zero if they are all integers, though.--[[User:Grondilu|Grondilu]] ([[User talk:Grondilu|talk]]) 18:19, 5 March 2014 (UTC)
::: I'm not 100% sure the result is guaranteed to be between -1 and 1. It's an interpolation from the gradients on the grid points so sometimes it can exceed, but whether or not it can is not obvious. So instead of putting a post-condition I think it's better to cap the valuesoutput with noise = min(+1, max(-1, noise)); or something like that.--[[User:Grondilu|Grondilu]] ([[User talk:Grondilu|talk]]) 18:24, 5 March 2014 (UTC)
1,934

edits