Skip to main content

pynrose - P3 Penrose Tiling Generator

This is a python library and stand-alone program to generate P3 penrose tilings.

Installation

pip install pynrose

Stand-alone program

As a stand-alone program, this is able to generate P3 penrose tilings to SVG. It supports a two modes of operation.

The SVG mode outputs each rhombus as a separate closed path, with different styles applied to thick and thin rhombii. This is intended for visual/display applications.

The SVGLINE mode outputs each rhombus edge as a separate path, and ensures the edges are deduplicated, to avoid re-cutting/etching the same line multiple times, for CNC/laser etching types of applications.

In both modes, the tiling can be split up into multiple smaller tilings that can be recombined with no overlaps or missing rhombii. This allows a tiling to be split up into multiple smaller parts, based on the constraints of the manufacturing process, and then assembled into a single large tiling.

CLI Usage

To generate a random penrose tiling as an SVG

pynrose > tiling.svg

To explore more of the options that are available, you can use --help or -?

pynrose --help

API Usage

This also exposes an API that can be used to generate P3 penrose tilings programatically for any other use you may have.

The API documentation can be found at https://pynrose.readthedocs.io

from pynrose import Tiling, Grid, Vector

# generate a new tiling with random offsets
tiling = Tiling()
grid = Grid(Vector(0, 0), Vector(20, 20))

# iterate over all rhombii whose midpoints are in the grid cell from (0, 0) to (20, 20)
for rhombus in tiling.rhombii(grid.cell(0, 0)):
    print(rhombus.vertices)

Generation Algorithm

The generation algorithm is based on the de Bruijn method, where there are 5 families of equally spaced parallel lines, and each line intersection represents a rhombus in the penrose tiling.

You can read more at

Metadata

Release files for pynrose 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pynrose 1.0.0
File Size Uploaded
pynrose-1.0.0.tar.gz 11.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pynrose 1.0.0
File Interpreter ABI Platform
pynrose-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 26.5 kB

Release files / pynrose-1.0.0.tar.gz

Download URL pynrose-1.0.0.tar.gz
Size 11.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2fcd773b70d881f15a9cccedb11f8b3e752995aafe995454de96f10d258012a7
BLAKE2b-256 checksum
How to use checksums
3ec1ffa0cd7fb23ce9f617ba7e5c4f2cd901fcb2288922f24a8b718bf9128cf7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / pynrose-1.0.0-py3-none-any.whl

Download URL pynrose-1.0.0-py3-none-any.whl
Size 14.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
78f7e0e6ff5285c033d28adfead445aaa31041a47a50dbdc8d20a5c56f231432
BLAKE2b-256 checksum
How to use checksums
d80e3b11bb75d07df46c1a9286781c34be144ae965c7f146c7f7a99472301058
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page