Пример #1
0
        public void Vincenty_CorrectlyCalculatesDestinationCoordinatesConcurrently(double latA, double lonA, double bearingInRadians, double distanceInMeters,
                                                                                   double expectedLat, double expectedLon, int maxIterations, double tolerance)
        {
            IGeographicCoordinate pointA = new GeographicCoordinate(latA, lonA);

            IGeographicCoordinate expected = new GeographicCoordinate(expectedLat, expectedLon);

            var coordinates = new ConcurrentQueue <IGeographicCoordinate>()
            {
            };

            void action() => coordinates.Enqueue(pointA.DestinationCoordinates(new Angle(bearingInRadians, AngleMeasurement.Radians), new Distance(distanceInMeters, DistanceMeasurement.Meters),
                                                                               maxIterations, tolerance));

            Action[] actions = Enumerable.Repeat((Action)action, 10).ToArray();

            while (coordinates.Count > 0)
            {
                coordinates.TryPeek(out IGeographicCoordinate result);

                Assert.Equal(expected, result);

                coordinates.TryDequeue(out result);
            }
        }
Пример #2
0
        public void Vincenty_CorrectlyCalculatesDestinationCoordinates(double latA, double lonA, double bearingInRadians, double distanceInMeters,
                                                                       double expectedLat, double expectedLon, int maxIterations, double tolerance)
        {
            IGeographicCoordinate pointA = new GeographicCoordinate(latA, lonA);

            IGeographicCoordinate expected = new GeographicCoordinate(expectedLat, expectedLon);

            IGeographicCoordinate result = pointA.DestinationCoordinates(new Angle(bearingInRadians, AngleMeasurement.Radians), new Distance(distanceInMeters, DistanceMeasurement.Meters),
                                                                         maxIterations, tolerance);

            Assert.Equal(expected, result);
        }