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.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.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-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hexometry-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.tar.gz
Algorithm Hash digest
SHA256 2d68c2380a0b29a91b34d95f55e7df4c18409578b112cbdfff73b2d95acb53f2
MD5 bbba0fb73f1391e245b2dcd41d80d7fe
BLAKE2b-256 53c9da363ecbf2fb94138dcce84cf2d3394655836f8069d310296eb3b3595452

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: hexometry-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-py3-none-any.whl
Algorithm Hash digest
SHA256 28f5377174346fb1498cbc7a8c30f448353612bc78f1c14598d85db30c4d2231
MD5 ea2d4b418f6b74a3796dca2b6e0aaffa
BLAKE2b-256 477f1ec7d3737919e80515fd565a608374917d35e8a4e2194fa86a4608ad20f3

See more details on using hashes here.

Provenance

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