fractal

package
v0.0.0-...-abc17c1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clamp

func Clamp(value int) uint8

func RandomNumber

func RandomNumber(maxN int) int

Types

type BaseFlameGenerator

type BaseFlameGenerator struct {
	Width           int
	Height          int
	Iterations      int
	Transformations []Transformation
	Symmetry        int
	Gamma           float64
}

func (*BaseFlameGenerator) ProcessPoint

func (fg *BaseFlameGenerator) ProcessPoint(point Point, transformations []Transformation, canvas *Canvas, world Rect)

type Canvas

type Canvas struct {
	Pixels [][]*Pixel
	Width  int
	Height int
}

func NewCanvas

func NewCanvas(width, height int) *Canvas

func (*Canvas) MapToCanvas

func (c *Canvas) MapToCanvas(world Rect, point Point) (x, y int)

func (*Canvas) RenderToImage

func (c *Canvas) RenderToImage(img *image.RGBA, gamma float64)

func (*Canvas) UpdatePixel

func (c *Canvas) UpdatePixel(x, y int, transformation Transformation)

type FlameGeneratorInterface

type FlameGeneratorInterface interface {
	Generate(transformations []Transformation) *image.RGBA
}

type MultiFlameGenerator

type MultiFlameGenerator struct {
	BaseFlameGenerator
	Workers int
}

func NewMultiFlameGenerator

func NewMultiFlameGenerator(cfg *config.Config, transformations []Transformation) *MultiFlameGenerator

func (*MultiFlameGenerator) Generate

func (fg *MultiFlameGenerator) Generate(transformations []Transformation) *image.RGBA

type Pixel

type Pixel struct {
	R, G, B  uint8
	HitCount int
}

type Point

type Point struct {
	X, Y float64
}

func NewRandomPoint

func NewRandomPoint() Point

type Rect

type Rect struct {
	X, Y   float64
	Width  float64
	Height float64
}

func NewDefaultRect

func NewDefaultRect() Rect

type SingleFlameGenerator

type SingleFlameGenerator struct {
	BaseFlameGenerator
}

func NewSingleFlameGenerator

func NewSingleFlameGenerator(cfg *config.Config, transformations []Transformation) *SingleFlameGenerator

func (*SingleFlameGenerator) Generate

func (fg *SingleFlameGenerator) Generate(transformations []Transformation) *image.RGBA

type Transformation

type Transformation interface {
	Apply(p Point) Point
	Color() color.Color
}

Jump to

Keyboard shortcuts

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