Skip to main content

Hexometry module

Project description

Hexometry

Python library to work with hexagon grid geometry.

Overview

Hexometry is a Python library to work with hexagon grid geometry. Some ideas of having x, y, z coordinates for hexagon grid are taken from this article by Jasper Flick.

Particulary this image gives a good idea of a choosen coordinates for hexagon grid:

hex grid coordinates example

Dependencies

This library has no dependencies apart from python stdlib, but it requires Python 3.10 or higher. There is no problem to make it work with Python 3.7 or 3.8, but the original intention was to try fancy features of modern Python.

Installation

pip install hexometry

Usage

from hexometry import Coord, Direction, Route

c1 = Coord(0, 0)
c2 = Coord(2, 3)
print(f"Coordinates {c1} and {c2} on a field are {c1-c2} hexes away each other")

route = c1 >> c2
print(f"and the route between them are: {route}. Let's traverse it:")

coord = c1
for direction in route:
    coord += direction
    print(f"moving {direction.value} to {coord}")

assert coord == c2
print("here we are")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hexometry-1.0.1.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hexometry-1.0.1-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file hexometry-1.0.1.tar.gz.

File metadata

  • Download URL: hexometry-1.0.1.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for hexometry-1.0.1.tar.gz
Algorithm Hash digest
SHA256 2359cc210896b6eb614728e4549a84d57034418cc7d51eb5032474e5df3f3fe6
MD5 0fbdca5fef4f326be0644fde946a1b4a
BLAKE2b-256 861dbf8b5e95f5e0d3196b953e690d018e92f2f94f910e9e55275a91de6ce9e8

See more details on using hashes here.

Provenance

The following attestation bundles were made for hexometry-1.0.1.tar.gz:

Publisher: pypi-release.yml on wlame/hexometry

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hexometry-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: hexometry-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for hexometry-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 388e0d36884a500fcabf44703d442d4a8adc3a0d00c33933319872c979e905de
MD5 5ea9b817539a009f1a1617fce79b1202
BLAKE2b-256 b3d00e8baf8e13aa414ae049e104fb1f93c6d893e08e7cc52d3ee93722c09e42

See more details on using hashes here.

Provenance

The following attestation bundles were made for hexometry-1.0.1-py3-none-any.whl:

Publisher: pypi-release.yml on wlame/hexometry

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page