Ejemplo n.º 1
0
        public void Vincenty_CorrectlyCalculatesFinalBearingConcurrently(double latA, double lonA, double bearingInRadians, double distanceInMeters,
                                                                         double expectedBearing, int maxIterations, double tolerance)
        {
            IGeographicCoordinate pointA = new GeographicCoordinate(latA, lonA);
            IAngle    initialBearing     = new Angle(bearingInRadians, AngleMeasurement.Radians);
            IDistance distance           = new Distance(distanceInMeters, DistanceMeasurement.Meters);

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

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

            void action() => angles.Enqueue(pointA.FinalBearing(initialBearing, distance, maxIterations, tolerance));

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

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

                Assert.Equal(expected, result);

                angles.TryDequeue(out result);
            }
        }
Ejemplo n.º 2
0
        public void Vincenty_CorrectlyCalculatesFinalBearing(double latA, double lonA, double bearingInRadians, double distanceInMeters,
                                                             double expectedBearing, int maxIterations, double tolerance)
        {
            IGeographicCoordinate pointA = new GeographicCoordinate(latA, lonA);
            IAngle    initialBearing     = new Angle(bearingInRadians, AngleMeasurement.Radians);
            IDistance distance           = new Distance(distanceInMeters, DistanceMeasurement.Meters);

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

            IAngle result = pointA.FinalBearing(initialBearing, distance, maxIterations, tolerance);

            Assert.Equal(expected, result);
        }