ladybug_geometry_polyskel.polyskel module¶
Implementation of the straight skeleton algorithm by Felkel and Obdrzalek[1]. [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(polygon, holes=None, tol=1e-10)[source]¶
Compute the straight skeleton of a polygon and returns skeleton as list of edges.
- Parameters
polygon – list of list of point coordinates in counter-clockwise order. Example square: [[0,0], [1,0], [1,1], [0,1]]
holes – list of polygons representing holes in clockwise order. Example hole: [[.25,.75], [.75,.75], [.75,.25], [.25,.25]].
tol – Tolerance for point equivalence. (Default: 1e-10).
- Returns
list of lines as coordinate tuples.
- ladybug_geometry_polyskel.polyskel.skeleton_as_subtree_list(polygon, holes=None, tol=1e-10)[source]¶
Compute polygon straight skeleton as a list of subtree source and sink points.
- Parameters
polygon – nested list of endpoint coordinates in counter-clockwise order. Example square: [[0,0], [1,0], [1,1], [0,1]]
holes – list of polygons representing holes in clockwise order. Example hole: [[.25,.75], [.75,.75], [.75,.25], [.25,.25]]
tol – Tolerance for point equivalence. (Default: 1e-10).
- Returns
List of subtrees.