Пример #1
0
        private static void Main(string[] args)
        {
            options = new ZmanimOptions();

            p = new OptionSet
                    {
                        {"d|date=", "Set date. <mm/dd/yyyy>", x => options.Date = DateTime.ParseExact(x, "MM/dd/yyyy", CultureInfo.InvariantCulture)},
                        {"lat|latitude=", "Set location's latitude", (double x) => options.Latitude = x},
                        {"lon|longitude=", "Set location's longitude", (double x) => options.Longitude = x},
                        {"e|elevation=", "Set location's elevation; Positive only", (double x) => options.Elevation = x},
                        {"tz|timezone=", "Set location's TimeZone", x => options.TimeZone = x},
                        {"tf|timeformat=", "Set the way the application formats a DateTime object.", x => options.DateTimeFormat = x},
                        {"h|?|help", "Shows this help message", v => ShowHelp()}
                    };

            List<string> extraArgs;
            try
            {
                extraArgs = p.Parse(args);
            }
            catch (OptionException)
            {
                ShowHelp();
                return;
            }

            var timeZone = new OlsonTimeZone(options.TimeZone);
            var location =
                new GeoLocation(string.Empty, options.Latitude, options.Longitude, options.Elevation, timeZone);
            var czc = new ComplexZmanimCalendar(new DateTime(options.Date.Year, options.Date.Month, options.Date.Day), location);

            var methods = GetDateTimeAndLongMethods();

            foreach (var first in
                extraArgs.Select(extraArg =>
                                 methods.Where(
                                     f => f.Name.Remove(0, 3).ToLowerInvariant() == extraArg.ToLowerInvariant()).First())
                )
            {
                object invoke = first.Invoke(czc, null);

                if (extraArgs.Count > 1)
                    Console.Write(first.Name.Remove(0, 3) + ": ");

                if (invoke.GetType() == typeof(DateTime))
                {
                    var time = (DateTime)invoke;
                    Console.Write(time.ToString(options.DateTimeFormat));
                }
                else if (invoke.GetType() == typeof(long))
                {
                    Console.WriteLine((long)invoke);
                }

                if (extraArgs.Count > 1)
                    Console.WriteLine();
            }
            //Console.Read();
        }
Пример #2
0
 private ComplexZmanimCalendar GetZmanim()
 {
     string locationName = "Lakewood, NJ";
     double latitude = 40.09596; //Lakewood, NJ
     double longitude = -74.22213; //Lakewood, NJ
     double elevation = 0; //optional elevation
     var timeZone = new WindowsTimeZone();
     var location = new GeoLocation(locationName, latitude, longitude, elevation, timeZone);
     return new ComplexZmanimCalendar(location);
 }
Пример #3
0
        public void Can_select_over_linq()
        {
            var location = new GeoLocation("Lakewood, NJ", 40.09596, -74.22213, 0, new WindowsTimeZone(TimeZoneInfo.Local));

            var days = from day in GetDaysInHebrewYear(DateTime.Now, location)
                       let sunrise = day.GetSunrise()
                       where sunrise.Value.Hour >= 5 && sunrise.Value.Minute > 45
                       select sunrise;

            var itemCount = days.Count();
        }
Пример #4
0
        public IEnumerable<ComplexZmanimCalendar> GetDaysInHebrewMonth(DateTime yearAndMonth, GeoLocation location)
        {
            Calendar calendar = new HebrewCalendar();
            var daysInMonth = calendar.GetDaysInMonth(calendar.GetYear(yearAndMonth), calendar.GetMonth(yearAndMonth));

            for (int i = 0; i < daysInMonth; i++)
            {
                var zmanimCalendar = new ComplexZmanimCalendar(location);
                zmanimCalendar.DateWithLocation.Date = new DateTime(yearAndMonth.Year, yearAndMonth.Month, i + 1);
                yield return zmanimCalendar;
            }
        }
