Skip to content

mraad/grid-hex

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Grid Hex

Minimalist Scala and Python 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

mvn clean install

Install python modules:

python setup install

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

About

Minimalist library to convert world coordinates to hex lattice coordinates.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published