Skip to main content

**Hexometry**

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.11 or higher. There is no problem to make it work with Python 3.7 — 3.11, 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.1.1.tar.gz (6.0 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.1.1-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for hexometry-1.1.1.tar.gz
Algorithm Hash digest
SHA256 81c187669b0a0138bab074559fe3ee358f82e50e551e87cf1e1c6234cdddce55
MD5 187cc5f33efe83ef2fb6c62ce59e8cce
BLAKE2b-256 945ed0242d896839c40b1a7e10f1a229eb8c7b43acb96af40d68e617e16f16ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for hexometry-1.1.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.1.1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for hexometry-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fbd900c121b20bba6802498e70ea0d9beb56c44369afc13b800af8bc4a76237c
MD5 03fbf9f7d9a85c2502c0fe2b0153b150
BLAKE2b-256 37078d3afeca3d5915a00539ec970a5dc249fcd34bac63921d11a99043eaa289

See more details on using hashes here.

Provenance

The following attestation bundles were made for hexometry-1.1.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