Пример #5
0
        public void Check_is_offset_timezone_working()
        {
            String locationName = "Lakewood, NJ";
            double latitude = 40.09596; //Lakewood, NJ
            double longitude = -74.22213; //Lakewood, NJ
            double elevation = 0; //optional elevation
            var timeZone = new OffsetTimeZone(new TimeSpan(0, 0, -14400));
            var location = new GeoLocation(locationName, latitude, longitude, elevation, timeZone);
            var czc = new ComplexZmanimCalendar(new DateTime(2010, 4, 2), location);

            var zman = czc.GetSunrise();

            Assert.That(zman, Is.EqualTo(
                    new DateTime(2010, 4, 2, 6, 39, 41, 832)
                ));
        }
Пример #6
0
        public IEnumerable<ComplexZmanimCalendar> GetDaysInHebrewYear(DateTime year, GeoLocation location)
        {
            Calendar calendar = new HebrewCalendar();
            var currentYear = calendar.GetYear(year);
            var amountOfMonths = calendar.GetMonthsInYear(currentYear);

            for (int i = 0; i < amountOfMonths; i++)
            {
                var currentMonth = i + 1;
                var daysInMonth = calendar.GetDaysInMonth(currentYear, currentMonth);

                for (int dayOfMonth = 0; dayOfMonth < daysInMonth; dayOfMonth++)
                {
                    var zmanimCalendar = new ComplexZmanimCalendar(location);
                    zmanimCalendar.DateWithLocation.Date = new DateTime(currentYear, currentMonth, dayOfMonth + 1, calendar);
                    yield return zmanimCalendar;
                }
            }
        }
Пример #7
0
        static void Main(string[] args)
        {
            string locationName = "Lakewood, NJ";
            double latitude = 40.09596; //Lakewood, NJ
            double longitude = -74.22213; //Lakewood, NJ
            double elevation = 0; //optional elevation
            ITimeZone timeZone = new OlsonTimeZone("America/New_York");
            GeoLocation location = new GeoLocation(locationName, latitude, longitude, elevation, timeZone);
            ComplexZmanimCalendar zc = new ComplexZmanimCalendar(location);

            System.Console.WriteLine("Today's Zmanim for " + locationName);
            System.Console.WriteLine("Sunrise: " + zc.GetSunrise()); //output sunrise
            System.Console.WriteLine("Sof Zman Shema MGA: " + zc.GetSofZmanShmaMGA()); //output Sof Zman Shema MGA
            System.Console.WriteLine("Sof Zman Shema GRA: " + zc.GetSofZmanShmaGRA()); //output Sof Zman Shema GRA
            System.Console.WriteLine("Sunset: " + zc.GetSunset()); //output sunset

            System.Console.WriteLine("Press enter to exit.");
            System.Console.ReadLine();
        }
Пример #8
0
        public ComplexZmanimCalendar GetCalendar()
        {
            String locationName = "Lakewood, NJ";
            double latitude = 40.09596; //Lakewood, NJ
            double longitude = -74.22213; //Lakewood, NJ
            double elevation = 0; //optional elevation
            ITimeZone timeZone = new OlsonTimeZone("America/New_York");
            GeoLocation location = new GeoLocation(locationName, latitude, longitude, elevation, timeZone);
            ComplexZmanimCalendar czc = new ComplexZmanimCalendar(new DateTime(2010, 4, 2), location);

            /*
            string locationName = "Brooklyn, NY";
            double latitude = 40.618851; //Brooklyn, NY
            double longitude = -73.985921; //Brooklyn, NY
            double elevation = 0; //optional elevation
            TimeZone timeZone = TimeZone.getTimeZone("America/New_York");
            var location = new GeoLocation(locationName, latitude, longitude, elevation, timeZone);
            var czc = new ComplexZmanimCalendar(location);
            czc.setCalendar(new GregorianCalendar(2010, 3, 2));
            */
            return czc;
        }
