8.18
top
← prev up next →

noise: Perlin/Simplex noise generatorsπŸ”— i

John-Paul Verkamp <me@jverkamp.com>

This package provides Racket versions of the Perlin and Simplex noise generators.

Development Development of this library is hosted by GitHub at the following project page:

https://github.com/jpverkamp/noise/

1InstallationπŸ”— i

raco pkg install noise

2FunctionsπŸ”— i

procedure

(perlinx[yz])real?

x:real?
y:real? =0.0
z:real? =0.0
Calculates the 1D, 2D, or 3D Perlin noise value at the given point.

procedure

(simplex?x[yz])real?

x:real?
y:real? =0.0
z:real? =0.0
Calculates the 1D, 2D, or 3D Simplex noise value at the given point.

3ExamplesπŸ”— i

> (require images/flomapracket/flonumnoise)
> (define (clampmin max n)
(/ (- nmin )(- max min )))
> (define (build-perlin-imagewh#:scale[scale1.0])
3wh
(lambda (xy)
(define g(clamp-1.01.0(perlin(* scale(/ xw))(* scale(/ yh)))))
(vector ggg)))))
> (build-perlin-image256256#:scale10.0)
> (define (build-simplex-imagewh#:scale[scale1.0])
3wh
(lambda (xy)
(define g(clamp-1.01.0(simplex(* scale(/ xw))(* scale(/ yh)))))
(vector ggg)))))
> (build-simplex-image256256#:scale10.0)
> (define (build-colored-simplex-imagewh#:scale[scale1.0])
3wh
(lambda (xy)
(clamp-1.01.0(simplex(* scale(/ xw))(* scale(/ yh))-1.0))
(clamp-1.01.0(simplex(* scale(/ xw))(* scale(/ yh))0.0))
(clamp-1.01.0(simplex(* scale(/ xw))(* scale(/ yh))1.0)))))))
> (build-colored-simplex-image256256#:scale10.0)

4LicenseπŸ”— i

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License and GNU Lesser General Public License for more details.

top
← prev up next →

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /