quickpaver.gen_polygonal_tiling#
- quickpaver.gen_polygonal_tiling(surface_to_cover: Polygon | MultiPolygon, poly_type: PolygonType, edge_length: float, anisotropy_ratio: float = 1.0, rot_deg: float = 0.0, alignment_point: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] | None = None) Tuple[MultiPolygon, Dict[int, List[int]]][source]#
Cover the given surface with tiles (polygons) of the desired type.
The tiling is generated in an axis-aligned (non-rotated) frame, then rotated by rot_deg degrees around the centroid of surface_to_cover so that the final tile orientations match the requested rotation.
- Parameters:
surface_to_cover (shapely.Polygon or shapely.MultiPolygon) – Surface to cover with the tiling. Only tiles whose footprint intersects this surface are kept in the output.
poly_type (PolygonType) – Type of tile geometry. See
PolygonTypefor the available options (HEXAGON,TRIANGLE,RECTANGLE).edge_length (float) – Primary edge length for the base polygon in metres. For anisotropic tiles the secondary dimension is derived as
edge_length * anisotropy_ratio.anisotropy_ratio (float, optional) – Ratio of the secondary to the primary tile dimension. Must be ≥ 1. For example, choosing
PolygonType.RECTANGLEwithanisotropy_ratio = 2produces rectangles with aspect ratio 1 : 2. By default1.0(isotropic).rot_deg (float, optional) – Counter-clockwise rotation angle in degrees applied to the entire tiling around the centroid of surface_to_cover. By default
0.0(no rotation).alignment_point (array-like of shape (2,), optional) –
(x, y)world-space coordinate used to shift the tiling so that one tile centre coincides with this point. WhenNone(default) no alignment shift is applied.
- Returns:
tiling (shapely.MultiPolygon) – Collection of tile polygons covering surface_to_cover.
adjacency (dict of {int: list of int}) – Adjacency map where keys are tile indices (0-based, matching the order of geometries in tiling) and values are lists of neighbouring tile indices.
- Raises:
ValueError – If poly_type is not a recognised
PolygonTypemember.
Notes
Internally the function un-rotates surface_to_cover by
-rot_deg, generates the axis-aligned tiling, then re-rotates the result by+rot_degso that the output tiles are in world-space coordinates.