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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file hexalate-0.1.0.tar.gz
.
File metadata
- Download URL: hexalate-0.1.0.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.7 Darwin/23.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9596380172138e9e36297079d12f145170f8fe16510457b0c90d19b06161d0e2 |
|
MD5 | 7ee3ca2623c754bca2d38c6ce2812768 |
|
BLAKE2b-256 | 7b345a0c140b84514555f973fd2973802369e8ff94b5d4b0bad9252bf51e752a |
File details
Details for the file hexalate-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: hexalate-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.7 Darwin/23.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b0ba67d9f70e7cdfbedc8968086350189ff226e9f7fb847459d31fc4132eedc4 |
|
MD5 | 87a7375ed7d5e7fe9ec9789037eab6f0 |
|
BLAKE2b-256 | c185f1f76aa077071043546d38f011404b39f61cc779ed33b0e188ddf248de89 |