ladybug_geometry_polyskel.polysplit module

Functions for splitting a polygon into subpolygons based on skeleton topology.

ladybug_geometry_polyskel.polysplit.perimeter_core_by_offset(polygon, distance, holes=None)[source]

Compute perimeter and core sub-polygons using a simple offset method.

This method will only return polygons when the distance is shallow enough that the perimeter offset does not intersect itself or turn inward on itself. Otherwise, the method will simple return None. This means that there will only ever be one core polygon.

Parameters
  • polygon – A Polygon2D to split into perimeter and core subpolygons.

  • distance – Distance in model units to offset perimeter subpolygon.

  • holes – A list of Polygon2D objects representing holes in the polygon. (Default: None).

Returns

A tuple with two items.

  • perimeter_sub_polys – A list of perimeter subpolygons as Polygon2D

    objects. Will be None if the offset distance is too deep.

  • core_sub_polys – A list of core subpolygons as Polygon2D objects. In the

    event of a core sub-polygon with a hole, a list with be returned with the first item being a boundary and successive items as hole polygons. Will be None if the offset distance is too deep.

ladybug_geometry_polyskel.polysplit.perimeter_core_subpolygons(polygon, distance, holes=None, tol=1e-08, recurse_limit=3000, print_recurse=False)[source]

Compute the perimeter and core sub-polygons from the polygon straight skeleton.

Parameters
  • polygon – A Polygon2D to split into perimeter and core subpolygons.

  • distance – Distance in model units to offset perimeter subpolygon.

  • holes – A list of Polygon2D objects representing holes in the polygon. (Default: None).

  • tol – Tolerance for point equivalence. (Default: 1e-10).

  • recurse_limit – optional parameter to limit the number of cycles looking for polygons in skeleton graph. (Default: 3000).

  • print_recurse – optional boolean to print cycle loop cycles, for debugging. (Default: False).

Returns

A tuple with two lists.

  • perimeter_sub_polys – A list of perimeter subpolygons as Polygon2D objects.

  • core_sub_polys – A list of core subpolygons as Polygon2D objects. In the

    event of a core sub-polygon with a hole, a list with be returned with the first item being a boundary and successive items as hole polygons.

ladybug_geometry_polyskel.polysplit.skeleton_subpolygons(polygon, holes=None, tol=1e-08, recurse_limit=3000, print_recurse=False)[source]

Compute the polygon straight skeleton as a list of polygon point arrays.

Parameters
  • polygon – list of Polygon2D objects.

  • holes – list of Polygon2D objects representing holes in cw order. (Default: None).

  • tol – Tolerance for point equivalence. (Default: 1e-10).

  • recurse_limit – optional parameter to limit the number of cycles looking for polygons in skeleton graph. (Default: 3000).

  • print_recurse – optional boolean to print cycle loop cycles, for debugging. (Default: False).

Returns

A list of the straight skeleton subpolygons as Polygon2D objects.