Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FlatCoord ¶
type FlatCoord struct {
// contains filtered or unexported fields
}
FlatCoord is a sort.Interface implementation that will result in sorting the wrapped coords based on the the comparator function
Note: this data struct cannot be used with its 0 values. it must be constructed using NewFlatCoordSorting
func NewFlatCoordSorting ¶
NewFlatCoordSorting creates a sort.Interface implementation based on the Comparator function
Example ¶
coords := []float64{1, 0, 0, 1, 2, 2, -1, 0} isLess := func(c1, c2 []float64) bool { return c1[0] < c2[0] } sort.Sort(sorting.NewFlatCoordSorting(geom.XY, coords, isLess)) fmt.Println(coords)
Output: [-1 0 0 1 1 0 2 2]
func NewFlatCoordSorting2D ¶
NewFlatCoordSorting2D creates a Compare2D based sort.Interface implementation
Example ¶
// Some description coords := []float64{1, 0, 0, 1, 2, 2, 2, -2, -1, 0} sort.Sort(sorting.NewFlatCoordSorting2D(geom.XY, coords)) fmt.Println(coords)
Output: [-1 0 0 1 1 0 2 -2 2 2]
Click to show internal directories.
Click to hide internal directories.