fbm

package
v0.0.0-...-f3339c6 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigFunc

type ConfigFunc func(fbm *Fbm)

func WithAmpl

func WithAmpl(ampl float64) ConfigFunc

WithAmpl sets amplitude of fbm.

func WithFreq

func WithFreq(freq float64) ConfigFunc

WithFreq sets frequency of fbm, should be a sufficiently low number.

func WithLacunarity

func WithLacunarity(lacunarity float64) ConfigFunc

WithLacunarity sets lacunarity of fbm, must be value greater than 1. Lacunarity is strength of each cascading frequency per octave.

func WithOctaves

func WithOctaves(octaves int) ConfigFunc

WithOctaves sets amount of octaves for fbm, this effectively means amount of times each noise will run on top of each other. Must be greater or equal 1.

func WithPersistence

func WithPersistence(persistence float64) ConfigFunc

WithPersistence sets persistence of fbm, must be value in range (0, 1). Persistence is strength of each cascading amplitude per octave.

type Fbm

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

func New

func New(f ...ConfigFunc) *Fbm

New constructs a new *Fbm, setting parameters to reasonable default values: freq: 0.005, ampl: 1, octaves: 1, persistence: 0.5, lacunarity: 2.0. Accepts multiple ConfigFunc to customize instead of default values.

func (*Fbm) EncodeImage

func (f *Fbm) EncodeImage(maker noise.Maker, imageBounds image.Rectangle, filename string)

func (*Fbm) Modulate

func (f *Fbm) Modulate(maker noise.Maker, x float64, y float64) float64

Jump to

Keyboard shortcuts

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