random

package
v0.0.0-...-4982ab1 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package random contains functions, MakeXXX, that can be used to create a random texture tree.

The following code creates a random tree up to six nodes deep and uses it to render to an 800x800 image, which is then saved as "example.png"

package main

import (
	"github.com/jphsd/graphics2d/image"
	"github.com/jphsd/texture"
	"github.com/jphsd/texture/random"
)

func main() {
	cf := random.MakeColorField(6, 0)
	img := texture.NewRGBA(800, 800, cf, 0, 0, 1, 1)
	image.SaveImage(img, "example")
}

Index

Constants

This section is empty.

Variables

View Source
var ColorFieldOptions []ColorFieldOpts
View Source
var Lambdas = []float64{
	11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97,
}
View Source
var LeafOptions = []Leaf{

	{"LinearGradient", MakeLinearGradient},
	{"RadialGradient", MakeRadialGradient},
	{"ConicGradient", MakeConicGradient},
	{"TiledGradient", MakeTiledGradient},
	{"Binary", MakeBinary},
	{"Perlin", MakePerlin},
	{"DistortedPerlin", MakeDistortedPerlin},
	{"Image", MakeImage},
}
View Source
var NLFOptions = []NLFunc{
	{"Linear", MakeNLLinear},
	{"Square", MakeNLSquare},
	{"Cube", MakeNLCube},
	{"Exponential", MakeNLExponential},
	{"Logarithmic", MakeNLLogarithmic},
	{"Sin", MakeNLSin},
	{"Sin1", MakeNLSin1},
	{"Sin2", MakeNLSin2},
	{"Circle1", MakeNLCircle1},
	{"Circle2", MakeNLCircle2},
	{"Catenary", MakeNLCatenary},
	{"Gauss", MakeNLGauss},
	{"Logistic", MakeNLLogistic},
	{"NLP3", MakeNLP3},
	{"NLP5", MakeNLP5},
	{"NLRand", MakeNLRand},
}
View Source
var NodeOptions []Node
View Source
var Sample image.Image

Functions

func MakeAddCombiner

func MakeAddCombiner(md, d int) texture.Field

func MakeBinary

func MakeBinary() texture.Field

MakeBinary creates a new field backed by bit noise.

func MakeBlend

func MakeBlend(md, d int) texture.Field

func MakeColorBlend

func MakeColorBlend(md, d int) texture.ColorField

MakeColorBlend creates a color field from two input color fields and a field.

func MakeColorConv

func MakeColorConv(md, d int) texture.ColorField

MakeColorConv creates a new color field from a field.

func MakeColorField

func MakeColorField(md, d int) texture.ColorField

MakeColorField creates a new color field.

func MakeColorFields

func MakeColorFields(md, d int) texture.ColorField

MakeColorFields creates a color field from three fields.

func MakeColorGray

func MakeColorGray(md, d int) texture.ColorField

MakeColorGray creates a new color field from a field.

func MakeColorSinCos

func MakeColorSinCos(md, d int) texture.ColorField

MakeColorSinCos creates a new color field from a field.

func MakeColorSubstitute

func MakeColorSubstitute(md, d int) texture.ColorField

MakeColorSubstitute creates a color field from two input color fields and a field.

func MakeComponent

func MakeComponent() *texture.Component

MakeComponent creates a new component.

func MakeConicGradient

func MakeConicGradient() texture.Field

func MakeDiffCombiner

func MakeDiffCombiner(md, d int) texture.Field

func MakeDirection

func MakeDirection(md, d int) texture.Field

MakeDirection creates a new field from a vector field.

func MakeDisplace

func MakeDisplace(md, d int) texture.Field

MakeDisplace creates a displacement of src1 with src2 and src3.

func MakeDistort

func MakeDistort(md, d int) texture.Field

MakeDistort creates a new distorted processor.

func MakeDistortedPerlin

func MakeDistortedPerlin() texture.Field

MakeDistortedPerlin creates a new field backed by a perlin noise function.

func MakeField

func MakeField(md, d int) texture.Field

MakeField creates either a new leaf or node.

func MakeFractal

func MakeFractal(md, d int) texture.Field

MakeFractal creates a new fractal processor.

func MakeImage

func MakeImage() texture.Field

func MakeJitterBlend

func MakeJitterBlend(md, d int) texture.Field

func MakeLeaf

func MakeLeaf() texture.Field

MakeLeaf creates a new leaf.

func MakeLinearGradient

func MakeLinearGradient() texture.Field

func MakeMagnitude

func MakeMagnitude(md, d int) texture.Field

MakeMagnitude creates a new field from a vector field.

func MakeMaxCombiner

func MakeMaxCombiner(md, d int) texture.Field

func MakeMinCombiner

func MakeMinCombiner(md, d int) texture.Field

