point

package
v0.0.0-...-5a4f024 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2015 License: MIT Imports: 6 Imported by: 4

Documentation

Overview

package point the smallest unit in this project.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func QuickSort

func QuickSort(data PointList, sortFunc SortFunction)

Quicksort implementation. This one takes a sorting function instead of asuming that the less than is the only posible ordering. It's recursive, so it may fail for very big datasets

func SortCounterRadial

func SortCounterRadial(x, y float32) func(*Point, *Point) bool

func SortDiagonal

func SortDiagonal(p1, p2 *Point) bool

SortDiagonal \

func SortDiagonal2

func SortDiagonal2(p1, p2 *Point) bool

SortDiagonal2 /

func SortRadial

func SortRadial(x, y float32) func(*Point, *Point) bool

SortFromRadial Sorts using a tangential from a center point this sorter is different from the rest in that it returns the actual sort as it needs an origin

func SortXY

func SortXY(p1, p2 *Point) bool

Several similar sort functions. A SortXY will give more importance to X then to Y. If any of those characters is lowercase, it'll mean that the order in that case is reversed.

func SortXy

func SortXy(p1, p2 *Point) bool

func SortYX

func SortYX(p1, p2 *Point) bool

func SortYx

func SortYx(p1, p2 *Point) bool

func SortxY

func SortxY(p1, p2 *Point) bool

func Sortxy

func Sortxy(p1, p2 *Point) bool

func SortyX

func SortyX(p1, p2 *Point) bool

func Sortyx

func Sortyx(p1, p2 *Point) bool

Types

type Point

type Point struct {
	X float32
	Y float32
}

func Random

func Random() Point

Random Get a random point whose coordinates are in the range: [0.0, 1.0) if it's not being called from RandomSlice, remember to call `rand.Seed` previously so you get different results each time.

func RandomSlice

func RandomSlice(length int) []Point

RandomSlice get a length of random points

func (*Point) Draw

func (pt *Point) Draw(canvas *drawing.Canvas)

Draw the point into the canvas

func (*Point) String

func (p *Point) String() string

String marshalls a point into a string for reading

type PointList

type PointList []*Point

func (PointList) Polyline

func (ps PointList) Polyline(sortFunc SortFunction) PointList

Polyline define a polyline by ordering an slice of points

func (*PointList) String

func (pl *PointList) String() string

String generate a string form a list of points mostly for debugging purposes

type SortFunction

type SortFunction func(*Point, *Point) bool

Jump to

Keyboard shortcuts

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