Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/etaque/elm-hexagons
Hexagonal computing for Elm
https://github.com/etaque/elm-hexagons
Last synced: 5 days ago
JSON representation
Hexagonal computing for Elm
- Host: GitHub
- URL: https://github.com/etaque/elm-hexagons
- Owner: etaque
- Created: 2015-12-13T22:06:00.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-11-16T21:42:25.000Z (almost 8 years ago)
- Last Synced: 2024-08-01T12:21:55.985Z (3 months ago)
- Language: Elm
- Size: 5.86 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-starred - etaque/elm-hexagons - Hexagonal computing for Elm (others)
README
# Elm Hexagons
An Elm library for hexagonal grids handling, based on the awesome
[Hexagonal Grids Reference](http://www.redblobgames.com/grids/hexagons) from Red Blob Games
and extracted from [Tacks](https://github.com/etaque/tacks/) source code.For now this lib is focused on axial coordinates for horizontal (pointy-topped) hexagons.
## What's available
Coordinates handling (`Hexagons` module):
* Find pixel center of an hexagon: `axialToPoint`
* Find hexagon containing a pixel point: `pointToAxial`
* Compute "hexagonal distance" between two hexagons: `axialDistance`
* Compute line between to hexagons: `axialLine`
* Compute all hexagons within distance from an hexagon (area): `axialRange`Naive grid storage (`Hexagons.Grid` module):
* A grid is a `Dict Int (Dict Int a)`
* Get, set and remove data on grid: `getTile`, `createTile`, `deleteTile`
* List all tiles in grid: `getTilesList`## What's next
* Deal with vertical (flat-topped) hexagons
* Expose cubic functions (split `Hexagons` main module into coordinates systems' specific modules?)
* Tests, tests, test!