Пример #9
0
        ///<summary>
        ///  Calculate <a href = "http://en.wikipedia.org/wiki/Great-circle_distance">geodesic
        ///              distance</a> in Meters between this Object and a second Object passed to
        ///  this method using <a href = "http://en.wikipedia.org/wiki/Thaddeus_Vincenty">Thaddeus Vincenty's</a>
        ///  inverse formula See T Vincenty, "<a href = "http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf">Direct and Inverse
        ///                                     Solutions of Geodesics on the Ellipsoid with application of nested
        ///                                     equations</a>", Survey Review, vol XXII no 176, 1975
        ///</summary>
        ///<param name = "location">
        ///  the destination location </param>
        ///<param name = "formula">
        ///  This formula calculates initial bearing (<seealso cref = "INITIAL_BEARING" />),
        ///  final bearing (<seealso cref = "FINAL_BEARING" />) and distance (<seealso cref = "DISTANCE" />). </param>
        private double VincentyFormula(GeoLocation location, int formula)
        {
            double a = 6378137;
            double b = 6356752.3142;
            double f = 1 / 298.257223563; // WGS-84 ellipsiod
            double L = MathExtensions.ToRadians(location.Longitude - Longitude);
            double U1 = Math.Atan((1 - f) * Math.Tan(MathExtensions.ToRadians(Latitude)));
            double U2 = Math.Atan((1 - f) * Math.Tan(MathExtensions.ToRadians(location.Latitude)));
            double sinU1 = Math.Sin(U1), cosU1 = Math.Cos(U1);
            double sinU2 = Math.Sin(U2), cosU2 = Math.Cos(U2);

            double lambda     = L;
            double lambdaP    = 2 * Math.PI;
            double iterLimit  = 20;
            double sinLambda  = 0;
            double cosLambda  = 0;
            double sinSigma   = 0;
            double cosSigma   = 0;
            double sigma      = 0;
            double sinAlpha   = 0;
            double cosSqAlpha = 0;
            double cos2SigmaM = 0;
            double C;

            while (Math.Abs(lambda - lambdaP) > 1e-12 && --iterLimit > 0)
            {
                sinLambda = Math.Sin(lambda);
                cosLambda = Math.Cos(lambda);
                sinSigma  =
                    Math.Sqrt((cosU2 * sinLambda) * (cosU2 * sinLambda) +
                              (cosU1 * sinU2 - sinU1 * cosU2 * cosLambda) * (cosU1 * sinU2 - sinU1 * cosU2 * cosLambda));
                if (sinSigma == 0)
                {
                    return(0); // co-incident points
                }
                cosSigma   = sinU1 * sinU2 + cosU1 * cosU2 * cosLambda;
                sigma      = Math.Atan2(sinSigma, cosSigma);
                sinAlpha   = cosU1 * cosU2 * sinLambda / sinSigma;
                cosSqAlpha = 1 - sinAlpha * sinAlpha;
                cos2SigmaM = cosSigma - 2 * sinU1 * sinU2 / cosSqAlpha;
                if (double.IsNaN(cos2SigmaM))
                {
                    cos2SigmaM = 0; // equatorial line: cosSqAlpha=0 (§6)
                }
                C       = f / 16 * cosSqAlpha * (4 + f * (4 - 3 * cosSqAlpha));
                lambdaP = lambda;
                lambda  = L +
                          (1 - C) * f * sinAlpha *
                          (sigma + C * sinSigma * (cos2SigmaM + C * cosSigma * (-1 + 2 * cos2SigmaM * cos2SigmaM)));
            }
            if (iterLimit == 0)
            {
                return(double.NaN); // formula failed to converge
            }
            double uSq        = cosSqAlpha * (a * a - b * b) / (b * b);
            double A          = 1 + uSq / 16384 * (4096 + uSq * (-768 + uSq * (320 - 175 * uSq)));
            double B          = uSq / 1024 * (256 + uSq * (-128 + uSq * (74 - 47 * uSq)));
            double deltaSigma = B * sinSigma *
                                (cos2SigmaM +
                                 B / 4 *
                                 (cosSigma * (-1 + 2 * cos2SigmaM * cos2SigmaM) -
                                  B / 6 * cos2SigmaM * (-3 + 4 * sinSigma * sinSigma) * (-3 + 4 * cos2SigmaM * cos2SigmaM)));
            double distance = b * A * (sigma - deltaSigma);

            // initial bearing
            double fwdAz = MathExtensions.ToDegree(Math.Atan2(cosU2 * sinLambda, cosU1 * sinU2 - sinU1 * cosU2 * cosLambda));
            // final bearing
            double revAz = MathExtensions.ToDegree(Math.Atan2(cosU1 * sinLambda, -sinU1 * cosU2 + cosU1 * sinU2 * cosLambda));

            if (formula == DISTANCE)
            {
                return(distance);
            }
            else if (formula == INITIAL_BEARING)
            {
                return(fwdAz);
            }
            else if (formula == FINAL_BEARING)
            {
                return(revAz);
            } // should never happpen
            else
            {
                return(double.NaN);
            }
        }
