topologicpy.Polyskel module
- class topologicpy.Polyskel.Line2(p1, p2=None)
Bases:
objectAn infinite 2-D line represented by point p and unit direction v.
- Attributes
- p
- v
Methods
distance
intersect
- distance(point)
- intersect(other)
- p
- v
- class topologicpy.Polyskel.LineSegment2(p1, p2)
Bases:
Line2A finite 2-D line segment.
- Attributes
- p
- p2
- v
Methods
distance
intersect
on_segment
- intersect(other)
- on_segment(point)
- p2
- class topologicpy.Polyskel.Point2(x=0.0, y=0.0)
Bases:
objectA lightweight 2-D point/vector used by the straight-skeleton solver.
- Attributes
- x
- y
Methods
cross
distance
dot
normalized
- cross(other)
- distance(other)
- dot(other)
- normalized()
- x
- y
- class topologicpy.Polyskel.Ray2(p, v)
Bases:
objectA half-line represented by origin p and unit direction v.
- Attributes
- p
- v
Methods
intersect
- intersect(other)
- p
- v
- topologicpy.Polyskel.Skeletonize(polygon, holes=None, asTopologic: bool = True, fallback: bool = True, silent: bool = False)
CamelCase alias for skeletonize.
- class topologicpy.Polyskel.Subtree(source, height, sinks)
Bases:
tuple- Attributes
- height
Alias for field number 1
- sinks
Alias for field number 2
- source
Alias for field number 0
Methods
count(value, /)Return number of occurrences of value.
index(value[, start, stop])Return first index of value.
- height
Alias for field number 1
- sinks
Alias for field number 2
- source
Alias for field number 0
- topologicpy.Polyskel.bisector(v1, v2, v3)
Returns the internal angle bisector direction at v2 for v1-v2-v3.
- topologicpy.Polyskel.distance(v1, v2)
Returns the XY distance between two coordinate-like or TopologicPy vertices.
- topologicpy.Polyskel.normalize(v)
Returns a normalized vector. Coordinate pairs always return Point2.
- topologicpy.Polyskel.skeletonize(polygon, holes=None, asTopologic: bool = True, fallback: bool = True, silent: bool = False)
Computes a straight skeleton approximation for a simple polygon.
- Parameters
- polygonlist
The outer polygon contour as coordinate pairs, Point2 objects, or TopologicPy vertices. Repeated first/last vertices are accepted.
- holeslist , optional
Optional inner contours. Hole support follows the original polyskel event model and is best-effort for non-degenerate simple holes.
- asTopologicbool , optional
If True and topologicpy.Vertex can be imported, returned Subtree sources and sinks are TopologicPy vertices. If False, Point2 objects are returned. Default is True.
- fallbackbool , optional
If True, a centroid-to-edge-midpoint fallback is returned for simple polygons when the event algorithm degenerates. Default is True.
- silentbool , optional
If True, warning messages are suppressed. Default is False.
- Returns
- list
A list of Subtree(source, height, sinks) records.