Beispiel #1
0
 public DynamicGrid(MBR mbr, decimal xRes, decimal yRes)
     : base(mbr, xRes, yRes)
 {
     gridIntersections = new Dictionary <double2, int>();
     gridPolygons      = new DynamicPolygon[0, 0];
     intersectionList  = new IntersectionList();
 }
Beispiel #2
0
        public DynamicGrid(Grid grid)
            : base(grid)
        {
            gridIntersections = new Dictionary <double2, int>();

            int nColumns = (int)Math.Ceiling((mbr.xMax - mbr.xMin - double2.Tolerance) / xRes);
            int nRows    = (int)Math.Ceiling((mbr.yMax - mbr.yMin - double2.Tolerance) / yRes) + 1;

            gridPolygons = new DynamicPolygon[nColumns, nRows];

            for (int i = 0; i < nColumns; ++i)
            {
                for (int j = 0; j < nRows; ++j)
                {
                    gridPolygons[i, j]    = new DynamicPolygon();
                    gridPolygons[i, j][0] = new double2(mbr.xMin + ((i) * xRes), mbr.yMax - ((j) * yRes));
                    gridPolygons[i, j][1] = new double2(mbr.xMin + ((i + 1) * xRes), mbr.yMax - ((j) * yRes));
                    gridPolygons[i, j][2] = new double2(mbr.xMin + ((i + 1) * xRes), mbr.yMax - ((j + 1) * yRes));
                    gridPolygons[i, j][3] = new double2(mbr.xMin + ((i) * xRes), mbr.yMax - ((j + 1) * yRes));
                }
            }

            intersectionList = new IntersectionList();
        }