hexagone

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2025 License: GPL-3.0 Imports: 2 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 {
	Col, Row int
}

Axial axial coordinates

func NewAxial

func NewAxial(col, row int) Axial

NewAxial return new axial

func (Axial) Distance

func (a Axial) Distance(axial Axial) int

Distance return distance between axials

func (Axial) ToCube

func (a Axial) ToCube() Cube

ToCube convert axial to cube

func (Axial) ToPosition

func (a Axial) ToPosition() shapes.Point

ToPosition return position

type Cube

type Cube struct {
	X, Y, Z int
}

Cube for hexagon map

func NewCube

func NewCube(x, y, z int) Cube

NewCube return new cube

func (Cube) Distance

func (c Cube) Distance(cube Cube) int

Distance distance between cubes

func (Cube) ToAxis

func (c Cube) ToAxis() Axial

ToAxis convert cube to axis

Jump to

Keyboard shortcuts

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