Adjacency¶
isotile.lattice_adjacency
¶
lattice_adjacency(
cell: NDArray[int64],
aspect: NDArray[int64],
tiling_type: TilingType,
kind: AdjacencyKind,
) -> csr_array
Adjacency of tiles given by their cells and aspects, from the table of the type.
The table does not depend on the parameters, the frame or the position of the tiling. Pairs where one tile is not in the set are dropped.
Parameters:
-
cell((n, 2) array of int) –Cell
(u, v)of each tile. -
aspect((n,) array of int) –Aspect of each tile.
-
tiling_type(TilingType) –The type of the tiling; its
adjacencytable is used. -
kind(('edge', 'vertex', 'vertex-only'), default:"edge") –"edge": shared edge;"vertex": shared edge or vertex;"vertex-only": shared vertex and no shared edge.
Returns:
-
csr_array–Symmetric boolean matrix of shape
(n, n); row and columniare tilei.
Raises:
-
ValueError–If
kindis not one of the three kinds.
isotile.geometric_adjacency
¶
geometric_adjacency(
polygons: Sequence[NDArray[float64]] | NDArray[float64],
tol: float = 1e-06,
) -> tuple[csr_array, csr_array]
Edge and vertex-only adjacency of polygons, by counting shared vertices.
Vertices closer than tol are one vertex. Two polygons share an edge if they share 2 or more vertices and
are vertex-only neighbors if they share exactly one. Only vertices are compared: a vertex that lies inside an
edge of another polygon is not a shared vertex.
Parameters:
-
polygons(sequence of (k, 2) arrays, or (n, k, 2) array) –Vertices of each polygon.
-
tol(float, default:1e-6) –Distance below which two vertices are the same vertex, in the units of the coordinates.
Returns:
-
edge(csr_array) –Boolean matrix of shape
(n, n); true for polygons that share an edge. -
vertex_only(csr_array) –Boolean matrix of shape
(n, n); true for polygons that share exactly one vertex.