Tests/NUnit/H3Suite/TestH3ToLocalIjExhaustive.cs
/// <summary>
/// Test that coordinates for an index match some simple rules about index
/// digits, when using the index as its own origin. That is, that the IJ
/// coordinates are in the coordinate space of the origin's base cell.
/// </summary>
Test that coordinates for an index match some simple rules about index
digits, when using the index as its own origin. That is, that the IJ
coordinates are in the coordinate space of the origin's base cell.
Test that coordinates for an index match some simple rules about index digits when using the index as its own origin . That is that the IJ coordinates are in the coordinate space of the origin ' s base cell .
private void H3ToLocalIjCoordinatesAssertions(H3Index h3)
        {
            int r = h3.Resolution;
            CoordIj ij;
            int status;
            (status, ij) = h3.ToLocalIjExperimental(h3);
            Assert.AreEqual(0, status);
            var ijk = ij.ToIjk();
            switch (r)
            {
                case 0:
                    Assert.AreEqual(ijk, H3Lib.Constants.CoordIjk.UnitVecs[0]);
                    break;
                case 1:
                    Assert.AreEqual(ijk, H3Lib.Constants.CoordIjk.UnitVecs[(int) h3.GetIndexDigit(1)]);
                    break;
                case 2:
                {
                    var expected = H3Lib.Constants.CoordIjk.UnitVecs[(int) h3.GetIndexDigit(1)];
                    expected = expected.DownAp7R().Neighbor(h3.GetIndexDigit(2));
                    Assert.AreEqual(ijk, expected);
                    break;
                }
                default:
                    Assert.IsTrue(true);
                    break;
            }
        }
private void H3ToLocalIjCoordinatesAssertions ( H3Index h3 ) { int r = h3 . Resolution ; CoordIj ij ; int status ; ( status , ij ) = h3 . ToLocalIjExperimental ( h3 ) ; Assert . AreEqual ( 0 , status ) ; var ijk = ij . ToIjk ( ) ; switch ( r ) { case 0 : Assert . AreEqual ( ijk , H3Lib . Constants . CoordIjk . UnitVecs [ 0 ] ) ; break ; case 1 : Assert . AreEqual ( ijk , H3Lib . Constants . CoordIjk . UnitVecs [ ( int ) h3 . GetIndexDigit ( 1 ) ] ) ; break ; case 2 : { var expected = H3Lib . Constants . CoordIjk . UnitVecs [ ( int ) h3 . GetIndexDigit ( 1 ) ] ; expected = expected . DownAp7R ( ) . Neighbor ( h3 . GetIndexDigit ( 2 ) ) ; Assert . AreEqual ( ijk , expected ) ; break ; } default : Assert . IsTrue ( true ) ; break ; } }
Test that coordinates for an index match some simple rules about index
digits, when using the index as its own origin.
Test that coordinates for an index match some simple rules about index digits when using the index as its own origin .
h3
H3Index