Tests/NUnit/H3Suite/TestH3CellAreaExhaustive.cs
/// <summary>
/// Basic checks around the great circle distance between the centers of two
/// neighboring cells. Tests positivity and commutativity.
///
/// Tests the functions:
///     pointDistRads
///     pointDistKm
///     pointDistM
/// </summary>
Basic checks around the great circle distance between the centers of two
neighboring cells. Tests positivity and commutativity.


Basic checks around the great circle distance between the centers of two neighboring cells . Tests positivity and commutativity .
private void haversine_assert(H3Index edge)
        {
            var origin = edge.OriginFromUniDirectionalEdge();
            var a = origin.ToGeoCoord();
            var destination = edge.DestinationFromUniDirectionalEdge();
            var b = destination.ToGeoCoord();
            decimal ab, ba;
            ab = a.DistanceToRadians(b);
            ba = b.DistanceToRadians(a);
            Assert.Greater(ab, 0);
            Assert.AreEqual(ab, ba);
            ab = a.DistanceToKm(b);
            ba = b.DistanceToKm(a);
            Assert.Greater(ab, 0);
            Assert.AreEqual(ab, ba);
            ab = a.DistanceToM(b);
            ba = b.DistanceToM(a);
            Assert.Greater(ab, 0);
            Assert.AreEqual(ab, ba);
            Assert.Greater(a.DistanceToKm(b), a.DistanceToRadians(b));
            Assert.Greater(a.DistanceToM(b), a.DistanceToKm(b));
        }
private void haversine_assert ( H3Index edge ) { var origin = edge . OriginFromUniDirectionalEdge ( ) ; var a = origin . ToGeoCoord ( ) ; var destination = edge . DestinationFromUniDirectionalEdge ( ) ; var b = destination . ToGeoCoord ( ) ; decimal ab , ba ; ab = a . DistanceToRadians ( b ) ; ba = b . DistanceToRadians ( a ) ; Assert . Greater ( ab , 0 ) ; Assert . AreEqual ( ab , ba ) ; ab = a . DistanceToKm ( b ) ; ba = b . DistanceToKm ( a ) ; Assert . Greater ( ab , 0 ) ; Assert . AreEqual ( ab , ba ) ; ab = a . DistanceToM ( b ) ; ba = b . DistanceToM ( a ) ; Assert . Greater ( ab , 0 ) ; Assert . AreEqual ( ab , ba ) ; Assert . Greater ( a . DistanceToKm ( b ) , a . DistanceToRadians ( b ) ) ; Assert . Greater ( a . DistanceToM ( b ) , a . DistanceToKm ( b ) ) ; }
Basic checks around the great circle distance between the centers of two
neighboring cells.
Basic checks around the great circle distance between the centers of two neighboring cells .
edge
H3Index