noise

package
v0.0.0-...-75ff7da Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var F2 = 0.5 * (math.Sqrt(3.0) - 1.0)

Skewing and unskewing factors for 2, 3, and 4 dimensions

View Source
var F3 = 1.0 / 3.0
View Source
var F4 = (math.Sqrt(5.0) - 1.0) / 4.0
View Source
var G2 = (3.0 - math.Sqrt(3.0)) / 6.0
View Source
var G3 = 1.0 / 6.0
View Source
var G4 = (5.0 - math.Sqrt(5.0)) / 20.0
View Source
var GRAD3 = []Grad{
	NewGrad3(1, 1, 0), NewGrad3(-1, 1, 0), NewGrad3(1, -1, 0), NewGrad3(-1, -1, 0),
	NewGrad3(1, 0, 1), NewGrad3(-1, 0, 1), NewGrad3(1, 0, -1), NewGrad3(-1, 0, -1),
	NewGrad3(0, 1, 1), NewGrad3(0, -1, 1), NewGrad3(0, 1, -1), NewGrad3(0, -1, -1),
}
View Source
var GRAD4 = []Grad{
	NewGrad4(0, 1, 1, 1), NewGrad4(0, 1, 1, -1), NewGrad4(0, 1, -1, 1), NewGrad4(0, 1, -1, -1),
	NewGrad4(0, -1, 1, 1), NewGrad4(0, -1, 1, -1), NewGrad4(0, -1, -1, 1), NewGrad4(0, -1, -1, -1),
	NewGrad4(1, 0, 1, 1), NewGrad4(1, 0, 1, -1), NewGrad4(1, 0, -1, 1), NewGrad4(1, 0, -1, -1),
	NewGrad4(-1, 0, 1, 1), NewGrad4(-1, 0, 1, -1), NewGrad4(-1, 0, -1, 1), NewGrad4(-1, 0, -1, -1),
	NewGrad4(1, 1, 0, 1), NewGrad4(1, 1, 0, -1), NewGrad4(1, -1, 0, 1), NewGrad4(1, -1, 0, -1),
	NewGrad4(-1, 1, 0, 1), NewGrad4(-1, 1, 0, -1), NewGrad4(-1, -1, 0, 1), NewGrad4(-1, -1, 0, -1),
	NewGrad4(1, 1, 1, 0), NewGrad4(1, 1, -1, 0), NewGrad4(1, -1, 1, 0), NewGrad4(1, -1, -1, 0),
	NewGrad4(-1, 1, 1, 0), NewGrad4(-1, 1, -1, 0), NewGrad4(-1, -1, 1, 0), NewGrad4(-1, -1, -1, 0),
}
View Source
var PERLIN_BASE = []int{}/* 256 elements not displayed */

All numbers, [0, 255] in random order, based on seed

View Source
var SWAP_ITERATIONS = 256 * 4

Functions

func Perlin

func Perlin(x, y, z float64) float64

Types

type Grad

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

Struct to speed up gradient computations (array access is a lot slower than member access)

func NewGrad3

func NewGrad3(x, y, z float64) Grad

func NewGrad4

func NewGrad4(x, y, z, w float64) Grad

type Inspector

type Inspector struct {
	Total float64
	Count float64
	Min   float64
	Max   float64
}

func NewInspector

func NewInspector() *Inspector

func (*Inspector) Log

func (i *Inspector) Log()

func (*Inspector) Record

func (i *Inspector) Record(value float64)

type OpenSimplexOctave

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

func New

func New() *OpenSimplexOctave

func NewOpenSimplexOctaveWithPerm

func NewOpenSimplexOctaveWithPerm(perm []int16) *OpenSimplexOctave

func NewOpenSimplexOctaveWithSeed

func NewOpenSimplexOctaveWithSeed(seed int64) *OpenSimplexOctave

Initializes the class using a permutation array generated from a 64-bit seed. Generates a proper permutation (i.e. doesn't merely perform N successive pair swaps on a base array) Uses a simple 64-bit LCG.

type RidgedMultifractalFilter

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

func NewRidgedMultifractalFilter

func NewRidgedMultifractalFilter(numOctaves int, offset, lacunarity, gain, H float64) *RidgedMultifractalFilter

* Some good parameter values to start with: * * H: 1.0 * offset: 1.0 * gain: 2.0

func (*RidgedMultifractalFilter) Filter

func (rm *RidgedMultifractalFilter) Filter(x, y, z float64, source Source3d) float64

type Simplex

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

func NewSimplex

func NewSimplex(numOctaves int, persistence float64, seed int64) *Simplex

Persistence is a value [0, 1], where 0 is flat and 1 is vertical cliffs

func (*Simplex) Noise2

func (sn *Simplex) Noise2(x, y float64) float64

func (*Simplex) Noise3

func (sn *Simplex) Noise3(x, y, z float64) float64

type SimplexOctave

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

func NewSimplexOctave

func NewSimplexOctave(seed int64) *SimplexOctave

type Source2d

type Source2d interface {
	Noise2(x, y float64) float64
}

type Source3d

type Source3d interface {
	Noise3(x, y, z float64) float64
}

type Source4d

type Source4d interface {
	Noise4(x, y, z, w float64) float64
}

Jump to

Keyboard shortcuts

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