plyg

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ColLenghtErr = errors.New("Col's need to have length of at least 2")

Functions

func GenerateMultiPolygon

func GenerateMultiPolygon(cols []RingCol) (plys [][][]maths.Pt)

func WriteoutCols

func WriteoutCols(filename string, cols ...RingCol)

Types

type Builder

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

func (*Builder) AddPts

func (b *Builder) AddPts(l maths.Label, pts1, pts2 []maths.Pt) (ring Ring, x1 float64, y1s []YPart, x2 float64, y2s []YPart, new bool)

func (*Builder) CurrentRing

func (b *Builder) CurrentRing() (ring Ring, x1 float64, y1s []YPart, x2 float64, y2s []YPart)

type EdgeByY

type EdgeByY []YEdge

func (EdgeByY) Len

func (s EdgeByY) Len() int

func (EdgeByY) Less

func (s EdgeByY) Less(i, j int) bool

func (EdgeByY) Swap

func (s EdgeByY) Swap(i, j int)

type Ring

type Ring struct {
	Points []maths.Pt
	Label  maths.Label
	// contains filtered or unexported fields
}

func (*Ring) Extent added in v0.7.0

func (r *Ring) Extent() [4]float64

func (*Ring) ExtentArea added in v0.7.0

func (r *Ring) ExtentArea() float64

func (Ring) LineRing

func (r Ring) LineRing() (pts []maths.Pt)

LineRing returns a copy of the points in the correct winding order.

func (*Ring) MaxX added in v0.7.0

func (r *Ring) MaxX() float64

func (*Ring) MaxY added in v0.7.0

func (r *Ring) MaxY() float64

func (*Ring) MinX added in v0.7.0

func (r *Ring) MinX() float64

func (*Ring) MinY added in v0.7.0

func (r *Ring) MinY() float64

type RingCol

type RingCol struct {
	Rings  []Ring
	X1, X2 float64
	Y1s    []YEdge
	Y2s    []YEdge
	// contains filtered or unexported fields
}

func BuildRingCol

func BuildRingCol(ctx context.Context, hm hitmap.Interface, col1, col2 []maths.Pt, pt2my map[maths.Pt]int64) (col RingCol, err error)

TODO: Gdey have this return and error.

func LoadCols

func LoadCols(filename string) (cols []RingCol)

func MergeCols

func MergeCols(cols []RingCol) RingCol

func (*RingCol) MultiPolygon

func (rc *RingCol) MultiPolygon() [][][]maths.Pt

func (*RingCol) String

func (rc *RingCol) String() string

type RingDesc

type RingDesc struct {
	Idx   int
	PtIdx int
	Label maths.Label
}

type YEdge

type YEdge struct {
	// Start y value (lowest value) of the edge.
	Y     float64
	Descs []RingDesc
}

type YPart

type YPart struct {
	Y   float64
	Idx int
}

type YPartByY

type YPartByY []YPart

func (YPartByY) Len

func (ys YPartByY) Len() int

func (YPartByY) Less

func (ys YPartByY) Less(i, j int) bool

func (YPartByY) Swap

func (ys YPartByY) Swap(i, j int)

Jump to

Keyboard shortcuts

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