NoiseGo
Implementation of Improved Perlin Noise in Golang.
NoiseGo is written only around 100 lines of Go (in version : 1.0.1).
Preview
Usage
import(
noise "github.com/TadaTeruki/NoiseGo/Noise"
)
func main(){
// noise.New(seed int64, maxValue uint64) noise.Noise
// - Initialize noise generator
// < arguments >
// seed : Seed value of noise
// maxValue : Maximum coordinate value (NOT float64)
// -When you queried a noise value with coodinate
// which is greater than maxValue or less than 0.0,
// the return value will be looped (See below comparison).
nz := noise.New(100, 256)
// noise.Get(x, y float64) float64
// - Get noise value with coordinate(x, y)
r1 := nz.Get(200.2, 81.4)
// noise.GetOctaved(x, y float64, octaves int, persistence float64) float64
// - Get octaved noise value with coordinate(x, y) and parameters(octaves, persistence)
r2 := nz.GetOctaved(200.2, 81.4, 10, 0.5)
}
maxValue = 30 |
maxValue = 3 |
|
|
Installation
All you need to do is run:
$ go get -u github.com/TadaTeruki/NoiseGo/Noise
References
LICENSE
MIT License
Copyright (c) 2022 Tada Teruki (多田 瑛貴)