Пример #10
0
 ///<summary>
 ///  Calculate <a href = "http://en.wikipedia.org/wiki/Great-circle_distance">geodesic
 ///              distance</a> in Meters between this Object and a second Object passed to
 ///  this method using <a href = "http://en.wikipedia.org/wiki/Thaddeus_Vincenty">Thaddeus Vincenty's</a>
 ///  inverse formula See T Vincenty, "<a href = "http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf">Direct and Inverse
 ///                                     Solutions of Geodesics on the Ellipsoid with application of nested
 ///                                     equations</a>", Survey Review, vol XXII no 176, 1975
 ///</summary>
 ///<param name = "location">
 ///  the destination location </param>
 public virtual double GetGeodesicDistance(GeoLocation location)
 {
     return(VincentyFormula(location, DISTANCE));
 }
Пример #11
0
 ///<summary>
 ///  Calculate the final <a href = "http://en.wikipedia.org/wiki/Great_circle">geodesic</a> bearing
 ///  between this Object and a second Object passed to this method using
 ///  <a href = "http://en.wikipedia.org/wiki/Thaddeus_Vincenty">Thaddeus Vincenty's</a>
 ///  inverse formula See T Vincenty, "<a href = "http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf">Direct and Inverse
 ///                                     Solutions of Geodesics on the Ellipsoid with application of nested
 ///                                     equations</a>", Survey Review, vol XXII no 176, 1975
 ///</summary>
 ///<param name = "location">
 ///  the destination location </param>
 public virtual double GetGeodesicFinalBearing(GeoLocation location)
 {
     return(VincentyFormula(location, FINAL_BEARING));
 }
Пример #12
0
 ///<summary>
 ///  Returns the <a href = "http://en.wikipedia.org/wiki/Rhumb_line">rhumb line</a>
 ///  distance from the current location to the GeoLocation passed in.
 ///</summary>
 ///<param name = "location">
 ///  the destination location </param>
 ///<returns> the distance in Meters </returns>
 public virtual double GetRhumbLineDistance(GeoLocation location)
 {
     double R = 6371; // earth's mean radius in km
     double dLat = MathExtensions.ToRadians(location.Latitude - Latitude);
     double dLon = MathExtensions.ToRadians(Math.Abs(location.Longitude - Longitude));
     double dPhi =
         Math.Log(Math.Tan(MathExtensions.ToRadians(location.Longitude) / 2 + Math.PI / 4) /
                         Math.Tan(MathExtensions.ToRadians(Latitude) / 2 + Math.PI / 4));
     double q = (Math.Abs(dLat) > 1e-10) ? dLat / dPhi : Math.Cos(MathExtensions.ToRadians(Latitude));
     // if dLon over 180° take shorter rhumb across 180° meridian:
     if (dLon > Math.PI)
         dLon = 2 * Math.PI - dLon;
     double d = Math.Sqrt(dLat * dLat + q * q * dLon * dLon);
     return d * R;
 }
