https://github.com/erinpentecost/hex
Hexagonal grid math library.
https://github.com/erinpentecost/hex
grid hex hexagonal
Last synced: 2 months ago
JSON representation
Hexagonal grid math library.
- Host: GitHub
- URL: https://github.com/erinpentecost/hex
- Owner: erinpentecost
- License: bsd-3-clause
- Created: 2018-09-02T22:57:33.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-03-06T23:32:03.000Z (about 3 years ago)
- Last Synced: 2024-06-22T16:45:51.959Z (almost 2 years ago)
- Topics: grid, hex, hexagonal
- Language: Go
- Size: 620 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

[](https://goreportcard.com/report/github.com/erinpentecost/hexcoord)
[](https://travis-ci.org/erinpentecost/hexcoord.svg?branch=master)
[](https://godoc.org/github.com/erinpentecost/hexcoord)
hex is a Go implementation of hexagonal grid math based on amitp's *Hexagonal Grids* articles. This package focuses on hexagonal grid math, including:
* Generating sets of hexes programmatically in common patterns.
* Compositing sets of hexes with unions, intersections, and subtractions (constructive solid geometry).
* Multithreaded A* pathing in a hex grid.
* Fast intersection testing.
* Super naive [drawing package](examples/drawhx)! This isn't performant; it's to help you visualize what's going on.
```go
import (
// Base library
"github.com/erinpentecost/hex"
// For pathfinding
"github.com/erinpentecost/hex/path"
// For constructive solid geometry
"github.com/erinpentecost/hex/area"
)
```

## References
* [Hexagonal Grids](https://www.redblobgames.com/grids/hexagons)
* [Implementation of Hex Grids](https://www.redblobgames.com/grids/hexagons/implementation.html)
* [Priority Queue](https://golang.org/pkg/container/heap/#example__priorityQueue)
* [Constructive solid geometry (CSG)](https://en.wikipedia.org/wiki/Constructive_solid_geometry)
* [GLTF](https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes)
* [More GLTF](https://github.com/KhronosGroup/glTF-Tutorials/blob/master/gltfTutorial/gltfTutorial_005_BuffersBufferViewsAccessors.md)