Пример #1
0
        public void Vincenty_CorrectlyCalculatesBearingToConcurrently(double latA, double lonA, double latB, double lonB, double bearingInRadians, int maxIterations, double tolerance)
        {
            IGeographicCoordinate pointA = new GeographicCoordinate(latA, lonA);
            IGeographicCoordinate pointB = new GeographicCoordinate(latB, lonB);

            IAngle expected = new Angle(bearingInRadians, AngleMeasurement.Radians);

            var angles = new ConcurrentQueue <IAngle>()
            {
            };

            void action() => angles.Enqueue(pointA.BearingTo(pointB, maxIterations, tolerance));

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

            Parallel.Invoke(actions);

            while (angles.Count > 0)
            {
                IAngle result;
                angles.TryPeek(out result);

                Assert.Equal(expected, result);

                angles.TryDequeue(out result);
            }
        }
Пример #2
0
        public void Vincenty_CorrectlyCalculatesBearingTo(double latA, double lonA, double latB, double lonB, double bearingInRadians, int maxIterations, double tolerance)
        {
            IGeographicCoordinate pointA = new GeographicCoordinate(latA, lonA);
            IGeographicCoordinate pointB = new GeographicCoordinate(latB, lonB);

            IAngle expected = new Angle(bearingInRadians, AngleMeasurement.Radians);

            IAngle result = pointA.BearingTo(pointB, maxIterations, tolerance);

            Assert.Equal(expected, result);
        }