Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

noise() returning value outside specified range.

in Bugs Posts: 421

It seems like the docs are incorrect in some cases:

print(noise(1.1559726487777, -0.34225689085513))
prints the value 1.0105441808701

which is certainly not -1.0 to 1.0 as the docs state.

Tagged:

Comments

  • dave1707dave1707 Mod
    Posts: 10,055

    Perlin noise does exceed the -1 to 1 range as you found out, but not by much. If you need the range to be exactly -1 to 1 then you need to clip the excess. Not sure what the exact limits are because there’s an infinite range of values to try. As for the docs, I use them as a guide since the info in them isn’t always exact or correct.

  • dave1707dave1707 Mod
    Posts: 10,055

    @Steppers There’s also a value difference between the perlin noise function you show and the craft.noise.perlin function.

    function setup()
    
        n=craft.noise.perlin()
        print(n:getValue(1.1559726487777, -0.34225689085513))
    
        print(noise(1.1559726487777, -0.34225689085513))
    end
    
  • Posts: 2,054

    As for the docs, I use them as a guide since the info in them isn’t always exact or correct.

    That's a pretty damning critique for documentation, imo :#

    Hopefully the team takes note.

  • dave1707dave1707 Mod
    Posts: 10,055

    @JakAttak I’m not saying the docs are all wrong, I’m saying that you’ll find errors or things missing here and there. I don’t expect anyone to spend their time proof reading the docs and changing them. I’d rather the time be spent updating Codea then spent updating the docs. There’s some errors and they know it. I know it and so does anyone else who uses the docs.

Sign In or Register to comment.