Crates.io | hexagon_tiles |
lib.rs | hexagon_tiles |
version | 0.2.1 |
source | src |
created_at | 2021-04-12 18:37:33.054885 |
updated_at | 2024-03-09 07:35:43.101987 |
description | A utility library that allows working with the hexagon shape and related math. |
homepage | https://github.com/alkavan/hexagon-tiles |
repository | https://github.com/alkavan/hexagon-tiles |
max_upload_size | |
id | 382510 |
size | 26,606 |
This is a utility library written in Rust that eases development modules that require working with the hexagon shape and related math.
This library is heavily based on Red Blob Games auto generated Rust implementation. Other implementations I looked at are messy and complicated. The auto generated code actually was quite simple, but as such it was not implemented with Rust idiom in mind.
This implementation is different in few ways:
Hex
and FractionalHex
implement PartialEq
.assert_eq!(hex1, hex2)
or hex1 == hex2
.Point
also have PartialEq
implementation for f64
using float_eq
.Hex
and FractionalHex
and this means you can do hex1.add(hex2)
or hex1.round()
.HexDirection
, HexOffset
, HexDoubled
.This packages is distributed under the zlib License.
Feel free to improve and contribute using github. I would really like to see a tile-map manager at some point.
This library was developed in mind to be used as part of a BEVY game engine plugin. However BEVY implementation is not in the scope of this repository.