public void init(Delaunay_Triangulation delaunay, int xCellCount, int yCellCount, BoundingBox region) { indexDelaunay = delaunay; indexRegion = region; x_size = region.Width / yCellCount; y_size = region.Height / xCellCount; // The grid will hold a trinagle for each cell, so a point (x,y) will lie // in the cell representing the grid partition of region to a // xCellCount on yCellCount grid grid = new Triangle_dt[xCellCount + 1, yCellCount + 1]; Triangle_dt colStartTriangle = indexDelaunay.Find(middleOfCell(0, 0)); updateCellValues(0, 0, xCellCount - 1, yCellCount - 1, colStartTriangle); }
/// <summary> /// Constructs a grid index holding the triangles of a delaunay triangulation. /// The grid will be made of (xCellCount * yCellCount) cells. /// The smaller the cells the less triangles that fall in them, whuch means better /// indexing, but also more cells in the index, which mean more storage. /// The smaller the indexed region is, the smaller the cells can be and still /// maintain the same capacity, but adding geometries outside the initial region /// will invalidate the index ! /// </summary> /// <param name="delaunay">delaunay triangulation to index</param> /// <param name="xCellCount">number of grid cells in a row</param> /// <param name="yCellCount">number of grid cells in a column</param> /// <param name="region">geographic region to index</param> /// <remarks></remarks> public GridIndex(Delaunay_Triangulation delaunay, int xCellCount, int yCellCount, BoundingBox region) { init(delaunay, xCellCount, yCellCount, region); }
/// <summary> /// Constructs a grid index holding the triangles of a delaunay triangulation. /// This version uses the bounding box of the triangulation as the region to index. /// </summary> /// <param name="delaunay">delaunay triangulation to index</param> /// <param name="xCellCount">number of grid cells in a row</param> /// <param name="yCellCount">number of grid cells in a column</param> /// <remarks></remarks> public GridIndex(Delaunay_Triangulation delaunay, int xCellCount, int yCellCount) : this(delaunay, xCellCount, yCellCount, delaunay.BoundingBox) { }