Documentation ¶
Index ¶
- Variables
- type Coordinate
- func (c Coordinate) Add(co Coordinate) Coordinate
- func (c Coordinate) Adjacent() []Coordinate
- func (c Coordinate) Down() Coordinate
- func (c Coordinate) IsZero() bool
- func (c Coordinate) Left() Coordinate
- func (c Coordinate) ManhattanDistance(co Coordinate) int
- func (c Coordinate) Right() Coordinate
- func (c Coordinate) String() string
- func (c Coordinate) Surrounding() []Coordinate
- func (c Coordinate) Up() Coordinate
- type Coordinate3D
- func (c Coordinate3D) Add(to Coordinate3D) Coordinate3D
- func (c Coordinate3D) Adjacent() []Coordinate3D
- func (c Coordinate3D) ApplyRotation(x, y, z int) Coordinate3D
- func (c Coordinate3D) Diff(to Coordinate3D) Coordinate3D
- func (c Coordinate3D) ManhattanDistance(to Coordinate3D) int
- func (c Coordinate3D) String() string
- func (c Coordinate3D) Sub(to Coordinate3D) Coordinate3D
- type CoordinateArray
- type Cuboid
- func (c Cuboid) Contains(co Cuboid) bool
- func (c Cuboid) Coordinates() []Coordinate3D
- func (c Cuboid) IsOverlapping(co Cuboid) bool
- func (c Cuboid) Overlapping(co Cuboid) *Cuboid
- func (c Cuboid) Size() int
- func (c Cuboid) String() string
- func (c Cuboid) Subdivide(co Cuboid) ([]Cuboid, *Cuboid, []Cuboid)
- type Direction
- type Item
- type Map
- func (m Map[T]) Adjacent(c Coordinate) []Coordinate
- func (m Map[T]) ArrPos(c Coordinate) int
- func (m Map[T]) ArraySize() int
- func (m Map[T]) At(c Coordinate) T
- func (m Map[T]) Coordinates() []Coordinate
- func (m Map[T]) CopyWith(fn func(val T) T) Map[T]
- func (m Map[T]) Exists(c Coordinate) bool
- func (m Map[T]) Length() int
- func (m *Map[T]) Set(c Coordinate, val T)
- func (m Map[T]) String() string
- func (m Map[T]) Stringf(sprintf func(c Coordinate, val T) string) string
- func (m Map[T]) Surrounding(c Coordinate) []Coordinate
- func (m Map[T]) WithPadding(n, e, s, w int) Map[T]
- type PriorityQueue
- type Rotation3D
- type RotationDirection
- type RotationFacing
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Up = Direction{Y: -1} Right = Direction{X: 1} Down = Direction{Y: 1} Left = Direction{X: -1} North = Up East = Right South = Down West = Left NorthEast = Direction{Y: -1, X: 1} NorthWest = Direction{Y: -1, X: -1} SouthEast = Direction{Y: 1, X: 1} SouthWest = Direction{Y: 1, X: -1} )
Functions ¶
This section is empty.
Types ¶
type Coordinate ¶
func CoordinateFromString ¶
func CoordinateFromString(s string) Coordinate
func (Coordinate) Add ¶
func (c Coordinate) Add(co Coordinate) Coordinate
func (Coordinate) Adjacent ¶
func (c Coordinate) Adjacent() []Coordinate
func (Coordinate) Down ¶
func (c Coordinate) Down() Coordinate
func (Coordinate) IsZero ¶
func (c Coordinate) IsZero() bool
func (Coordinate) Left ¶
func (c Coordinate) Left() Coordinate
func (Coordinate) ManhattanDistance ¶
func (c Coordinate) ManhattanDistance(co Coordinate) int
func (Coordinate) Right ¶
func (c Coordinate) Right() Coordinate
func (Coordinate) String ¶
func (c Coordinate) String() string
func (Coordinate) Surrounding ¶
func (c Coordinate) Surrounding() []Coordinate
func (Coordinate) Up ¶
func (c Coordinate) Up() Coordinate
type Coordinate3D ¶
func NewCoordinate3D ¶
func NewCoordinate3D(s string) Coordinate3D
func (Coordinate3D) Add ¶
func (c Coordinate3D) Add(to Coordinate3D) Coordinate3D
func (Coordinate3D) Adjacent ¶
func (c Coordinate3D) Adjacent() []Coordinate3D
func (Coordinate3D) ApplyRotation ¶
func (c Coordinate3D) ApplyRotation(x, y, z int) Coordinate3D
func (Coordinate3D) Diff ¶
func (c Coordinate3D) Diff(to Coordinate3D) Coordinate3D
func (Coordinate3D) ManhattanDistance ¶
func (c Coordinate3D) ManhattanDistance(to Coordinate3D) int
func (Coordinate3D) String ¶
func (c Coordinate3D) String() string
func (Coordinate3D) Sub ¶
func (c Coordinate3D) Sub(to Coordinate3D) Coordinate3D
type CoordinateArray ¶
type CoordinateArray struct { Coordinates []Coordinate Y int X int }
func NewCoordinateArray ¶
func NewCoordinateArray(coords []Coordinate) CoordinateArray
func (CoordinateArray) Coordinate ¶
func (arr CoordinateArray) Coordinate(i int) Coordinate
func (CoordinateArray) Index ¶
func (arr CoordinateArray) Index(c Coordinate) int
func (CoordinateArray) Size ¶
func (arr CoordinateArray) Size() int
type Cuboid ¶
type Cuboid struct { From Coordinate3D To Coordinate3D }
func (Cuboid) Coordinates ¶
func (c Cuboid) Coordinates() []Coordinate3D
func (Cuboid) IsOverlapping ¶
func (Cuboid) Overlapping ¶
type Direction ¶
type Direction struct{ X, Y int }
func (Direction) Apply ¶
func (d Direction) Apply(c Coordinate) Coordinate
type Map ¶
func MapFromCoordinates ¶
func MapFromCoordinates[T any](coordinates map[Coordinate]T) Map[T]
func (Map[T]) Adjacent ¶
func (m Map[T]) Adjacent(c Coordinate) []Coordinate
func (Map[T]) ArrPos ¶
func (m Map[T]) ArrPos(c Coordinate) int
func (Map[T]) At ¶
func (m Map[T]) At(c Coordinate) T
func (Map[T]) Coordinates ¶
func (m Map[T]) Coordinates() []Coordinate
func (Map[T]) Exists ¶
func (m Map[T]) Exists(c Coordinate) bool
func (*Map[T]) Set ¶
func (m *Map[T]) Set(c Coordinate, val T)
func (Map[T]) Surrounding ¶
func (m Map[T]) Surrounding(c Coordinate) []Coordinate
func (Map[T]) WithPadding ¶
type PriorityQueue ¶
func (PriorityQueue[T]) Len ¶
func (pq PriorityQueue[T]) Len() int
func (PriorityQueue[T]) Less ¶
func (pq PriorityQueue[T]) Less(i, j int) bool
func (*PriorityQueue[T]) Pop ¶
func (pq *PriorityQueue[T]) Pop() interface{}
func (*PriorityQueue[T]) Push ¶
func (pq *PriorityQueue[T]) Push(x interface{})
func (PriorityQueue[T]) Swap ¶
func (pq PriorityQueue[T]) Swap(i, j int)
func (*PriorityQueue[T]) Update ¶
func (pq *PriorityQueue[T]) Update(item *Item[T], value T, priority int)
type Rotation3D ¶
type Rotation3D interface {
Apply(c Coordinate3D) Coordinate3D
}
type RotationDirection ¶
func (RotationDirection) Apply ¶
func (r RotationDirection) Apply(c Coordinate3D) Coordinate3D
type RotationFacing ¶
type RotationFacing struct { X string Y string Z string Direction RotationDirection }
func (RotationFacing) Apply ¶
func (r RotationFacing) Apply(c Coordinate3D) Coordinate3D
Click to show internal directories.
Click to hide internal directories.