func MakeMorphological

func MakeMorphological(md, d int) texture.Field

func MakeMulCombiner

func MakeMulCombiner(md, d int) texture.Field

func MakeNL

func MakeNL() *texture.NonLinear

func MakeNLCatenary

func MakeNLCatenary() *texture.NonLinear

func MakeNLCircle1

func MakeNLCircle1() *texture.NonLinear

func MakeNLCircle2

func MakeNLCircle2() *texture.NonLinear

func MakeNLCube

func MakeNLCube() *texture.NonLinear

func MakeNLExponential

func MakeNLExponential() *texture.NonLinear

func MakeNLFilter

func MakeNLFilter(md, d int) texture.Field

MakeNLFilter creates a non-linear filter.

func MakeNLGauss

func MakeNLGauss() *texture.NonLinear

func MakeNLLinear

func MakeNLLinear() *texture.NonLinear

func MakeNLLogarithmic

func MakeNLLogarithmic() *texture.NonLinear

func MakeNLLogistic

func MakeNLLogistic() *texture.NonLinear

func MakeNLP3

func MakeNLP3() *texture.NonLinear

func MakeNLP5

func MakeNLP5() *texture.NonLinear

func MakeNLRand

func MakeNLRand() *texture.NonLinear

func MakeNLSin

func MakeNLSin() *texture.NonLinear

func MakeNLSin1

func MakeNLSin1() *texture.NonLinear

func MakeNLSin2

func MakeNLSin2() *texture.NonLinear

func MakeNLSquare

func MakeNLSquare() *texture.NonLinear

func MakeNLWave

func MakeNLWave() texture.Wave

MakeNLWave creates a new NLWave

func MakeNode

func MakeNode(md, d int) texture.Field

MakeNode creates a new node.

func MakeNormal

func MakeNormal(md, d int) texture.VectorField

MakeNormal creates a new vector field from a field.

func MakePattern

func MakePattern(n int) []float64

func MakePatternWave

func MakePatternWave() texture.Wave

MakePatternWave

func MakePerlin

func MakePerlin() texture.Field

MakePerlin creates a new field backed by a perlin noise function.

func MakeQuantizeFilter

func MakeQuantizeFilter(md, d int) texture.Field

MakeQuantizeFilter creates a non-linear filter.

func MakeRadialGradient

func MakeRadialGradient() texture.Field

func MakeRandQuantFilter

func MakeRandQuantFilter(md, d int) texture.Field

MakeRandQuantFilter creates a non-linear filter.

func MakeReflect

func MakeReflect(md, d int) texture.Field

MakeReflect creates a mirror plane in the field.

func MakeSelect

func MakeSelect(md, d int) texture.Field

MakeSelect creates a new field from a vector field.

func MakeStochasticBlend

func MakeStochasticBlend(md, d int) texture.Field

func MakeStrip

func MakeStrip(md, d int) texture.Field

MakeStrip creates a new strip processor

func MakeSubCombiner

func MakeSubCombiner(md, d int) texture.Field

func MakeSubstituteCombiner

func MakeSubstituteCombiner(md, d int) texture.Field

func MakeSupport

func MakeSupport() [][]float64

func MakeTiledGradient

func MakeTiledGradient() texture.Field

func MakeTransform

func MakeTransform(md, d int) texture.Field

MakeTransform creates a new transform processor

func MakeUniform

func MakeUniform() texture.Field

MakeUniform creates a new Uniform

func MakeVariableFractal

func MakeVariableFractal(md, d int) texture.Field

MakeVariableFractal creates a new fractal processor.

func MakeVectorField

func MakeVectorField(md, d int) texture.VectorField

MakeVectorField creates a new VectorField.

func MakeWave

func MakeWave() texture.Wave

func MakeWeightedCombiner

func MakeWeightedCombiner(md, d int) texture.Field

func MakeWindowedCombiner

func MakeWindowedCombiner(md, d int) texture.Field

func PickLambda

func PickLambda() float64

Types

type ColorFieldOpts

type ColorFieldOpts struct {
	Name string
	Make func(int, int) texture.ColorField
}

ColorFieldOpts describes the available ColorField functions.

func GetColorFields

func GetColorFields() []ColorFieldOpts

GetColorFields returns the list of ColorField functions.

type Leaf

type Leaf struct {
	Name string
	Make func() texture.Field
}

Leaf describes a Field that has no predecessors.

type NLFunc

type NLFunc struct {
	Name string
	Make func() *texture.NonLinear
}

type Node

type Node struct {
	Name string
	Make func(int, int) texture.Field
}

Node describes a Field that has predecessors.

func GetNodes

func GetNodes() []Node

GetNodes returns a slice of the available nodes.

Jump to

Keyboard shortcuts

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