mandelgif

package module
v0.0.0-...-c94d6aa Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 License: MIT Imports: 9 Imported by: 0

README

mandelgif

Generate animated gifs of zoom into the Mandelbrot Set, like this one:

Installation

To clone the source code:

git clone git@github.com:arl/mandelgif.git

To import the module as a dependency to your project (library):

go get github.com/arl/mandelgif@latest

To build and install the mandelgif executable on your system:

go install github.com/arl/mandelgif/cmd/mandelgif@latest

Usage:

mandelgif: renders a zoom of the Mandelbrot set into an animated Gif.

Usage:
	./mandelgif [options] [OUTFILE]

General Options:
	-help                Prints this help message
	-f -frames NUM       Produce an animation with NUM frames. default 50
	-z -zoom   FACTOR    Apply this zoom factor between successive frames. default 0.93)
	-p -point  COMPLEX   Zoom on this point in the complex plane. default "A" (i.e. '0.272195+0.00540474i')
	-w -width  PIXELS    Width of the output GIF image. default 256
	-h -height PIXELS    Height of the output GIF image. default 256
	-i -iter   ITER      Apply a maximum of ITER iterations on 𝒛. default 1024

Notes:
	* OUTFILE defaults to out.gif
	* The zoom point option "--point" accepts one of the following:
		- a complex numbers in the form "x+yi"
		- a letter from "A" to "F". Each letter represents a predefined interesting zoom point

Disclaimer

This program is voluntarily not optimized. Making it go faster is let as an exercice to the reader!

MIT license

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mandelbrot

type Mandelbrot struct {
	MaxIter   int        // maximum number of iterations
	ZoomLevel float64    // zoom applied at each frame
	ZoomPt    complex128 // zoom point
	Bounds    Rect
}

func (*Mandelbrot) Render

func (m *Mandelbrot) Render(w io.Writer, nframes, width, height int) error

Render renders the zoom into the Mandelbrot set as an animated Gif image with nframes frames of the specific width and height, into w.

type Rect

type Rect struct {
	X0, Y0 float64
	X1, Y1 float64
}

Rect is a rectangle defined by 2 points in the plane.

x0              x1

y0 +---------------+

|               |
|               |
|               |

y1 +---------------+

func (*Rect) Height

func (r *Rect) Height() float64

func (*Rect) Width

func (r *Rect) Width() float64

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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