Pode Module
- class pode.pode.Graph(**attr)
Bases:
DiGraph- classmethod from_undirected(graph: Graph) Graph
Constructs an ordered and directed graph from an undirected graph.
- next_neighbor(polygon: Polygon) Polygon | None
Most immediate successor which is a neighbor of a given node
- Parameters:
polygon – node of the graph
- Returns:
next neighbor node or None if not found
- pll(polygon: Polygon, splitter: Segment) RootedPolygons
- plr(polygon: Polygon, splitter: Segment) RootedPolygons
Portion of the current polygon to the right of the splitter plus all immediate ancestors accessible through the polygon edges that lie on the right of the splitter
- pred_poly_by_line(polygon: Polygon, splitter: Segment) PolygonsSet
- pred_polys(polygon: Polygon) PolygonsSet
PredPoly is defined in the paper as the current polygon plus all its ancestors. In the paper ancestors are called “predecessors”.
- Parameters:
polygon – node of the graph
- Returns:
a set of polygons that are parts of PredPoly
- class pode.pode.Requirement(area: Real, point: Point | None = None)
Bases:
NamedTupleArea requirement with an optional point (site)
- class pode.pode.RootedPolygons(root: ground.hints.Empty | gon.base.Polygon, predecessors: pode.pode.PolygonsSet)
Bases:
object- predecessors: PolygonsSet
- pode.pode.assign_requirements(*, polygon: Polygon, requirements: List[Requirement], graph: Graph) Tuple[FrozenSet[Requirement], List[Requirement]]
- pode.pode.divide(polygon: ~gon.base.Polygon, requirements: ~typing.List[~pode.pode.Requirement], convex_divisor: ~pode.hints.ConvexDivisorType = <bound method Triangulation.constrained_delaunay of <class 'sect.core.delaunay.triangulation.Triangulation'>>) List[Polygon]
Divides given polygon for the given list of Requirement objects
- Parameters:
polygon – input polygon
requirements – area requirements with optional points
convex_divisor – function to split input polygon to convex parts
- Returns:
a list of parts of the polygon in the order corresponding to requirements
- pode.pode.order_by_edge(vertices: List[Point], edge: Segment) List[Point]
Orders vertices of the convex polygon and the sites in a counterclockwise manner so that the last edge would be the edge to the next neighbor.
- Parameters:
vertices – vertices of the convex polygon and the sites located on the boundary of the polygon
edge – edge to the next neighbor
- Returns:
ordered union of polygon vertices and sites
- pode.pode.order_by_sites(vertices: List[Point], site_location: Point) List[Point]
Orders vertices of the convex polygon and the sites in a counterclockwise manner so that the last vertex would be a site.
- Parameters:
vertices – convex polygon’s vertices and sites
site_location – site that will be the last vertex
- Returns:
ordered union of polygon vertices and sites
- pode.pode.split(*, polygon: Polygon, vertices: List[Point], sites: FrozenSet[Requirement], graph: Graph) Tuple[DiGraph, DiGraph] | Tuple[DiGraph, DiGraph, DiGraph]
Splits a PredPoly to 2 or 3 parts for further division
- pode.pode.to_graph(polygon: Polygon, extra_points: List[Point], *, convex_divisor: ConvexDivisorType) Graph
Converts polygon to a region-adjacency graph by dividing it to parts using convex_divisor function. Resulting parts become nodes connected when they touch each other.
- Parameters:
polygon – input polygon that will be split
extra_points – list of points which will be used in splitting the polygon to convex parts
convex_divisor – function to split the polygon into convex parts
- Returns:
graph with parts of the polygon as nodes; edges will keep side attributes with the touching segments.
- pode.pode.to_requirements_per_vertex(vertices: List[Point], sites: FrozenSet[Requirement]) Iterator[FrozenSet[Requirement]]
When rotating a line head over domain_vertices we need to get on each step a list of all previously encountered sites, so that later we can extract corresponding area requirement.
- pode.pode.to_subgraph(*, predecessors: PolygonsSet, old_root: Polygon, new_root: Polygon, sites: FrozenSet[Requirement], graph: Graph) Graph
- pode.pode.validate_requirements(requirements: List[Requirement], polygon: Polygon) None