fractal

package
v0.0.0-...-414057b Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2020 License: Unlicense Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Crci

func Crci(z complex128, c complex128) complex128

func RandomPoint

func RandomPoint(_ complex128, rng *rand7i.ComplexRNG) complex128

RandomPoint initializes each iteration with a random point.

func Zici

func Zici(z complex128, c complex128) complex128

func Zicr

func Zicr(z complex128, c complex128) complex128

func Zrci

func Zrci(z complex128, c complex128) complex128

func Zrcr

func Zrcr(z complex128, c complex128) complex128

func Zrzi

func Zrzi(z complex128, c complex128) complex128

Types

type Fractal

type Fractal struct {
	Width, Height int                // The width and height of the image to be constructed.
	R, G, B       histo.Histo        // The red, green and blue histograms.
	Method        *coloring.Coloring // Coloring method for the orbits.

	Importance     histo.Histo // Histogram of sampled points and their importance.
	PlotImportance bool        // Create an image of the sampling points color graded by their importance.

	// Function specific options.
	Iterations int64                                                // Number of iterations before assuming convergence.
	Bailout    float64                                              // (Squared) bailout radius.
	Plane      func(complex128, complex128) complex128              // Function to chose the capital plane.
	Func       func(complex128, complex128, complex128) complex128  // The complex function to explore!
	Register   func(complex128, complex128, *Orbit, *Fractal) int64 // Registering function for the orbits.
	Coef       complex128                                           // Complex coefficient used in the complex function.

	// Rendering specific options.
	Zoom   float64    // Zoom level of our render.
	Offset complex128 // Offset the camera center for the render.

	// Sampling specific options.
	Tries     float64 // Number of orbit attempts we will sample.
	Seed      int64   // The random seed we sample random points from.
	Threshold int64   // Threshold length of orbits.

	// Coloring method specific options.
	PathPoints  int64 // Number of intermediate points used for path interpolation.
	BezierLevel int   // Bezier interpolation level: 1 is linear, 2 is quadratic etc.

	Z, C func(complex128, *rand7i.ComplexRNG) complex128

	// Experimental options.
	Theta  float64 // Matrix rotation angle.
	Theta2 float64 // Second matrix rotation angle.
	// contains filtered or unexported fields
}

Fractal contains all options for rendering a specific fractal.

func Importance

func Importance(frac *Fractal) *Fractal

func New

func New(width, height int,
	iterations int64,
	method *coloring.Coloring,
	coef complex128,
	bailout float64,
	plane func(complex128, complex128) complex128,
	f func(complex128, complex128, complex128) complex128,
	zoom float64,
	offset complex128,
	plotImportance bool,
	seed int64,
	points int64,
	bezierLevel int,
	tries float64,
	register func(complex128, complex128, *Orbit, *Fractal) int64,
	theta float64,
	z, c func(complex128, *rand7i.ComplexRNG) complex128,
	threshold int64) *Fractal

New returns a new render for fractals.

func (*Fractal) Clear

func (frac *Fractal) Clear()

Clear removes old histogram data. Useful for interactive rendering.

func (*Fractal) ComplexToImage

func (frac *Fractal) ComplexToImage(z, c complex128) (p image.Point)

ptoc converts a point from the complex function to a pixel coordinate.

Stands for point to coordinate, which is actually a really shitty name because of it's ambiguous character haha.

func (*Fractal) ImageToComplex

func (frac *Fractal) ImageToComplex(x, y int) complex128

func (*Fractal) Point

func (frac *Fractal) Point(z, c complex128) (image.Point, bool)

func (*Fractal) String

func (frac *Fractal) String() string

func (Fractal) X

func (frac Fractal) X(r float64) int

X translates the real value of the complex point to an X-coordinate in the image plane.

func (Fractal) Y

func (frac Fractal) Y(i float64) int

Y translates the imaginary value of the complex point to an Y-coordinate in the image plane.

type Orbit

type Orbit struct {
	Points []complex128
	C      complex128
}

Orbit represents the orbit of points visited from iterating the complex function.

Jump to

Keyboard shortcuts

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