Class MoonIllumination

java.lang.Object
org.shredzone.commons.suncalc.MoonIllumination

public class MoonIllumination extends Object
Calculates the illumination of the moon.

Starting with v3.9, a geolocation can be set optionally. If set, the results will be topocentric, relative to the given location. If not set, the result is geocentric, which was the standard behavior before v3.9.

  • Method Details

    • compute

      Starts the computation of MoonIllumination.
      Returns:
      MoonIllumination.Parameters to set.
    • getFraction

      public double getFraction()
      Illuminated fraction. 0.0 indicates new moon, 1.0 indicates full moon.
    • getPhase

      public double getPhase()
      Moon phase. Starts at -180.0 (new moon, waxing), passes 0.0 (full moon) and moves toward 180.0 (waning, new moon).

      Note that for historical reasons, the range of this phase is different to the moon phase angle used in MoonPhase.

    • getAngle

      public double getAngle()
      The angle of the moon illumination relative to earth. The moon is waxing if the angle is negative, and waning if positive.

      By subtracting MoonPosition.getParallacticAngle() from getAngle(), one can get the zenith angle of the moons bright limb (anticlockwise). The zenith angle can be used do draw the moon shape from the observer's perspective (e.g. the moon lying on its back).

    • getClosestPhase

      The closest MoonPhase.Phase that is matching the moon's angle.
      Returns:
      Closest MoonPhase.Phase
      Since:
      3.5
    • getElongation

      public double getElongation()
      The elongation, which is the angular distance between the moon and the sun as observed from a specific location on earth.
      Returns:
      Elongation between moon and sun, in degrees.
      Since:
      3.9
    • getRadius

      public double getRadius()
      The radius of the moon disk, as observed from a specific location on earth.
      Returns:
      Moon radius, in degrees.
      Since:
      3.9
    • getCrescentWidth

      public double getCrescentWidth()
      The width of the moon crescent, as observed from a specific location on earth.
      Returns:
      Crescent width, in degrees.
      Since:
      3.9
    • toString

      public String toString()
      Overrides:
      toString in class Object