/** * Makes an edge grid for this grid. */ public IGrid <TNewCell, FlatRhombPoint> MakeEdgeGrid <TNewCell>() { var edgeOffset = GridOrigin; var edges = this.SelectMany(x => x.GetEdges()); var storage = FlatRhombGrid <TNewCell> .CalculateStorage(edges); var offset = new FlatHexPoint(-2, 0); return(new FlatRhombGrid <TNewCell>(storage.dimensions.X + 4, storage.dimensions.Y + 4, x => IsInsideEdgeGrid(x + offset), edgeOffset.GetEdgeAnchor().BasePoint + offset)); }
/// <summary> /// Makes an edge grid for this grid. /// </summary> public IGrid <TNewCell, FlatRhombPoint> MakeEdgeGrid <TNewCell>() { var edges = this.SelectMany(x => x.GetEdges()); var storage = FlatRhombGrid <TNewCell> .CalculateStorage(edges); var offset = FlatRhombGrid <TNewCell> .GridPointFromArrayPoint(storage.offset); var oddPoint = new FlatHexPoint( GLMathf.FloorMod(offset.X, 2), GLMathf.FloorMod(offset.Y, 2)); var evenPoint = offset.Subtract(oddPoint); return(new FlatRhombGrid <TNewCell>(storage.dimensions.X + 2, storage.dimensions.Y + 2, IsInsideEdgeGrid, evenPoint)); }