#game #map #hex #coordinate #hexagonal

hex2d

Helper library for working with 2d hex-grid maps

13 releases

0.2.0 Jan 30, 2018
0.1.0 Jan 20, 2016
0.0.14 Jun 21, 2015
0.0.11 Apr 17, 2015
0.0.3 Dec 9, 2014

#4 in #coordinate

Download history 182/week @ 2019-06-26 143/week @ 2019-07-03 64/week @ 2019-07-10 76/week @ 2019-07-17 51/week @ 2019-07-24 64/week @ 2019-07-31 67/week @ 2019-08-07 51/week @ 2019-08-14 153/week @ 2019-08-21 77/week @ 2019-08-28 93/week @ 2019-09-04 71/week @ 2019-09-11 135/week @ 2019-09-18 90/week @ 2019-09-25 64/week @ 2019-10-02

290 downloads per month
Used in 1 crate

MIT license

44KB
934 lines

hex2d

Build Status crates.io Gitter Chat
Documentation

Introduction

Library for working with 2d hex map systems.

A lot of ideas taken from redbloggames hexagon page

Read Documentation for details.

See issues for TODO and BUGs.

You might be interested in additional functionality provided by hex2d-dpcext-rs library.

Coordinate system

Pointy-topped:

          /\
        /    \
       |      |
       |      |
        \    /
          \/

          -z
+y     YZ  |  XZ     +x
 ---       |       ---
    ---    |    ---
       --- | ---
  YX      -x-    XY
       --- | ---
    ---    |    ---
 ---   ZX  |  ZY   ---
-x         |          -y
          +z

Flat-topped:

         ____
        /    \
       /      \
       \      /
        \____/

     +y       -z
      \       /
       \ YZ  /
    YX  \   /  XZ
         \ /
-x--------x--------+x
         / \
    ZX  /   \ XY
       /  ZY \
      /       \
     +z       -y

Building

cargo build

Dependencies

~760KB
~13K SLoC