pixsort

package
v0.0.0-...-29754db Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFrame

func CreateFrame(m, w, h int, points []Point) *image.Paletted

func LoadPNG

func LoadPNG(path string) (image.Image, error)

func PreAnneal

func PreAnneal(state Annealable, iterations int) float64

func Run

func Run(path string, quality int)

func SaveGIF

func SaveGIF(path string, m, w, h int, points []Point) error

Types

type Annealable

type Annealable interface {
	Energy() float64
	DoMove() interface{}
	UndoMove(interface{})
	Copy() Annealable
}

func Anneal

func Anneal(state Annealable, maxTemp, minTemp float64, steps int) Annealable

type Model

type Model struct {
	Points []Point
	Score  int
}

func NewModel

func NewModel(points []Point) *Model

func (*Model) Closest

func (m *Model) Closest(i, j int) int

func (*Model) Copy

func (m *Model) Copy() Annealable

func (*Model) DoMove

func (m *Model) DoMove() interface{}

func (*Model) Energy

func (m *Model) Energy() float64

func (*Model) Move

func (m *Model) Move(i, j int)

func (*Model) UndoMove

func (m *Model) UndoMove(undo interface{})

func (*Model) Update

func (m *Model) Update(i, j, sign int)

type Point

type Point struct {
	X, Y int
}

func GetPoints

func GetPoints(im image.Image) (int, int, []Point)

func (Point) DistanceTo

func (a Point) DistanceTo(b Point) int

type Undo

type Undo struct {
	I, J, Score int
}

Jump to

Keyboard shortcuts

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