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(G: networkx.Graph, *, planar: networkx.PlanarEmbedding, VertexC: optiwindnet.geometric.CoordPairs, diagonals: bidict.bidict | None = None) networkx.PlanarEmbedding[source]

Ajust planar to include the edges actually used by routeset G.

Copies planar and flips the edges to their diagonal if the latter is an edge of G. Ideally, the returned PlanarEmbedding includes all G edges (an expected discrepancy are G’s gates).

If diagonals is provided, some diagonal gates may become planar’s edges if they are not crossing any edge in G. Otherwise gates are ignored.

Important: G must be free of edge×edge crossings.