Metadata-Version: 2.5
Name: isotile
Version: 0.1.0
Summary: Isohedral tilings in NumPy: the 81 isohedral types, tile generation and exact tile adjacency.
Project-URL: Homepage, https://bright-fakl.github.io/isotile/
Project-URL: Documentation, https://bright-fakl.github.io/isotile/
Project-URL: Repository, https://github.com/bright-fakl/isotile
Project-URL: Issues, https://github.com/bright-fakl/isotile/issues
Project-URL: Changelog, https://bright-fakl.github.io/isotile/changelog/
Author-email: FKloosterman <devfakl@gmail.com>
License-Expression: MIT
License-File: LICENSE
License-File: NOTICE
License-File: src/isotile/data/LICENSE-tactile
Keywords: adjacency,isohedral,lattice,numpy,tactile,tessellation,tiling
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Typing :: Typed
Requires-Python: <4.0,>=3.10
Requires-Dist: numpy>=1.26
Requires-Dist: scipy>=1.11
Provides-Extra: all
Requires-Dist: matplotlib>=3.7; extra == 'all'
Requires-Dist: shapely>=2.0; extra == 'all'
Provides-Extra: plot
Requires-Dist: matplotlib>=3.7; extra == 'plot'
Provides-Extra: shapely
Requires-Dist: shapely>=2.0; extra == 'shapely'
Description-Content-Type: text/markdown

<h1 align="center">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/bright-fakl/isotile/main/docs/assets/logo/lockup-dark.svg">
    <img src="https://raw.githubusercontent.com/bright-fakl/isotile/main/docs/assets/logo/lockup-light.svg" alt="isotile" height="72">
  </picture>
</h1>

[![PyPI](https://img.shields.io/pypi/v/isotile)](https://pypi.org/project/isotile/)
[![Python](https://img.shields.io/pypi/pyversions/isotile)](https://pypi.org/project/isotile/)
[![CI](https://github.com/bright-fakl/isotile/actions/workflows/main.yml/badge.svg)](https://github.com/bright-fakl/isotile/actions/workflows/main.yml)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue)](https://github.com/bright-fakl/isotile/blob/main/LICENSE)
[![Docs](https://img.shields.io/badge/docs-bright--fakl.github.io%2Fisotile-blue)](https://bright-fakl.github.io/isotile/)

Documentation: <https://bright-fakl.github.io/isotile/>

Isohedral tilings in NumPy: the 81 isohedral tiling types, vectorized tile generation and exact tile adjacency from
a lattice table. It replaces [tactile](https://github.com/isohedral/tactile) for these tasks and keeps its tiling
type numbers (IH1 to IH93) and parameter format.

- Tiles are generated for a rectangle or for a target tile count, as arrays of cells, aspects and affine transforms.
- Adjacency (shared edge, shared vertex, vertex only) comes from a table of the tiling type, as a scipy sparse
  boolean matrix. It does not depend on the parameters, the scale or the position of the tiling.
- Squares, hexagons, any triangle and any simple quadrilateral are named constructors of the same class.
- A parameter set that makes the prototile self-intersecting raises `ValueError`; `check_prototile` reports the
  edges at fault without constructing a tiling.

## Install

```
pip install isotile            # numpy and scipy
pip install "isotile[shapely]" # adds TileSet.polygons()
pip install "isotile[plot]"    # adds isotile.plot (matplotlib)
```

Python 3.10 or newer.

## Quickstart

```python
from isotile import IsohedralTiling, check_prototile, find_types

tiling = IsohedralTiling(7)  # type IH7 at its default parameters
print(tiling.describe())

tiles = tiling.fill_region((0, 0, 10, 6), n_tiles=200)  # tiles that cover the region
print(len(tiles), tiles.cell.shape, tiles.aspect.shape, tiles.transforms.shape)

polygons = tiles.vertices()  # (n, n_vertices, 2) tile outlines
edge = tiles.adjacency("edge")  # scipy.sparse.csr_array of bool, (n, n)
print(edge.sum(axis=1).max(), tiles.neighbors(0, "vertex"))

hexagons = IsohedralTiling.hexagon(pointy_top=False)
triangles = IsohedralTiling.triangle([(0, 0), (3, 0), (1, 2)])  # any triangle
print(find_types(num_vertices=3, all_edges="S"))
print(check_prototile(7, [0.25, -1.0]))  # PrototileReport(valid=False, ...)
```

## Concepts

A tiling is one of 81 types with free parameters that change the shape of the prototile. The lattice is spanned by
two translation vectors (`translation_u`, `translation_v`). A tile is identified by its cell `(u, v)` and its
aspect, the index of the tile within the cell. A tile set holds `cell` (n, 2), `aspect` (n,) and the affine
`transforms` (n, 2, 3) of the prototile onto each tile.

`IsohedralTiling(type, parameters, frame=...)` takes an affine `frame` that maps the type's native coordinates to
world coordinates (scale, rotation, reflection, position). `fill_region(bounds, n_tiles=... | tile_size=...,
margin=...)` computes the frame from a region and a tile count or size.

## Documentation

<https://bright-fakl.github.io/isotile/>: [quickstart](https://bright-fakl.github.io/isotile/quickstart/),
[catalog of the 81 types](https://bright-fakl.github.io/isotile/catalog/),
[adjacency](https://bright-fakl.github.io/isotile/adjacency/),
[edge curves](https://bright-fakl.github.io/isotile/curves/),
[benchmark](https://bright-fakl.github.io/isotile/benchmark/),
[migrating from tactile](https://bright-fakl.github.io/isotile/migration/) and the
[API reference](https://bright-fakl.github.io/isotile/api/).

## Background and citation

The 93 isohedral tiling types were classified by Branko Grünbaum and G. C. Shephard, *Tilings and Patterns* (W. H.
Freeman, 1987). The type data and the parameter format come from [Tactile / tactile-js](https://github.com/isohedral/tactile)
by Craig S. Kaplan; if you use isotile in published work, please also cite Tactile and Grünbaum and Shephard.

## License

MIT. The tiling type data is derived from Tactile / tactile-js by Craig S. Kaplan (BSD 3-Clause); see `NOTICE`.