Пример #13
0
 ///<summary>
 ///  Returns the <a href = "http://en.wikipedia.org/wiki/Rhumb_line">rhumb line</a>
 ///  bearing from the current location to the GeoLocation passed in.
 ///</summary>
 ///<param name = "location">
 ///  destination location </param>
 ///<returns> the bearing in degrees </returns>
 public virtual double GetRhumbLineBearing(GeoLocation location)
 {
     double dLon = MathExtensions.ToRadians(location.Longitude - Longitude);
     double dPhi =
         Math.Log(Math.Tan(MathExtensions.ToRadians(location.Latitude) / 2 + Math.PI / 4) /
                         Math.Tan(MathExtensions.ToRadians(Latitude) / 2 + Math.PI / 4));
     if (Math.Abs(dLon) > Math.PI)
         dLon = dLon > 0 ? -(2 * Math.PI - dLon) : (2 * Math.PI + dLon);
     return MathExtensions.ToDegree(Math.Atan2(dLon, dPhi));
 }
Пример #14
0
 ///<summary>
 ///  Calculate the initial <a href = "http://en.wikipedia.org/wiki/Great_circle">geodesic</a> bearing
 ///  between this Object and a second Object passed to this method using
 ///  <a href = "http://en.wikipedia.org/wiki/Thaddeus_Vincenty">Thaddeus Vincenty's</a>
 ///  inverse formula See T Vincenty, "<a href = "http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf">Direct and Inverse
 ///                                     Solutions of Geodesics on the Ellipsoid with application of nested
 ///                                     equations</a>", Survey Review, vol XXII no 176, 1975
 ///</summary>
 ///<param name = "location">
 ///  the destination location </param>
 public virtual double GetGeodesicInitialBearing(GeoLocation location)
 {
     return VincentyFormula(location, INITIAL_BEARING);
 }
Пример #15
0
 ///<summary>
 ///  Calculate the final <a href = "http://en.wikipedia.org/wiki/Great_circle">geodesic</a> bearing
 ///  between this Object and a second Object passed to this method using
 ///  <a href = "http://en.wikipedia.org/wiki/Thaddeus_Vincenty">Thaddeus Vincenty's</a>
 ///  inverse formula See T Vincenty, "<a href = "http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf">Direct and Inverse
 ///                                     Solutions of Geodesics on the Ellipsoid with application of nested
 ///                                     equations</a>", Survey Review, vol XXII no 176, 1975
 ///</summary>
 ///<param name = "location">
 ///  the destination location </param>
 public virtual double GetGeodesicFinalBearing(GeoLocation location)
 {
     return VincentyFormula(location, FINAL_BEARING);
 }
Пример #16
0
 ///<summary>
 ///  Calculate <a href = "http://en.wikipedia.org/wiki/Great-circle_distance">geodesic
 ///              distance</a> in Meters between this Object and a second Object passed to
 ///  this method using <a href = "http://en.wikipedia.org/wiki/Thaddeus_Vincenty">Thaddeus Vincenty's</a>
 ///  inverse formula See T Vincenty, "<a href = "http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf">Direct and Inverse
 ///                                     Solutions of Geodesics on the Ellipsoid with application of nested
 ///                                     equations</a>", Survey Review, vol XXII no 176, 1975
 ///</summary>
 ///<param name = "location">
 ///  the destination location </param>
 public virtual double GetGeodesicDistance(GeoLocation location)
 {
     return VincentyFormula(location, DISTANCE);
 }
