optiwindnet.mesh¶
Module Contents¶
- optiwindnet.mesh.make_planar_embedding(L: networkx.Graph, offset_scale: float = 0.0001, max_tri_AR: float = _MAX_TRIANGLE_ASPECT_RATIO) tuple[networkx.PlanarEmbedding, networkx.Graph][source]¶
Triangulate a location and produce graphs P and A for it.
P is the planar embedding mesh and A is the available-edges graph. TODO: change the name of this function.
- Parameters:
L – locations graph
offset_scale – Fraction of the diagonal of the site’s bbox to use as spacing between border and nodes in concavities (only where nodes are the border).
max_tri_AR – maximum aspect ratio allowed for triangles on the hull of A as the algorithm removes flat triangles (higher values keep more).
- Returns:
P - the planar embedding graph - and A - the available-edges graph.
- optiwindnet.mesh.delaunay(L: networkx.Graph, bind2root: bool = False) networkx.Graph[source]¶
DEPRECATED. Create the extended-Delaunay-based available-edges graph A.
- Parameters:
L – location
bind2root – assign edge attribute ‘root’ (used by legacy heuristics)
- Returns:
A - available-edges graph
- optiwindnet.mesh.planar_flipped_by_routeset(edges_G: set[tuple[int, int]], *, planar: networkx.PlanarEmbedding, VertexC: optiwindnet.geometric.CoordPairs, ST: int, diagonals: bidict.bidict | None = None) networkx.PlanarEmbedding[source]¶
Ajust planar to include the edges actually used by a routeset.
Copies planar and flips the edges to their diagonal if the latter is an edge in edges_G. Ideally, the returned PlanarEmbedding includes all edges_G (an expected discrepancy are gates).
edges_G is the set of routeset edges in prime-id form (i.e. clones already mapped through fnT), each as a normalized (u, v) pair with u < v. Gate edges have u < 0. ST is T + B (the boundary above which constraint vertices live).
If diagonals is provided, some diagonal gates may become planar’s edges if they are not crossing any edge in edges_G. Otherwise gates are ignored.
Important: the routeset must be free of edge×edge crossings.