/** * Initialize the grid index * * @param delaunay * delaunay triangulation to index * @param xCellCount * number of grid cells in a row * @param yCellCount * number of grid cells in a column * @param region * geographic region to index */ private void init(DelaunayTriangulation delaunay, int xCellCount, int yCellCount, BoundingBox region) { indexDelaunay = delaunay; indexRegion = region; xSize = region.getWidth() / yCellCount; ySize = region.getHeight() / 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[xCellCount][yCellCount]; Triangle colStartTriangle = indexDelaunay.find(middleOfCell(0, 0)); updateCellValues(0, 0, xCellCount - 1, yCellCount - 1, colStartTriangle); }
updateCellValues(minInvalidCell.x, minInvalidCell.y, maxInvalidCell.x, maxInvalidCell.y, adjacentValidTriangle);