godelbrot

package module
v0.0.0-...-37f3e00 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2016 License: MIT Imports: 18 Imported by: 0

README

godelbrot

Summary

A Unix-style Mandelbrot set explorer in Go.

Demo

Webdelbrot client

Webdelbrot is a gopherjs web client for Godelbrot. Godelbrot is a fractal render backend designed to allow easy implementation of GUI clients.

Features

  • Designed as Unix toolkit of orthogonal command-line apps
  • Provides middleware REST service to manage queuing and concurrency
  • Zoom into image given pixel boundaries (no math for you! :)
  • Configuration file generation tool (configbrot)
  • Subdividing regions algorithm
  • Arbitrary precision mode (and extensible internals)
  • Greyscale is default (for integration into an external pipeline)

Philosophy

  • Worse is better
  • Few features
  • Designed for extensibility (both internally, and in command-line app usage)
  • Ease of client implementation

Get it

$ go get github.com/johnny-morrice/godelbrot
$ go install -tags production github.com/johnny-morrice/godelbrot...

As Godelbrot is a multiple-binary toolkit so the latter command installs all other binaries.

Use it

$ godelbrot > mandelbrot.png

Which is equivalent to:

$ configbrot | renderbrot > mandelbrot.png

configbrot generates configuration files and supports a range of options. Try

$ configbrot -help

For a persisent process try restfulbrot

$ # Terminal A
$ # Run fractal webservice
$ # Options given to configbrot here become defaults for all render clients.
$ configbrot -palette pretty | restfulbrot

$ # Terminal B
$ # Render through the webservice
$ # Customize defaults with configbrot options
$ configbrot -width 1920 -height 1080 | clientbrot > mandelbrot.png

restfulbrot supports a range of options useful for the implementors of viewing clients.

clientbrot is a command line client of restfulbrot.

$ # No configbrot needed when zooming to item stored server-side.
$ clientbrot --cycle --getrq CJRRiGU_neADTL-GWEoC -xmin 100 -xmax 350 -ymin 100 -ymax 280 > img/zoom.png

colorbrot is provided as a convenience for those who may like to recolour the output.

You might also like

Webdelbrot is a web front-end for Godelbrot.

http://github.com/johnny-morrice/webdelbrot

Credits

John Morrice

http://functorama.com

https://github.com/johnny-morrice

See HISTORY.md for contributors

License

We use an MIT style license. See LICENSE.txt for terms of use and distribution.

Documentation

Index

Constants

View Source
const (
	Grayscale = PaletteKind(iota)
	Redscale
	Pretty
)
View Source
const DefaultBase int = 10

Default base for newly parsed numbers

View Source
const DefaultBufferSize uint = 256
View Source
const DefaultCollapse uint = 4
View Source
const DefaultDivergeLimit float64 = 4.0
View Source
const DefaultHighPrec uint = 500

Default high precision for newly created big floats

View Source
const DefaultImageHeight uint = 600
View Source
const DefaultImageWidth uint = 600
View Source
const DefaultIterations uint8 = 255
View Source
const DefaultPrecision uint = 53

Default precision is for native arithmetic

View Source
const DefaultRegionSamples uint = 12

Default sample size for region glitch-correction

View Source
const DefaultTinyImageArea uint = 40000

What we consider to be a tiny image area, by default

View Source
const MandelbrotMax complex128 = 0.59 + 1.13i

Maximum bounds of Mandelbrot set

View Source
const MandelbrotMin complex128 = -2.01 - 1.11i

Minimum bounds of Mandelbrot set

Variables

This section is empty.

Functions

func DefaultRequest

func DefaultRequest() *config.Request

func ReadInfoStream

func ReadInfoStream(r io.Reader) <-chan InfoPkt

func Recolor

func Recolor(desc *Info, gray image.Image) *image.NRGBA

func Render

func Render(info *Info) (*image.NRGBA, error)

func ToJSON

func ToJSON(desc *Info) ([]byte, error)

func WriteInfo

func WriteInfo(w io.Writer, desc *Info) error

func WriteZoom

func WriteZoom(w io.Writer, z *Zoom) error

Types

type BigInfo

type BigInfo struct {
	RealMin big.Float
	RealMax big.Float
	ImagMin big.Float
	ImagMax big.Float
}

type Info

type Info struct {
	NativeInfo
	BigInfo
}

Info completely describes the render process

func Configure

func Configure(req *config.Request) (*Info, error)

InitializeContext examines the description, chooses a renderer, numerical system and palette.

func FromJSON

func FromJSON(format []byte) (*Info, error)

func ReadInfo

func ReadInfo(r io.Reader) (*Info, error)

func Unfriendly

func Unfriendly(userDesc *UserInfo) (*Info, error)

func (*Info) AddPrec

func (info *Info) AddPrec(delta int)

AddPrec increases the precision of all Infos internal bignums by delta bits.

func (*Info) GenRequest

func (info *Info) GenRequest() config.Request

Generate a user request that corresponts to the info numerics

func (*Info) IsAccurate

func (info *Info) IsAccurate() bool

IsAccurate returns True if the bignums used internally by info are all accurate.

type InfoPkt

type InfoPkt struct {
	Info *Info
	Err  error
}

type NativeInfo

type NativeInfo struct {
	UserRequest config.Request
	// Describe the render strategy in use
	RenderStrategy config.RenderMode
	// Describe the numerics system in use
	NumericsStrategy config.NumericsMode
	PaletteType      PaletteKind
	Precision        uint
}

type PaletteKind

type PaletteKind uint8

type Renderer

type Renderer interface {
	Render() (*image.NRGBA, error)
}

func MakeRenderer

func MakeRenderer(desc *Info) (Renderer, error)

type SerialBigInfo

type SerialBigInfo struct {
	RealMin string
	RealMax string
	ImagMin string
	ImagMax string
}

type UserInfo

type UserInfo struct {
	NativeInfo
	SerialBigInfo
}

UserInfo is a variant of Info that can be easily serialized

func Friendly

func Friendly(desc *Info) *UserInfo

type UserZoom

type UserZoom struct {
	Prev UserInfo
	ZoomTarget
}

type Zoom

type Zoom struct {
	Prev Info
	ZoomTarget
}

Zoom into a portion of the previous image.

func ReadZoom

func ReadZoom(r io.Reader) (*Zoom, error)

func (*Zoom) Magnify

func (z *Zoom) Magnify(degree float64) (*Info, error)

func (*Zoom) Movie

func (z *Zoom) Movie() ([]*Info, error)

Movie is a parametric expansion of frames.

type ZoomTarget

type ZoomTarget struct {
	config.ZoomTarget
}

Jump to

Keyboard shortcuts

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