quickpaver.gen_hexagonal_tiling#

quickpaver.gen_hexagonal_tiling(surface_to_cover: Polygon | MultiPolygon, edge_length: float, anisotropy_ratio: float = 1.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]#

Create a grid of hexagons within the given bounding box.

Parameters:
  • surface_to_cover (Union[shapely.Polygon, shapely.MultiPolygon]) – Surface to cover with the tiling. Only the polygon intersecting this surface are kept.

  • edge_length (float) – Edge length for the base polygon.

  • edge_length – Edge length for the base polygon. E.g., choosing PolygonType.RECTANGLE with anisotropy_ratio = 2 results in rectangles with scale (1.0, 2.0).

  • 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. When None (default) no alignment shift is applied.

Returns:

A tuple containing:
  • A shapely collection of polygons.

  • A dictionary where keys are hexagon indices and values are sets of adjacent hexagon indices.

Return type:

Tuple[shapely.MultiPolygon, DefaultDict[int, Set[int]]]