Documentation ¶
Index ¶
- Constants
- Variables
- type BlockGrid
- type BlockMap
- type BooleanMatrix
- func (m *BooleanMatrix) BlockPoint(blockX, blockY, blockSize int) (int, int)
- func (m *BooleanMatrix) Get(x, y int) bool
- func (m *BooleanMatrix) GetPoint(at IntPoint) bool
- func (m *BooleanMatrix) GetPointWithFallback(at IntPoint, fallback bool) bool
- func (m *BooleanMatrix) GetWithFallback(x, y int, fallback bool) bool
- func (m *BooleanMatrix) Invert()
- func (m *BooleanMatrix) Merge(other *BooleanMatrix) error
- func (m *BooleanMatrix) Set(x, y int, value bool)
- func (m *BooleanMatrix) SetPoint(at IntPoint, value bool)
- func (m *BooleanMatrix) Size() IntPoint
- type CircularArray
- type CircularList
- type Element
- type FloatAngle
- func (f FloatAngle) Complementary() FloatAngle
- func (f FloatAngle) Difference(second FloatAngle) FloatAngle
- func (f FloatAngle) Distance(second FloatAngle) float64
- func (f FloatAngle) FromOrientation() FloatAngle
- func (f FloatAngle) Opposite() FloatAngle
- func (f FloatAngle) Quantize(resolution int) int
- func (f FloatAngle) ToOrientation() FloatAngle
- func (f FloatAngle) ToVector() FloatPoint
- type FloatPoint
- type FloatPointMatrix
- func (m *FloatPointMatrix) Add(x, y int, px, py float64)
- func (m *FloatPointMatrix) AddFloatPoint(x, y int, point FloatPoint)
- func (m *FloatPointMatrix) AddPoint(at IntPoint, point FloatPoint)
- func (m *FloatPointMatrix) Get(x, y int) FloatPoint
- func (m *FloatPointMatrix) GetPoint(at IntPoint) FloatPoint
- func (m *FloatPointMatrix) Set(x, y int, px, py float64)
- func (m *FloatPointMatrix) SetFloatPoint(x, y int, point FloatPoint)
- func (m *FloatPointMatrix) SetPoint(at IntPoint, point FloatPoint)
- func (m *FloatPointMatrix) Size() IntPoint
- type GenericList
- func (l *GenericList[V]) Back() *Element[V]
- func (l *GenericList[V]) Contains(value interface{}) (bool, *Element[V])
- func (l *GenericList[V]) Front() *Element[V]
- func (l *GenericList[V]) Init() *GenericList[V]
- func (l *GenericList[V]) InsertAfter(v any, mark *Element[V]) *Element[V]
- func (l *GenericList[V]) InsertBefore(v any, mark *Element[V]) *Element[V]
- func (l *GenericList[V]) Len() int
- func (l *GenericList[V]) MoveAfter(e, mark *Element[V])
- func (l *GenericList[V]) MoveBefore(e, mark *Element[V])
- func (l *GenericList[V]) MoveToBack(e *Element[V])
- func (l *GenericList[V]) MoveToFront(e *Element[V])
- func (l *GenericList[V]) PushBack(v any) *Element[V]
- func (l *GenericList[V]) PushBackList(other *GenericList[V])
- func (l *GenericList[V]) PushFront(v any) *Element[V]
- func (l *GenericList[V]) PushFrontList(other *GenericList[V])
- func (l *GenericList[V]) Remove(e *Element[V]) any
- type HistogramCube
- func (h *HistogramCube) Add(x, y, z, value int)
- func (h *HistogramCube) AddPoint(at IntPoint, z, value int)
- func (h *HistogramCube) Constrain(z int) int
- func (h *HistogramCube) Get(x, y, z int) int
- func (h *HistogramCube) GetPoint(at IntPoint, z int) int
- func (h *HistogramCube) Increment(x, y, z int)
- func (h *HistogramCube) IncrementPoint(at IntPoint, z int)
- func (histogram *HistogramCube) Merge(other *HistogramCube)
- func (h *HistogramCube) Set(x, y, z, value int)
- func (h *HistogramCube) SetPoint(at IntPoint, z, value int)
- func (h *HistogramCube) Sum(x, y int) int
- func (h *HistogramCube) SumPoint(at IntPoint) int
- type IntMatrix
- type IntPoint
- func (p IntPoint) Area() int
- func (p IntPoint) CompareTo(other IntPoint) int
- func (p IntPoint) Contains(other IntPoint) bool
- func (p IntPoint) Equals(obj interface{}) bool
- func (p IntPoint) Iterator() IntPointIterator
- func (p IntPoint) LengthSq() int
- func (p IntPoint) LineTo(to IntPoint) []IntPoint
- func (p IntPoint) Minus(other IntPoint) IntPoint
- func (p IntPoint) Negate() IntPoint
- func (p IntPoint) Plus(other IntPoint) IntPoint
- func (p IntPoint) ToFloat() FloatPoint
- type IntPointIterator
- type IntRange
- type IntRect
- func (r IntRect) Area() int
- func (r IntRect) Bottom() int
- func (r IntRect) Center() IntPoint
- func (r IntRect) Intersect(other IntRect) IntRect
- func (p IntRect) Iterator() IntPointIterator
- func (r IntRect) Left() int
- func (r IntRect) Move(delta IntPoint) IntRect
- func (r IntRect) Right() int
- func (r IntRect) Top() int
- type List
- type ListIterator
- type Matrix
- func (m *Matrix) Add(x, y int, value float64)
- func (m *Matrix) AddPoint(at IntPoint, value float64)
- func (m *Matrix) CalculateOverlap(other *Matrix) *IntRect
- func (m *Matrix) Get(x, y int) float64
- func (m *Matrix) GetPoint(at IntPoint) float64
- func (m *Matrix) Multiply(x, y int, value float64)
- func (m *Matrix) MultiplyPoint(at IntPoint, value float64)
- func (m *Matrix) Set(x, y int, value float64)
- func (m *Matrix) SetPoint(at IntPoint, value float64)
- func (m *Matrix) Size() IntPoint
- type ReversedList
Constants ¶
const ( Pi = 3.141592653589793 Pi2 = 2 * Pi HalfPi = 0.5 * Pi InvPi2 = 1.0 / Pi2 )
Variables ¶
var CORNER_NEIGHBORS = []IntPoint{
{-1, -1},
{0, -1},
{1, -1},
{-1, 0},
{1, 0},
{-1, 1},
{0, 1},
{1, 1},
}
var EDGE_NEIGHBORS = []IntPoint{
{0, -1},
{-1, 0},
{1, 0},
{0, 1},
}
Functions ¶
This section is empty.
Types ¶
type BlockMap ¶
func NewBlockMap ¶
type BooleanMatrix ¶
func NewBooleanMatrix ¶
func NewBooleanMatrix(width, height int) *BooleanMatrix
func NewBooleanMatrixFromBooleanMatrix ¶
func NewBooleanMatrixFromBooleanMatrix(other *BooleanMatrix) *BooleanMatrix
func NewBooleanMatrixFromPoint ¶
func NewBooleanMatrixFromPoint(size IntPoint) *BooleanMatrix
func (*BooleanMatrix) BlockPoint ¶
func (m *BooleanMatrix) BlockPoint(blockX, blockY, blockSize int) (int, int)
func (*BooleanMatrix) Get ¶
func (m *BooleanMatrix) Get(x, y int) bool
func (*BooleanMatrix) GetPoint ¶
func (m *BooleanMatrix) GetPoint(at IntPoint) bool
func (*BooleanMatrix) GetPointWithFallback ¶
func (m *BooleanMatrix) GetPointWithFallback(at IntPoint, fallback bool) bool
func (*BooleanMatrix) GetWithFallback ¶
func (m *BooleanMatrix) GetWithFallback(x, y int, fallback bool) bool
func (*BooleanMatrix) Invert ¶
func (m *BooleanMatrix) Invert()
func (*BooleanMatrix) Merge ¶
func (m *BooleanMatrix) Merge(other *BooleanMatrix) error
func (*BooleanMatrix) Set ¶
func (m *BooleanMatrix) Set(x, y int, value bool)
func (*BooleanMatrix) SetPoint ¶
func (m *BooleanMatrix) SetPoint(at IntPoint, value bool)
func (*BooleanMatrix) Size ¶
func (m *BooleanMatrix) Size() IntPoint
type CircularArray ¶
type CircularArray struct {
// contains filtered or unexported fields
}
func NewCircularArray ¶
func NewCircularArray(capacity int) *CircularArray
type CircularList ¶
type CircularList[V any] struct { // contains filtered or unexported fields }
func NewCircularList ¶
func NewCircularList[V any]() *CircularList[V]
func (*CircularList[V]) Add ¶
func (l *CircularList[V]) Add(item V) error
func (*CircularList[V]) AddAt ¶
func (l *CircularList[V]) AddAt(index int, item V) error
func (*CircularList[V]) Get ¶
func (l *CircularList[V]) Get(index int) (V, error)
func (*CircularList[V]) Iterator ¶
func (l *CircularList[V]) Iterator() ListIterator[V]
func (*CircularList[V]) Remove ¶
func (l *CircularList[V]) Remove(index int) error
func (*CircularList[V]) Size ¶
func (l *CircularList[V]) Size() int
type Element ¶
type Element[V any] struct { // The value stored with this element. Value any // contains filtered or unexported fields }
Element is an element of a linked list.
type FloatAngle ¶
type FloatAngle float64
func AngleAdd ¶
func AngleAdd(start, delta float64) FloatAngle
func AtanFromFloatPointVector ¶
func AtanFromFloatPointVector(vector FloatPoint) FloatAngle
func AtanFromIntPointVector ¶
func AtanFromIntPointVector(vector IntPoint) FloatAngle
func AtanFromIntPoints ¶
func AtanFromIntPoints(center, point IntPoint) FloatAngle
func BucketCenter ¶
func BucketCenter(bucket, resolution int) FloatAngle
func (FloatAngle) Complementary ¶
func (f FloatAngle) Complementary() FloatAngle
func (FloatAngle) Difference ¶
func (f FloatAngle) Difference(second FloatAngle) FloatAngle
func (FloatAngle) Distance ¶
func (f FloatAngle) Distance(second FloatAngle) float64
func (FloatAngle) FromOrientation ¶
func (f FloatAngle) FromOrientation() FloatAngle
func (FloatAngle) Opposite ¶
func (f FloatAngle) Opposite() FloatAngle
func (FloatAngle) Quantize ¶
func (f FloatAngle) Quantize(resolution int) int
func (FloatAngle) ToOrientation ¶
func (f FloatAngle) ToOrientation() FloatAngle
func (FloatAngle) ToVector ¶
func (f FloatAngle) ToVector() FloatPoint
type FloatPoint ¶
type FloatPoint struct {
X, Y float64
}
func ZeroFloatPoint ¶
func ZeroFloatPoint() FloatPoint
func (FloatPoint) Multiply ¶
func (f FloatPoint) Multiply(factor float64) FloatPoint
func (FloatPoint) Round ¶
func (f FloatPoint) Round() IntPoint
type FloatPointMatrix ¶
func NewFloatPointMatrix ¶
func NewFloatPointMatrix(width, height int) *FloatPointMatrix
func NewFloatPointMatrixFromPoint ¶
func NewFloatPointMatrixFromPoint(size IntPoint) *FloatPointMatrix
func (*FloatPointMatrix) Add ¶
func (m *FloatPointMatrix) Add(x, y int, px, py float64)
func (*FloatPointMatrix) AddFloatPoint ¶
func (m *FloatPointMatrix) AddFloatPoint(x, y int, point FloatPoint)
func (*FloatPointMatrix) AddPoint ¶
func (m *FloatPointMatrix) AddPoint(at IntPoint, point FloatPoint)
func (*FloatPointMatrix) Get ¶
func (m *FloatPointMatrix) Get(x, y int) FloatPoint
func (*FloatPointMatrix) GetPoint ¶
func (m *FloatPointMatrix) GetPoint(at IntPoint) FloatPoint
func (*FloatPointMatrix) Set ¶
func (m *FloatPointMatrix) Set(x, y int, px, py float64)
func (*FloatPointMatrix) SetFloatPoint ¶
func (m *FloatPointMatrix) SetFloatPoint(x, y int, point FloatPoint)
func (*FloatPointMatrix) SetPoint ¶
func (m *FloatPointMatrix) SetPoint(at IntPoint, point FloatPoint)
func (*FloatPointMatrix) Size ¶
func (m *FloatPointMatrix) Size() IntPoint
type GenericList ¶
type GenericList[V any] struct { // contains filtered or unexported fields }
List represents a doubly linked list. The zero value for List is an empty list ready to use.
func (*GenericList[V]) Back ¶
func (l *GenericList[V]) Back() *Element[V]
Back returns the last element of list l or nil if the list is empty.
func (*GenericList[V]) Contains ¶
func (l *GenericList[V]) Contains(value interface{}) (bool, *Element[V])
func (*GenericList[V]) Front ¶
func (l *GenericList[V]) Front() *Element[V]
Front returns the first element of list l or nil if the list is empty.
func (*GenericList[V]) Init ¶
func (l *GenericList[V]) Init() *GenericList[V]
Init initializes or clears list l.
func (*GenericList[V]) InsertAfter ¶
func (l *GenericList[V]) InsertAfter(v any, mark *Element[V]) *Element[V]
InsertAfter inserts a new element e with value v immediately after mark and returns e. If mark is not an element of l, the list is not modified. The mark must not be nil.
func (*GenericList[V]) InsertBefore ¶
func (l *GenericList[V]) InsertBefore(v any, mark *Element[V]) *Element[V]
InsertBefore inserts a new element e with value v immediately before mark and returns e. If mark is not an element of l, the list is not modified. The mark must not be nil.
func (*GenericList[V]) Len ¶
func (l *GenericList[V]) Len() int
Len returns the number of elements of list l. The complexity is O(1).
func (*GenericList[V]) MoveAfter ¶
func (l *GenericList[V]) MoveAfter(e, mark *Element[V])
MoveAfter moves element e to its new position after mark. If e or mark is not an element of l, or e == mark, the list is not modified. The element and mark must not be nil.
func (*GenericList[V]) MoveBefore ¶
func (l *GenericList[V]) MoveBefore(e, mark *Element[V])
MoveBefore moves element e to its new position before mark. If e or mark is not an element of l, or e == mark, the list is not modified. The element and mark must not be nil.
func (*GenericList[V]) MoveToBack ¶
func (l *GenericList[V]) MoveToBack(e *Element[V])
MoveToBack moves element e to the back of list l. If e is not an element of l, the list is not modified. The element must not be nil.
func (*GenericList[V]) MoveToFront ¶
func (l *GenericList[V]) MoveToFront(e *Element[V])
MoveToFront moves element e to the front of list l. If e is not an element of l, the list is not modified. The element must not be nil.
func (*GenericList[V]) PushBack ¶
func (l *GenericList[V]) PushBack(v any) *Element[V]
PushBack inserts a new element e with value v at the back of list l and returns e.
func (*GenericList[V]) PushBackList ¶
func (l *GenericList[V]) PushBackList(other *GenericList[V])
PushBackList inserts a copy of another list at the back of list l. The lists l and other may be the same. They must not be nil.
func (*GenericList[V]) PushFront ¶
func (l *GenericList[V]) PushFront(v any) *Element[V]
PushFront inserts a new element e with value v at the front of list l and returns e.
func (*GenericList[V]) PushFrontList ¶
func (l *GenericList[V]) PushFrontList(other *GenericList[V])
PushFrontList inserts a copy of another list at the front of list l. The lists l and other may be the same. They must not be nil.
func (*GenericList[V]) Remove ¶
func (l *GenericList[V]) Remove(e *Element[V]) any
Remove removes e from l if e is an element of list l. It returns the element value e.Value. The element must not be nil.
type HistogramCube ¶
func NewHistogramCube ¶
func NewHistogramCube(width, height, bins int) *HistogramCube
func NewHistogramCubeFromPoint ¶
func NewHistogramCubeFromPoint(size IntPoint, bins int) *HistogramCube
func (*HistogramCube) Add ¶
func (h *HistogramCube) Add(x, y, z, value int)
func (*HistogramCube) AddPoint ¶
func (h *HistogramCube) AddPoint(at IntPoint, z, value int)
func (*HistogramCube) Constrain ¶
func (h *HistogramCube) Constrain(z int) int
func (*HistogramCube) Get ¶
func (h *HistogramCube) Get(x, y, z int) int
func (*HistogramCube) Increment ¶
func (h *HistogramCube) Increment(x, y, z int)
func (*HistogramCube) IncrementPoint ¶
func (h *HistogramCube) IncrementPoint(at IntPoint, z int)
func (*HistogramCube) Merge ¶
func (histogram *HistogramCube) Merge(other *HistogramCube)
func (*HistogramCube) Set ¶
func (h *HistogramCube) Set(x, y, z, value int)
func (*HistogramCube) SetPoint ¶
func (h *HistogramCube) SetPoint(at IntPoint, z, value int)
func (*HistogramCube) Sum ¶
func (h *HistogramCube) Sum(x, y int) int
func (*HistogramCube) SumPoint ¶
func (h *HistogramCube) SumPoint(at IntPoint) int
type IntPoint ¶
type IntPoint struct {
X, Y int
}
func ZeroIntPoint ¶
func ZeroIntPoint() IntPoint
func (IntPoint) Iterator ¶
func (p IntPoint) Iterator() IntPointIterator
func (IntPoint) ToFloat ¶
func (p IntPoint) ToFloat() FloatPoint
type IntPointIterator ¶
type IntRange ¶
type IntRange struct {
Start, End int
}
func ZeroIntRange ¶
func ZeroIntRange() IntRange
type IntRect ¶
type IntRect struct {
X, Y, Width, Height int
}
func IntRectAround ¶
func IntRectAroundIntPoint ¶
func IntRectBetween ¶
func IntRectBetweenIntPoint ¶
func IntRectFromPoint ¶
func (IntRect) Iterator ¶
func (p IntRect) Iterator() IntPointIterator
type ListIterator ¶
type Matrix ¶
func NewMatrixFromPoint ¶
func (*Matrix) CalculateOverlap ¶
CalculateOverlap calculates the overlapping area between two matrices and returns the overlapping area as a Rectangle.
func (*Matrix) MultiplyPoint ¶
type ReversedList ¶
type ReversedList[V any] struct { // contains filtered or unexported fields }
func NewReversedList ¶
func NewReversedList[V any](items List[V]) *ReversedList[V]
func (*ReversedList[V]) Add ¶
func (l *ReversedList[V]) Add(item V) error
func (*ReversedList[V]) AddAt ¶
func (l *ReversedList[V]) AddAt(index int, item V) error
func (*ReversedList[V]) Get ¶
func (l *ReversedList[V]) Get(index int) (V, error)
func (*ReversedList[V]) Iterator ¶
func (l *ReversedList[V]) Iterator() ListIterator[V]
func (*ReversedList[V]) Remove ¶
func (l *ReversedList[V]) Remove(index int) error
func (*ReversedList[V]) Size ¶
func (l *ReversedList[V]) Size() int