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

#440 in Algorithms

Download history 26/week @ 2024-10-21 46/week @ 2024-10-28 36/week @ 2024-11-04 8/week @ 2024-11-11 28/week @ 2024-11-18 38/week @ 2024-11-25 41/week @ 2024-12-02 133/week @ 2024-12-09 62/week @ 2024-12-16 28/week @ 2024-12-23 44/week @ 2024-12-30 86/week @ 2025-01-06 105/week @ 2025-01-13 104/week @ 2025-01-20 39/week @ 2025-01-27 107/week @ 2025-02-03

374 downloads per month
Used in 3 crates

MIT license

52KB
1K SLoC

hex2d

Build Status 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

~385–620KB
~13K SLoC