Skip to main content

Create a tessellation with the desired width, height, and hexagon size

Project description

Hexalate

A Python library for generating hexagonal tessellations.

Features

  • Generate coordinates for individual hexagons
  • Create a tessellation that fills a specified area with hexagons of a specific size
  • Supports customization of hexagon shape and size

Installation

To use this library, simply install it using pip:

pip install hexalate

Usage

Basic Usage

Import the hexalate module:

import hexalate as hx

Create a tessellation with the desired width, height, and hexagon size:

width = 10
height = 5
size = 0.3
tessellation = hx.create_hexagonal_tessellation(width, height, size)

Visualize the tessellation using your favorite plotting library (e.g., Matplotlib):

import matplotlib.pyplot as plt

plt.figure(figsize=(width, height))
for hexagon in tessellation:
    x, y = hexagon['x'], hexagon['y']
    plt.plot([x, x+size*np.sqrt(3)], [y, y+size/2], 'k-')
    plt.plot([x, x+size*np.sqrt(3)/2], [y-size/4, y+size/4], 'k-')
    plt.plot([x, x-size*np.sqrt(3)/2], [y-size/4, y+size/4], 'k-')
plt.show()

Advanced Usage

Customize the hexagon shape and size:

hexagon = hx.hexagon(center=(1, 2), size=0.5)

Generate a tessellation with a specific density:

density = 0.8
tessellation = hx.create_hexagonal_tessellation(width, height, size, density=density)

Acknowledgments

This library is based on the work of Cayley, a mathematician who developed the concept of Cayley graphs. Special thanks to MATLAB for inspiring the naming conventions and syntax.

License

This library is released under the MIT License. For more information, see the LICENSE file.

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

hexalate-0.1.0.tar.gz (2.8 kB view hashes)

Uploaded Source

Built Distribution

hexalate-0.1.0-py3-none-any.whl (3.6 kB view hashes)

Uploaded Python 3

Supported by

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