Пример #17
0
 /// <summary>
 /// Calculate <a href="http://en.wikipedia.org/wiki/Great-circle_distance">geodesic
 /// distance</a> in Meters between this Object and a second Object passed to
 /// this method using <a href="http://en.wikipedia.org/wiki/Thaddeus_Vincenty">Thaddeus Vincenty's</a>
 /// inverse formula See T Vincenty, "<a href="http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf">Direct and Inverse
 /// Solutions of Geodesics on the Ellipsoid with application of nested
 /// equations</a>", Survey Review, vol XXII no 176, 1975.
 /// </summary>
 /// <param name="location">the destination location</param>
 /// <param name="destination">The destination.</param>
 /// <returns></returns>
 public static double GetGeodesicDistance(GeoLocation location, GeoLocation destination)
 {
     return VincentyFormula(location, destination, DISTANCE);
 }
Пример #18
0
        ///<summary>
        ///  Calculate <a href = "http://en.wikipedia.org/wiki/Great-circle_distance">geodesic
        ///              distance</a> in Meters between this Object and a second Object passed to
        ///  this method using <a href = "http://en.wikipedia.org/wiki/Thaddeus_Vincenty">Thaddeus Vincenty's</a>
        ///  inverse formula See T Vincenty, "<a href = "http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf">Direct and Inverse
        ///                                     Solutions of Geodesics on the Ellipsoid with application of nested
        ///                                     equations</a>", Survey Review, vol XXII no 176, 1975
        ///</summary>
        ///<param name = "location">
        ///  the destination location </param>
        ///<param name = "formula">
        ///  This formula calculates initial bearing (<seealso cref = "INITIAL_BEARING" />),
        ///  final bearing (<seealso cref = "FINAL_BEARING" />) and distance (<seealso cref = "DISTANCE" />). </param>
        private double VincentyFormula(GeoLocation location, int formula)
        {
            double a = 6378137;
            double b = 6356752.3142;
            double f = 1 / 298.257223563; // WGS-84 ellipsiod
            double L = MathExtensions.ToRadians(location.Longitude - Longitude);
            double U1 = Math.Atan((1 - f) * Math.Tan(MathExtensions.ToRadians(Latitude)));
            double U2 = Math.Atan((1 - f) * Math.Tan(MathExtensions.ToRadians(location.Latitude)));
            double sinU1 = Math.Sin(U1), cosU1 = Math.Cos(U1);
            double sinU2 = Math.Sin(U2), cosU2 = Math.Cos(U2);

            double lambda = L;
            double lambdaP = 2 * Math.PI;
            double iterLimit = 20;
            double sinLambda = 0;
            double cosLambda = 0;
            double sinSigma = 0;
            double cosSigma = 0;
            double sigma = 0;
            double sinAlpha = 0;
            double cosSqAlpha = 0;
            double cos2SigmaM = 0;
            double C;
            while (Math.Abs(lambda - lambdaP) > 1e-12 && --iterLimit > 0)
            {
                sinLambda = Math.Sin(lambda);
                cosLambda = Math.Cos(lambda);
                sinSigma =
                    Math.Sqrt((cosU2 * sinLambda) * (cosU2 * sinLambda) +
                                     (cosU1 * sinU2 - sinU1 * cosU2 * cosLambda) * (cosU1 * sinU2 - sinU1 * cosU2 * cosLambda));
                if (sinSigma == 0)
                    return 0; // co-incident points
                cosSigma = sinU1 * sinU2 + cosU1 * cosU2 * cosLambda;
                sigma = Math.Atan2(sinSigma, cosSigma);
                sinAlpha = cosU1 * cosU2 * sinLambda / sinSigma;
                cosSqAlpha = 1 - sinAlpha * sinAlpha;
                cos2SigmaM = cosSigma - 2 * sinU1 * sinU2 / cosSqAlpha;
                if (double.IsNaN(cos2SigmaM))
                    cos2SigmaM = 0; // equatorial line: cosSqAlpha=0 (§6)
                C = f / 16 * cosSqAlpha * (4 + f * (4 - 3 * cosSqAlpha));
                lambdaP = lambda;
                lambda = L +
                         (1 - C) * f * sinAlpha *
                         (sigma + C * sinSigma * (cos2SigmaM + C * cosSigma * (-1 + 2 * cos2SigmaM * cos2SigmaM)));
            }
            if (iterLimit == 0)
                return double.NaN; // formula failed to converge

            double uSq = cosSqAlpha * (a * a - b * b) / (b * b);
            double A = 1 + uSq / 16384 * (4096 + uSq * (-768 + uSq * (320 - 175 * uSq)));
            double B = uSq / 1024 * (256 + uSq * (-128 + uSq * (74 - 47 * uSq)));
            double deltaSigma = B * sinSigma *
                                (cos2SigmaM +
                                 B / 4 *
                                 (cosSigma * (-1 + 2 * cos2SigmaM * cos2SigmaM) -
                                  B / 6 * cos2SigmaM * (-3 + 4 * sinSigma * sinSigma) * (-3 + 4 * cos2SigmaM * cos2SigmaM)));
            double distance = b * A * (sigma - deltaSigma);

            // initial bearing
            double fwdAz = MathExtensions.ToDegree(Math.Atan2(cosU2 * sinLambda, cosU1 * sinU2 - sinU1 * cosU2 * cosLambda));
            // final bearing
            double revAz = MathExtensions.ToDegree(Math.Atan2(cosU1 * sinLambda, -sinU1 * cosU2 + cosU1 * sinU2 * cosLambda));
            if (formula == DISTANCE)
            {
                return distance;
            }
            else if (formula == INITIAL_BEARING)
            {
                return fwdAz;
            }
            else if (formula == FINAL_BEARING)
            {
                return revAz;
            } // should never happpen
            else
            {
                return double.NaN;
            }
        }
