Documentation
¶
Index ¶
- func CreatePicture(coords Set, ramp []color.RGBA, width, height int, setColor color.RGBA) image.Image
- func F(z, c, exp complex128) complex128
- func HexToRGBA(hexColor string) color.RGBA
- func IsMemberJulia(z complex128, c complex128, iterations int) (bool, int)
- func IsMemberMandelbrot(c complex128, iterations int) (bool, int)
- func MakeRamp(stops []Stop) (ramp []color.RGBA)
- func OutputToJPG(img image.Image, outputFilename string)
- func WriteConfig(c Config, filename string)
- func WriteData(coords Set, filename string)
- func WriteDefault()
- type Action
- type BigJob
- type C128Job
- type Config
- type Job
- type Set
- type Stop
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreatePicture ¶
func CreatePicture(coords Set, ramp []color.RGBA, width, height int, setColor color.RGBA) image.Image
CreatePicture draws an image.RGBA image.Image from the points created above.
func F ¶
func F(z, c, exp complex128) complex128
F is the general form of the recurrence function `F = z^exp + c` .
func HexToRGBA ¶
HexToRGBA converts a hex string in the form "RRGGBB" to a color.RGBA. The alpha component is always 255 (opaque).
func IsMemberJulia ¶
func IsMemberJulia(z complex128, c complex128, iterations int) (bool, int)
IsMemberJulia runs the recurrent formula for the Julia set for the given number of iterations, and returns if the complex number `z` is in the set or not, as well as how many iterations it took to become 'infinity'.
func IsMemberMandelbrot ¶
func IsMemberMandelbrot(c complex128, iterations int) (bool, int)
IsMemberMandelbrot runs the recurrent formula for the Mandelbrot set for the given number of iterations, and returns if the complex number `c` is in the set or not, as well as how many iterations it took to become 'infinity'.
func OutputToJPG ¶
OutputToJPG writes an image.Image to the given output filename
Types ¶
type Action ¶
type Action func(Job)
Action is a function which takes a complex number and does iterations to determine if the point is in a set (eg Mandelbrot set) or not. It also returns the number of iterations.
type BigJob ¶
func NewBigJob ¶
func NewBigJob(n complex128, index, x, y int) *BigJob
func (*BigJob) RunMandelbrot ¶
This version runs about 30% faster than my "V1" version below. 3.3 mins vs 2.1 mins Math from https://randomascii.wordpress.com/2011/08/13/faster-fractals-through-algebra/
func (*BigJob) RunMandelbrotV1 ¶
type C128Job ¶
type C128Job struct { N complex128 // the complex number in question In bool // rough classification Iterations int // number of iterations before becoming unbound Index int // for indexing/sorting in slice X, Y int // for making jpgs }
Job contains information about a specific point in the mandelbrot set.
func NewC128Job ¶
func NewC128Job(n complex128, index, x, y int) *C128Job
func (*C128Job) RunMandelbrot ¶
type Config ¶
type Config struct { CenterReal float64 `json:"center_real"` CenterImag float64 `json:"center_imag"` PlotWidth float64 `json:"plot_width"` PlotHeight float64 `json:"plot_height"` XRes int `json:"x_res"` YRes int `json:"y_res"` Iterations int `json:"iterations"` RampFile string `json:"ramp_file"` DataFile string `json:"data_file"` ImageFile string `json:"image_file"` SetColor string `json:"set_color"` JuliaReal float64 `json:"julia_real"` JuliaImag float64 `json:"julia_imag"` }
Config is configuration info for the program, loaded from file.
func (Config) DoJulia ¶
DoJulia is a convenince function to determine if the program should make a Julia set or not. If Julia[Real/Imag] is 0.0,0.0, then this returns false.
func (Config) GetJulia ¶
func (c Config) GetJulia() complex128
GetJulia is a convenience function to get the Julia point as a complex128.
type Set ¶
type Set []Job
Set is a list of *Job
func (Set) CalculateProgress ¶
CalculateProgress performs `action` on all the coordinates in a Set. The progress can be obtained by providing the address of a float64 in which [0,1] will be written.
func (*Set) Initialize ¶
Initialize sets up a MandelSet according to the configuration specified.