Minimalist library to convert world coordinates to hex lattice coordinates.
Switch branches/tags
Nothing to show
Clone or download
Latest commit 0bd1c25 Dec 25, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
media Initial commit Apr 4, 2017
project Updated version Dec 25, 2017
src Added return type to public functions and updated sbt dep version Dec 24, 2017
.gitignore Updated Layout constructor signature to accept origX/Y as the first a… Apr 5, 2017
LICENSE Initial commit Apr 4, 2017
README.md Updated version Dec 25, 2017
build.sbt Updated version Dec 25, 2017

README.md

Grid Hex

Minimalist Scala library to convert world coordinates to hex lattice coordinates based on http://www.redblobgames.com/grids/hexagons excellent reference implementation.

This library implements the following functions:

  • Convert XY world coordinates into Hex RowCol.
  • Convert Hex center into XY world coordinates.
  • Get a sequence of the Hex corners in world coordinates.
  • Get a sequence of Hexes that are within a user defined range from a given Hex.

Building the Project

The build process is based on sbt.

sbt clean cleanFiles transitiveUpdate +publishM2 +publishLocal

Hex Viewer

HexApp is a simple CLI application to view the above functions in action.

View the app usage using:

sbt "run -help"

The following is a sample execution:

sbt "run -w 400 -h 400 -x 253 -y 177 -r 3 -o /tmp/test.png" && open /tmp/test.png