Пример #19
0
 /// <summary>
 /// Calculate the initial <a href="http://en.wikipedia.org/wiki/Great_circle">geodesic</a> bearing
 /// between this Object and a second Object passed to this method using <a href="http://en.wikipedia.org/wiki/Thaddeus_Vincenty">Thaddeus Vincenty's</a>
 /// inverse formula See T Vincenty, "<a href="http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf">Direct and Inverse
 /// Solutions of Geodesics on the Ellipsoid with application of nested
 /// equations</a>", Survey Review, vol XXII no 176, 1975.
 /// </summary>
 /// <param name="location">the destination location</param>
 /// <param name="destination">The destination.</param>
 /// <returns></returns>
 public static double GetGeodesicInitialBearing(GeoLocation location, GeoLocation destination)
 {
     return VincentyFormula(location, destination, INITIAL_BEARING);
 }
Пример #20
0
        public void Setup()
        {
            String locationName = "Lakewood, NJ";
            double latitude = 40.09596; //Lakewood, NJ
            double longitude = -74.22213; //Lakewood, NJ
            double elevation = 0; //optional elevation
            ITimeZone timeZone = new OlsonTimeZone("America/New_York");
            GeoLocation location = new GeoLocation(locationName, latitude, longitude, elevation, timeZone);
            ComplexZmanimCalendar czc = new ComplexZmanimCalendar(new DateTime(2010, 4, 2), location);

            calendar = czc;
        }
Пример #21
0
 ///<summary>
 ///  Calculate the initial <a href = "http://en.wikipedia.org/wiki/Great_circle">geodesic</a> bearing
 ///  between this Object and a second Object passed to this method using
 ///  <a href = "http://en.wikipedia.org/wiki/Thaddeus_Vincenty">Thaddeus Vincenty's</a>
 ///  inverse formula See T Vincenty, "<a href = "http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf">Direct and Inverse
 ///                                     Solutions of Geodesics on the Ellipsoid with application of nested
 ///                                     equations</a>", Survey Review, vol XXII no 176, 1975
 ///</summary>
 ///<param name = "location">
 ///  the destination location </param>
 public virtual double GetGeodesicInitialBearing(GeoLocation location)
 {
     return(VincentyFormula(location, INITIAL_BEARING));
 }