perlin

package
v0.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2020 License: MIT Imports: 2 Imported by: 3

Documentation

Overview

Package perlin provides coherent noise function over 1, 2 or 3 dimensions This code is go adaptagion based on C implementation that can be found here: http://git.gnome.org/browse/gegl/tree/operations/common/perlin/perlin.c (original copyright Ken Perlin)

Index

Constants

View Source
const (
	B  = 0x100
	N  = 0x1000
	BM = 0xff
)

General constants

Variables

This section is empty.

Functions

This section is empty.

Types

type Perlin

type Perlin struct {
	// contains filtered or unexported fields
}

Perlin is the noise generator

func NewPerlin

func NewPerlin(alpha, beta float64, n int, seed int64) *Perlin

NewPerlin creates new Perlin noise generator In what follows "alpha" is the weight when the sum is formed. Typically it is 2, As this approaches 1 the function is noisier. "beta" is the harmonic scaling/spacing, typically 2, n is the number of iterations and seed is the math.rand seed value to use

func NewPerlinRandSource

func NewPerlinRandSource(alpha, beta float64, n int, source rand.Source) *Perlin

NewPerlinRandSource creates new Perlin noise generator In what follows "alpha" is the weight when the sum is formed. Typically it is 2, As this approaches 1 the function is noisier. "beta" is the harmonic scaling/spacing, typically 2, n is the number of iterations and source is source of pseudo-random int64 values

func (*Perlin) Noise1D

func (p *Perlin) Noise1D(x float64) float64

Noise1D generates 1-dimensional Perlin Noise value

func (*Perlin) Noise2D

func (p *Perlin) Noise2D(x, y float64) float64

Noise2D Generates 2-dimensional Perlin Noise value

func (*Perlin) Noise3D

func (p *Perlin) Noise3D(x, y, z float64) float64

Noise3D Generates 3-dimensional Perlin Noise value

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL