-
Notifications
You must be signed in to change notification settings - Fork 5
skeletonize
skeletonize()
computes the straight skeleton of a polygon. It accepts a simple description of the contour of a footprint polygon, including those of evetual holes, and returns the nodes and edges of its straight skeleton.
The polygon is expected as a list of contours, where every contour is a list of edges of type Edge2
(imported from bpyeuclid
). The outer contour of the polygon is the first list of in the list of contours and is expected in counterclockwise order. In the right-handed coordinate system, seen from top, the polygon is on the left of its contour.
If the footprint has holes, their contours are expected as lists of their edges, following the outer contour of the polygon. Their edges are in clockwise order, seen from top, the polygon is on the left of the hole's contour.
skeletonize(edgeContours, mergeRange=0.15)
Argument | Description |
---|---|
edgeContours |
A list of contours of the polygon and eventually its holes, where every contour is a list of edges of type `Edge2` (imported from `bpyeuclid`). It is expected to as:edgeContours = [ polygon_edge,<hole1_edges>, <hole2_edges>, ...] polygon_egdes is a list of the edges of the outer polygon contour in counterclockwise order. <hole_edges> is an optional list of the edges of a hole contour in clockwise order.
|
mergeRange |
skeletonize() sometimes produces clusters of vertices that are close together. These get merged into one vertice, for all pairs of vertices, that are within a square of width mergeRange and where the Manhattan distance between such pairs is less than 5*mergeRange . The default value of mergeRange is 0.15.
|
Value | Description |
---|---|
return |
A list of subtrees (of type Subtree ) of the straight skeleton. A Subtree contains the attributes (source, height, sinks) , where source is the node vertex, height is its distance to the nearest polygon edge, and sinks is a list of vertices connected to the node. All vertices are of type mathutils.Vertex with two dimension x and y.
|