Skip to main content

P3 Penroser Tiling Generator

Project description

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

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

pynrose-1.0.0.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pynrose-1.0.0-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file pynrose-1.0.0.tar.gz.

File metadata

  • Download URL: pynrose-1.0.0.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for pynrose-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2fcd773b70d881f15a9cccedb11f8b3e752995aafe995454de96f10d258012a7
MD5 5c11e3b99518fa93fee57223ed749c79
BLAKE2b-256 3ec1ffa0cd7fb23ce9f617ba7e5c4f2cd901fcb2288922f24a8b718bf9128cf7

See more details on using hashes here.

File details

Details for the file pynrose-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pynrose-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 14.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for pynrose-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 78f7e0e6ff5285c033d28adfead445aaa31041a47a50dbdc8d20a5c56f231432
MD5 ef15c782ff79d5d6c3cb933811762c6b
BLAKE2b-256 d80e3b11bb75d07df46c1a9286781c34be144ae965c7f146c7f7a99472301058

See more details on using hashes here.

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