mset

package
v0.0.0-...-c7b4ba4 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2021 License: Unlicense Imports: 3 Imported by: 0

Documentation

Overview

Package mset constructs visual representations of the Mandelbrot set.

The Mandelbrot set is the visual representation of an iterated function on the complex plane.

ref: http://www.mandelbrotset.net/tutorial.html

Index

Constants

This section is empty.

Variables

View Source
var Colors = []color.Color{
	red,
	green,
	blue,
	yellow,
}

Colors represent the slice of colors that are used to represent how many iterations it took to escape the circle.

Thus pixels that escape on the first iteration are colored red, while pixels that escape on the second iteration are colored green.

View Source
var Grid = geometry.Rect(-2, -1.2, 1, 1.2)

Grid is the bounds of the coordinate system on which the Mandelbrot set will be displayed. The x and y values of grid doesn't represent pixels but rather positions on the coordinate system.

View Source
var Iterations = 100

Iterations represent the number of iterations that are required before a pixel is painted black.

Functions

This section is empty.

Types

type Image

type Image struct {
	// When White is true, color all pixels white that are outside of the circle
	// before the first iteration.
	White bool
	// contains filtered or unexported fields
}

Image implements a visual representation of the Mandelbrot set.

func New

func New(w, h int) (img *Image)

New returns a new image of the Mandelbrot set, with the specified dimensions.

func (*Image) At

func (img *Image) At(x, y int) color.Color

At returns the color of the pixel at (x, y).

The color of each pixel is based on the number of iterations it took to escape the circle. Pixels that are already outside of the circle will be colored white, if img.White is set to true. Pixels that doesn't escape the circle after the max number of iterations will be colored black.

func (*Image) Bounds

func (img *Image) Bounds() image.Rectangle

Bounds returns the domain for which At can return non-zero color. The bounds do not necessarily contain the point (0, 0).

func (*Image) ColorModel

func (img *Image) ColorModel() color.Model

ColorModel returns the Image's color model.

Jump to

Keyboard shortcuts

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