poly

package
v0.0.0-...-9029c63 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadImage

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

func PrintDefaultsWithError

func PrintDefaultsWithError(errorMessage string)

func ReadGob

func ReadGob(filePath string, object interface{}) error

func SaveFile

func SaveFile(path, contents string) error

Types

type Color

type Color struct {
	R, G, B, A uint8
}

func NewRandomColor

func NewRandomColor() Color

type Model

type Model struct {
	Width, Height           int
	TargetImage             *image.RGBA
	NumPolygons             int
	Polygons                Polygons
	Scale                   float64
	Score                   float64
	Iteration               int
	BackgroundColor         Color
	MutateVertexProbability float64
}

func NewModel

func NewModel(input image.Image, numPolygons int, seed int64, bgColor Color) *Model

func (*Model) GOB

func (m *Model) GOB(filePath string) error

func (*Model) Optimize

func (m *Model) Optimize(iterations, concurrency, logFrequency int) float64

func (*Model) PNG

func (m *Model) PNG(fname string) error

func (*Model) SVG

func (m *Model) SVG() string

type Point

type Point struct {
	X, Y int
}

type Polygon

type Polygon struct {
	Color Color
	// Vertices represents the list of coordinates for the vertices of the polygon
	Vertices  []Point
	Points    []Point
	HasPoints bool
}

type Polygons

type Polygons []Polygon

Jump to

Keyboard shortcuts

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