parameters

package
v0.0.0-...-b2797c8 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package parameters defines parameters used to plot Buddhabrot images.

Package parameters defines parameters used to plot Buddhabrot images.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateStops

func ValidateStops(fl validator.FieldLevel) bool

ValidateStops validates that the state of a slice of Stops.

Types

type Plot

type Plot struct {
	SampleSize,
	MaxIterations int `validate:"gte=1"`
	Region Region
	Width,
	Height int `validate:"gte=1"`
	Gradient        []Stop `validate:"validateStops"`
	DumpCounterFile bool
}

Plot represents the parameters to plot a Buddhabrot image of a given width and height. SampleSize determines the number of sample points used. MaxIterations is the maximum number of iterations to determine if a sample point is in the Mandelbrot set. It is also the maximum number of iterations to count orbits that pass through points visible in the plot. Region defines the region on the complex plane to plot. Gradient is a slice of colors and their positions in a linear gradient used to color the image. If set to true, the `dumpCounterFile` property wil dump the orbit counts per pixel to a file called counter.txt in the log directory.

type Region

type Region struct {
	MinReal,
	MaxReal,
	MinImag,
	MaxImag float64
}

Region is a region on the complex plane defined by minimum and maximum real and imaginary parts.

func (*Region) MatchAspectRatio

func (r *Region) MatchAspectRatio(width, height int)

MatchAspectRatio adjusts the imaginary range of the region to match the aspect ratio of the image being plotted.

func (Region) PointInRegion

func (r Region) PointInRegion(c complex128) bool

PointInRegion returns true if a given complex number is within the region.

type Stop

type Stop struct {
	Color    string  `validate:"hexcolor"`
	Position float64 `validate:"gte=0,lte=1"`
}

Stop is a hexadecimal color value and its position in a linear gradient from 0 to 1.

Jump to

Keyboard shortcuts

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