util

package
v0.0.0-...-997a9c1 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Sqrt3 = 1.732050807568877293527446341505872366942805253810380628055806
)

Variables

This section is empty.

Functions

func AsRGBA

func AsRGBA(img image.Image) *image.RGBA

func MakeMatrixBool

func MakeMatrixBool(size int) [][]bool

func MakeMatrixUint8

func MakeMatrixUint8(size int) [][]uint8

func MakeRandMatrixBool

func MakeRandMatrixBool(size, threshold int) [][]bool

Types

type HexPlane

type HexPlane struct {
	Values []HexPoint
	Origin HexPoint
	Size   int
}

func NewHexBoard

func NewHexBoard(qnt int) *HexPlane

type HexPoint

type HexPoint [3]float64 // Q R S

func Cube_round

func Cube_round(hex HexPoint) HexPoint

func Pixel_to_flat_hex

func Pixel_to_flat_hex(p Point2D, size float64) HexPoint

func Pixel_to_pointy_hex

func Pixel_to_pointy_hex(p Point2D, size float64) HexPoint

func (*HexPoint) Add

func (h *HexPoint) Add(p HexPoint) HexPoint

func (HexPoint) Q

func (h HexPoint) Q() float64

func (HexPoint) R

func (h HexPoint) R() float64

func (HexPoint) S

func (h HexPoint) S() float64

func (*HexPoint) Sub

func (h *HexPoint) Sub(p HexPoint) HexPoint

type Point2D

type Point2D [2]float64 // X Y

func Flat_hex_corner

func Flat_hex_corner(p Point2D, size float64, i int) Point2D

func Flat_hex_to_pixel

func Flat_hex_to_pixel(hex HexPoint, size float64) Point2D

func Pointy_hex_corner

func Pointy_hex_corner(p Point2D, size float64, i int) Point2D

func Pointy_hex_to_pixel

func Pointy_hex_to_pixel(hex HexPoint, size float64) Point2D

func (Point2D) X

func (p Point2D) X() float64

func (Point2D) Y

func (p Point2D) Y() float64

type TileMap

type TileMap struct {
	// contains filtered or unexported fields
}

func NewTileMap

func NewTileMap(src image.Image, tXCount, tYCount uint) *TileMap

func (*TileMap) GetTile

func (tm *TileMap) GetTile(index uint) image.Image

func (*TileMap) TXSize

func (tm *TileMap) TXSize() uint

func (*TileMap) TYSize

func (tm *TileMap) TYSize() uint

Jump to

Keyboard shortcuts

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