region

package
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: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UniformPath = RegionType(iota)
	CollapsePath
	SubdividePath
)

Variables

This section is empty.

Functions

func Collapse

func Collapse(reg RegionNumerics, sizelim int) bool

Collapse returns true if the region is below the necessary size for subdivision

func DrawUniform

func DrawUniform(context paint.DrawingContext, region RegionNumerics)

DrawUniform draws a rectangle of uniform colour on to the image.

func RenderSequenceRegion

func RenderSequenceRegion(reg RegionNumerics, ctx draw.DrawingContext)

RenderSequentialRegion takes a RegionNumerics but renders the region in a sequential (column-wise) manner

func SequenceCollapse

func SequenceCollapse(num RegionNumerics) []base.PixelMember

SequenceCollapse is analogous to RenderSequentialRegion, but it returns the Mandelbrot render results rather than drawing them to the image.

func Subdivide

func Subdivide(reg RegionNumerics) bool

Subdivide takes a RegionNumerics and tries to split the region into subregions. It returns true if the subdivision occurred. The subdivision won't occur if the region is Uniform or in an area where glitches are likely.

func Uniform

func Uniform(reg RegionNumerics) bool

Uniform returns true if the region has the same Mandelbrot escape value across its bounds.

Types

type MockFactory

type MockFactory struct {
	TBuild   bool
	Numerics *MockNumerics
}

func (*MockFactory) Build

func (mock *MockFactory) Build() RegionNumerics

type MockNumerics

type MockNumerics struct {
	TExtrinsically    bool
	TClaimExtrinsics  bool
	TRect             bool
	TSplit            bool
	TMandelbrotPoints bool
	TRegionMember     bool
	TSubdivide        bool
	TChildren         bool
	TSampleDivs       bool
	TRegionSequence   bool

	Path RegionType

	MockChildren []*MockNumerics
	MockSequence *MockProxySequence

	AppCollapseSize int
}

func (*MockNumerics) Children

func (mock *MockNumerics) Children() []RegionNumerics

func (*MockNumerics) ClaimExtrinsics

func (mock *MockNumerics) ClaimExtrinsics()

func (*MockNumerics) Extrinsically

func (mock *MockNumerics) Extrinsically(f func())

func (*MockNumerics) MandelbrotPoints

func (mock *MockNumerics) MandelbrotPoints() []base.EscapeValue

func (*MockNumerics) Rect

func (mock *MockNumerics) Rect() image.Rectangle

func (*MockNumerics) RegionMember

func (mock *MockNumerics) RegionMember() base.EscapeValue

func (*MockNumerics) RegionSequence

func (mock *MockNumerics) RegionSequence() ProxySequence

func (*MockNumerics) SampleDivs

func (mock *MockNumerics) SampleDivs() (<-chan uint8, chan<- bool)

func (*MockNumerics) Split

func (mock *MockNumerics) Split()

func (*MockNumerics) Subdivide

func (mock *MockNumerics) Subdivide() bool

type MockProxySequence

type MockProxySequence struct {
	sequence.MockNumerics

	TClaimExtrinsics bool
	TExtrinsically   bool
}

func (*MockProxySequence) ClaimExtrinsics

func (mock *MockProxySequence) ClaimExtrinsics()

func (*MockProxySequence) Extrinsically

func (mock *MockProxySequence) Extrinsically(f func())

type MockRegionProvider

type MockRegionProvider struct {
	TRegionConfig          bool
	TRegionNumericsFactory bool

	RegConfig     RegionConfig
	RegionFactory RegionNumericsFactory
}

func (*MockRegionProvider) RegionConfig

func (mock *MockRegionProvider) RegionConfig() RegionConfig

func (*MockRegionProvider) RegionNumericsFactory

func (mock *MockRegionProvider) RegionNumericsFactory() RegionNumericsFactory

type ProxySequence

type ProxySequence interface {
	base.OpaqueProxyFlyweight
	sequence.SequenceNumerics
}

type Region

type Region struct {
	Xmin int
	Xmax int
	Ymin int
	Ymax int
}

func InitRegion

func InitRegion(bn *base.BaseNumerics) Region

func (Region) Split

func (r Region) Split() []Region

type RegionConfig

type RegionConfig struct {
	Samples      uint
	CollapseSize uint
}

type RegionNumerics

type RegionNumerics interface {
	base.OpaqueProxyFlyweight
	Subdivider
	Children() []RegionNumerics // Bad to include method in extended interface, but how else?
}

RegionNumerics provides rendering calculations for the "region" render strategy.

type RegionNumericsFactory

type RegionNumericsFactory interface {
	Build() RegionNumerics
}

type RegionProvider

type RegionProvider interface {
	// Configuration for particular render strategies
	RegionConfig() RegionConfig
	RegionNumericsFactory() RegionNumericsFactory
}

type RegionRenderStrategy

type RegionRenderStrategy struct {
	// contains filtered or unexported fields
}

func (RegionRenderStrategy) Render

func (renderer RegionRenderStrategy) Render() (*image.NRGBA, error)

The RegionRenderStrategy implements RenderNumerics with this method that draws the Mandelbrot set uses a "similar rectangles" optimization

func (RegionRenderStrategy) SubdivideRegions

func (renderer RegionRenderStrategy) SubdivideRegions(whole RegionNumerics) ([]RegionNumerics, []RegionNumerics)

type RegionType

type RegionType uint

type RenderApplication

type RenderApplication interface {
	base.RenderApplication
	draw.ContextProvider
	RegionProvider
}

type Subdivider

type Subdivider interface {
	Rect() image.Rectangle
	Split()
	MandelbrotPoints() []base.EscapeValue
	SampleDivs() (<-chan uint8, chan<- bool)
	RegionMember() base.EscapeValue
	RegionSequence() ProxySequence
}

Jump to

Keyboard shortcuts

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