public void Test_SubGrid_GetSubGridCellIdex() { ISubGrid leafSubgrid = null; SubGridTree tree = new SubGridTree(SubGridTreeConsts.SubGridTreeLevels, 1.0, new SubGridFactory <NodeSubGrid, LeafSubGrid>()); leafSubgrid = new SubGrid(tree, null, SubGridTreeConsts.SubGridTreeLevels); // GetSubGridCellIndex is a subgrid relative operation only, and depends only on the Owner to derive the difference // between the numer of levels in the overall tree, and the level in the tree at which this subgrid resides (in this // case the bottom of the tree (level 6) to compute the subgrid relative X and y cell indices as it is a leaf subgrid. byte SubGridCellX, SubGridCellY; leafSubgrid.GetSubGridCellIndex(0, 0, out SubGridCellX, out SubGridCellY); Assert.True(SubGridCellX == 0 && SubGridCellY == 0, "Subgrid cell indices incorrect"); leafSubgrid.GetSubGridCellIndex(SubGridTreeConsts.SubGridTreeDimensionMinus1, SubGridTreeConsts.SubGridTreeDimensionMinus1, out SubGridCellX, out SubGridCellY); Assert.True(SubGridCellX == (SubGridTreeConsts.SubGridTreeDimensionMinus1) && SubGridCellY == (SubGridTreeConsts.SubGridTreeDimensionMinus1), "Subgrid cell indices incorrect"); leafSubgrid.GetSubGridCellIndex(SubGridTreeConsts.SubGridTreeDimension, SubGridTreeConsts.SubGridTreeDimension, out SubGridCellX, out SubGridCellY); Assert.True(SubGridCellX == 0 && SubGridCellY == 0, "Subgrid cell indices incorrect"); }