Beispiel #1
0
 /// <summary>
 /// Go over each grid cell and locate a triangle in it to be the cell's
 /// starting search triangle. Since we only pass between adjacent cells
 /// we can search from the last triangle found and not from the start.
 /// Add triangles for each column cells
 /// </summary>
 /// <param name="startXCell"></param>
 /// <param name="startYCell"></param>
 /// <param name="lastXCell"></param>
 /// <param name="lastYCell"></param>
 /// <param name="startTriangle"></param>
 /// <remarks></remarks>
 private void updateCellValues(int startXCell, int startYCell, int lastXCell, int lastYCell, Triangle_dt startTriangle)
 {
     for (int i = startXCell; i <= lastXCell; i++)
     {
         // Find a triangle at the begining of the current column
         startTriangle       = indexDelaunay.Find(middleOfCell(i, startYCell), startTriangle);
         grid[i, startYCell] = startTriangle;
         Triangle_dt prevRowTriangle = startTriangle;
         // Add triangles for the next row cells
         for (int j = startYCell + 1; j <= lastYCell; j++)
         {
             grid[i, j]      = indexDelaunay.Find(middleOfCell(i, j), prevRowTriangle);
             prevRowTriangle = grid[i, j];
         }
     }
 }
Beispiel #2
0
        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);
        }