Class SunMoonCalculator

java.lang.Object
eu.hansolo.tilesfx.tools.SunMoonCalculator

public class SunMoonCalculator extends Object
  • Field Details

  • Constructor Details

    • SunMoonCalculator

      public SunMoonCalculator(int YEAR, int MONTH, int DAY, double LAT_DEG, double LNG_DEG) throws Exception
      Main constructor for Sun/Moon calculations. Observer angles in degrees.
      Parameters:
      YEAR - The year.
      MONTH - The month.
      DAY - The day.
      LAT_DEG - Latitude for the observer.
      LNG_DEG - Longitude for the observer.
      Throws:
      Exception - If the date does not exists.
    • SunMoonCalculator

      public SunMoonCalculator(int year, int month, int day, int h, int m, int s, double latDeg, double lngDeg) throws Exception
      Main constructor for Sun/Moon calculations. Time should be given in Universal Time (UT), observer angles in degrees.
      Parameters:
      year - The year.
      month - The month.
      day - The day.
      h - The hour.
      m - Minute.
      s - Second.
      latDeg - Latitude for the observer.
      lngDeg - Longitude for the observer.
      Throws:
      Exception - If the date does not exists.
  • Method Details

    • getDate

      public static int[] getDate(double JULIAN_DAY) throws Exception
      Transforms a Julian day (rise/set/transit fields) to a common date.
      Parameters:
      JULIAN_DAY - The Julian day.
      Returns:
      A set of integers: year, month, day, hour, minute, second.
      Throws:
      Exception - If the input date does not exists.
    • getZonedDateTime

      public static ZonedDateTime getZonedDateTime(double JULIAN_DAY, ZoneOffset ZONE_OFFSET) throws Exception
      Throws:
      Exception
    • getDateAsString

      public static String getDateAsString(double JULIAN_DAY) throws Exception
      Throws:
      Exception
    • getDateAsString

      public static String getDateAsString(double JULIAN_DAY, int TIMEZONE_OFFSET) throws Exception
      Returns a date as a string.
      Parameters:
      JULIAN_DAY - The Juliand day.
      Returns:
      The String.
      Throws:
      Exception - If the date does not exists.
    • normalizeRadians

      public static double normalizeRadians(double r)
      Reduce an angle in radians to the range (0 - 2 Pi).
      Parameters:
      r - Value in radians.
      Returns:
      The reduced radian value.
    • setTwilight

      public void setTwilight(SunMoonCalculator.TWILIGHT T)
      Sets the rise/set times to return. Default is for the local horizon.
      Parameters:
      T - The Twilight.
    • setDate

      public void setDate(LocalDate DATE) throws Exception
      Throws:
      Exception
    • setDate

      public void setDate(LocalDateTime DATE_TIME) throws Exception
      Throws:
      Exception
    • setDate

      public void setDate(int year, int month, int day) throws Exception
      Throws:
      Exception
    • setDate

      public void setDate(int year, int month, int day, int h, int m, int s) throws Exception
      Throws:
      Exception
    • calcSunAndMoon

      public void calcSunAndMoon()
      Calculates everything for the Sun and the Moon.
    • getMoonDiskOrientationAngles

      public double[] getMoonDiskOrientationAngles()
    • calcEphemeris

      public void calcEphemeris(ZoneId ZONE_ID)
    • getSunrise

      public ZonedDateTime getSunrise()
    • getSunset

      public ZonedDateTime getSunset()
    • getSunriseGoldenHour

      public ZonedDateTime getSunriseGoldenHour()
    • getSunsetGoldenHour

      public ZonedDateTime getSunsetGoldenHour()
    • getSunriseCivil

      public ZonedDateTime getSunriseCivil()
    • getSunsetCivil

      public ZonedDateTime getSunsetCivil()
    • getSunriseBlueHour

      public ZonedDateTime getSunriseBlueHour()
    • getSunsetBlueHour

      public ZonedDateTime getSunsetBlueHour()