16 releases (2 stable)

Uses old Rust 2015

1.1.0 Aug 16, 2021
1.0.0 Oct 29, 2020
0.3.0 Oct 29, 2020
0.2.0 Jan 30, 2018
0.0.3 Dec 9, 2014

#3 in #coordinate

Download history 30/week @ 2021-08-07 46/week @ 2021-08-14 67/week @ 2021-08-21 37/week @ 2021-08-28 30/week @ 2021-09-04 39/week @ 2021-09-11 21/week @ 2021-09-18 22/week @ 2021-09-25 9/week @ 2021-10-02 37/week @ 2021-10-09 19/week @ 2021-10-16 23/week @ 2021-10-23 21/week @ 2021-10-30 33/week @ 2021-11-06 6/week @ 2021-11-13 18/week @ 2021-11-20

179 downloads per month
Used in hex2d-dpcext

MIT license

51KB
1K SLoC

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

Verification Recommendation

To help with the maintaince, the ownership of this crate is potentially shared between multiple developers. It is recommended to always use cargo-crev to verify the trustworthiness of each of your dependencies, including this one.

Dependencies

~350–630KB
~14K SLoC