tile

package
v0.0.0-...-e6da677 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2013 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package tile provides utility functions for hexagon tile maps.

Index

Constants

This section is empty.

Variables

View Source
var HexDirs = []image.Point{{-1, -1}, {0, -1}, {1, 0}, {1, 1}, {0, 1}, {-1, 0}}

Functions

func HexCirclePoint

func HexCirclePoint(radius int, windingIndex int) image.Point

HexCirclePoint returns a point along the edge of a radius sized hexagon tile "circle" specified by windingIndex. The HexCircumference(radius) consecutive clockwise points on the circle are denoted by consecutive windingIndex values.

func HexCircumference

func HexCircumference(radius int) int

HexCircumference returns the number of distinct hexagons at exactly radius distance from origin.

func HexDist

func HexDist(p1, p2 image.Point) int

HexDist returns the hexagonal distance between two points.

func HexLength

func HexLength(vec image.Point) int

HexLength returns the length in hexes of a vector on a hex map.

func HexVecToDir

func HexVecToDir(vec image.Point) image.Point

HexVecToDir returns the unit length hex direction that matches the given hex coordinate vector best.

func HexWallType

func HexWallType(edgeMask int) int

HexWallType returns the wall tile offset base on the binary mask built from its six neighboring walls. The mask starts at the neighbor at (-1, -1) at bit 0, and proceeds to the rest of the neighbors clockwise from there.

A bit 1 indicates a wall-type tile at that neighbor position. The result value is between 0 and 3:

0: Pillar (o)
1: x-axis wall (\)
2: y-axis wall (/)
3: xy-diagonal wall (|)

func IsoWallType

func IsoWallType(edgeMask int) int

Types

This section is empty.

Jump to

Keyboard shortcuts

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