ladybug_geometry_polyskel.polyskel module

Implementation of the straight skeleton algorithm by Felkel and Obdrzalek[1].

The functions and classes here here are derived directly from the polyskel python library by Armin Scipiades (@Bottfy), which is available at: https://github.com/Botffy/polyskel

[1] Felkel, Petr and Stepan Obdrzalek. 1998. “Straight Skeleton Implementation.” In Proceedings of Spring Conference on Computer Graphics, Budmerice, Slovakia. 210 - 218.

class ladybug_geometry_polyskel.polyskel.Subtree(source, height, sinks)

Bases: tuple

count(value, /)

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.

property height

Alias for field number 1

property sinks

Alias for field number 2

property source

Alias for field number 0

ladybug_geometry_polyskel.polyskel.skeleton_as_edge_list(boundary, holes=None, tolerance=1e-05, intersect=False)[source]

Get a straight skeleton as list of LineSegment2D.

Parameters
  • boundary – A ladybug-geometry Polygon2D for the boundary around the shape for which the straight skeleton will be computed.

  • holes – An optional list of ladybug-geometry Polygon2D for the holes within the shape for which a straight skeleton will be computed. If None, it will be assumed that no holes exist in the shape. (Default: None).

  • tolerance – Tolerance for point equivalence. (Default: 1e-5).

  • intersect – A boolean to note whether the segments of the skeleton should be intersected with one another before being returned. This can help make the skeleton more usable in the event that its topology is not correct. (Default: False).

Returns

A list of LineSegment2D that represent the straight skeleton.

ladybug_geometry_polyskel.polyskel.skeleton_as_subtree_list(boundary, holes=None, tolerance=1e-05)[source]

Get a straight skeleton as a list of Subtree source and sink points.

Parameters
  • boundary – A ladybug-geometry Polygon2D for the boundary around the shape for which the straight skeleton will be computed.

  • holes – An optional list of ladybug-geometry Polygon2D for the holes within the shape for which a straight skeleton will be computed. If None, it will be assumed that no holes exist in the shape. (Default: None).

  • tolerance – Tolerance for point equivalence. (Default: 1e-5).

Returns

A list of Subtree objects that represent the straight skeleton.