coordinate

package
Version: v0.0.0-...-5e01725 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2018 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Axial

type Axial struct {
	Q int
	R int
}

Axial coordinate with implied z, under x+y+z=0

func NewAxial

func NewAxial(q, r int) Axial

NewAxial creates a new Axial

func (Axial) Distance

func (a Axial) Distance(c Interface) int

Distance finds the cube distance between two coordinates

func (Axial) GetNeighbors

func (a Axial) GetNeighbors() []Interface

GetNeighbors returns the six neigboring coordinates

func (Axial) LinearInterpolation

func (a Axial) LinearInterpolation(c Interface) []Interface

LinearInterpolation returns the hexagons (inclusive) between two hexagons

type Cube

type Cube struct {
	X int
	Y int
	Z int
}

Cube coordinate with constraint x+y+z = 0

func NewCube

func NewCube(x, y, z int) Cube

NewCube creates a new Cube coordinate

func (Cube) Distance

func (a Cube) Distance(c Interface) int

Distance finds the distance between two cube coordinates

func (Cube) GetNeighbors

func (a Cube) GetNeighbors() []Interface

GetNeighbors returns the six neighboring cube coordinates

func (Cube) LinearInterpolation

func (a Cube) LinearInterpolation(c Interface) []Interface

LinearInterpolation returns the hexatons (inclusive) between two hexagons

type Interface

type Interface interface {
	Distance(Interface) int
	GetNeighbors() []Interface
	LinearInterpolation(Interface) []Interface
}

Interface defines common methods for coordinates

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL