public (MeshCell <T>, IEnumerator <Edge <T> >) getNeighborFromEdgeNeighbor(Edge <T> edge) { MeshCell <T> newCell = getNeighbour(edge); AfterCutRidgeEnumerator ridgeEnum = new AfterCutRidgeEnumerator(newCell.Edges, edge); return(newCell, ridgeEnum); }
public (MeshCell <T>, IEnumerator <Edge <T> >) GetFirst(Line boundaryLine) { //Find cell that contains boundaryLine.Start; bool foundFirstCell = false; if (insideCell == null) { //SetFirst Cell: any random cell. Influences runtime, though insideCell = Cells[0]; foundFirstCell = true; } //Check if boundaryLine.Start is still in cell, else search neighborhood foreach (MeshCell <T> cell in CellsOnSameSideOfBoundary_Iterative(insideCell)) { Vector[] verts = Array.ConvertAll(cell.Vertices, item => (Vector)item); //At this point, every cell is convex! bool isInside = PolygonTesselation.PointInConvexPolygon(verts, (Vector)boundaryLine.start); if (isInside) { foundFirstCell = true; insideCell = cell; break; } } if (foundFirstCell) { AfterCutRidgeEnumerator enumerator = new AfterCutRidgeEnumerator(insideCell.Edges, insideCell.Edges[1]); enumerator.Reset(); return(insideCell, enumerator); } else { throw new Exception("First cell could not be found: boundaryLine.start not inside a cell"); } }