/// <summary> /// Generates a Voronoi diagram using Delaunator output /// </summary> /// <param name="del"></param> public Voronoi(Delaunay del) { dual = del; sites = dual.vertices; cells = new List <Cell>(); createCells(); calculateVerticesAndEdgesFromDelaunator(); calculateCellAreas(); }
/// <summary> /// Generate filtered Delaunay by using cell list to cut off unneeded /// edges. /// </summary> /// <param name="del">Input triangulation used as base.</param> /// <param name="reachableCells">List of reachable cells used to filter graph.</param> public Delaunay(Delaunay del, List <Cell> reachableCells) { // Filter out vertices (cells) that aren't reachable. Mark them as ignored for pathfinding. vertices = del.vertices.Where(v => { v.toIgnore = !reachableCells.Contains(v.cell); return(!v.toIgnore); }).ToList(); // Filter out edges that lead to unreachable cells. Mark them as ignored for pathfinding. edges = del.edges.Where(e => { e.toIgnore = !vertices.Contains(e.p) || !vertices.Contains(e.q); return(!e.toIgnore); }).ToList(); }