Class Lunar
- java.lang.Object
-
- com.mhuss.AstroLib.Lunar
-
public class Lunar extends java.lang.ObjectA class that can calculate lunar fundmentals for any reasonable time.Based on C code by Bill Gray (www.projectpluto.com)
This class calculates Lunar fundamentals, and also contains some functions which depend on these fundimentals, including latitude, longitude & distance, phase angle and illuminated fraction.
The lunar fundamentals must be calculated before calling most of the functions in this class.
-
-
Field Summary
Fields Modifier and Type Field and Description static intFULLphase constantstatic intNEWphase constantstatic intQ1phase constantstatic intQ3phase constant
-
Constructor Summary
Constructors Constructor and Description Lunar()Default constructorLunar(double t)Date/time constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidcalcAllLEs(LocationElements locs, double t)Calculate the fundamentals and then all three location elements for the given time.voidcalcFundamentals(double t)Calculates the lunar fundamanentals for a given time.doublegetLatitude()Calculate the latitude in degrees.doublegetLatitudeRadians()Calculate the lunar latitude in radians.doublegetLongitude()Calculate the lunar longitude in degrees.doublegetLongitudeRadians()Calculate the lunar longitude in radians.static doublegetPhase(long jd, int quarter)Calculate the time of the quarter nearest the given Julian day.static doublegetPhase(long jd, int quarter, java.util.Calendar cal)Calculate the time of the quarter nearest the given Julian day.doublegetRadius()Calculate the lunar radius (distance).doubleilluminatedFraction()Calculate the illuminated fraction.static voidmain(java.lang.String[] args)(for unit testing only)doublephaseAngle()Calculate the phase angle in radians.
-
-
-
Field Detail
-
NEW
public static final int NEW
phase constant- See Also:
- Constant Field Values
-
Q1
public static final int Q1
phase constant- See Also:
- Constant Field Values
-
FULL
public static final int FULL
phase constant- See Also:
- Constant Field Values
-
Q3
public static final int Q3
phase constant- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Lunar
public Lunar()
Default constructor
-
Lunar
public Lunar(double t)
Date/time constructor. This constructor uses the time provided to calculate the lunar fundamentals.- Parameters:
t- Time in Julian centuries ref J2000
-
-
Method Detail
-
calcFundamentals
public void calcFundamentals(double t)
Calculates the lunar fundamanentals for a given time.- Parameters:
t- Time in Julian centuries referenced to J2000
-
phaseAngle
public double phaseAngle() throws NoInitExceptionCalculate the phase angle in radians.
(Using Meeus' easy lower precision method).NOTE: The lunar fundamentals must be calculated before calling this function or a
NoInitExceptionwill be thrown.- Returns:
- The current phase angle in radians
- Throws:
NoInitException
-
illuminatedFraction
public double illuminatedFraction() throws NoInitExceptionCalculate the illuminated fraction.NOTE: The lunar fundamentals must be calculated before calling this function or a
NoInitExceptionwill be thrown.- Returns:
- The current illuminated fraction (0.0 to 1.0)
- Throws:
NoInitException
-
getPhase
public static double getPhase(long jd, int quarter, java.util.Calendar cal)Calculate the time of the quarter nearest the given Julian day.- Parameters:
jd- A Julian day close to the expected datequarter- (Lunar.NEW, Q1, FULL, or Q3)cal- Calendar to use for time zone adjustment; if null no time zone adjustment is performed- Returns:
- The relatively exact Julian day with decimal
-
getPhase
public static double getPhase(long jd, int quarter)Calculate the time of the quarter nearest the given Julian day.- Parameters:
jd- A Julian day close to the expected datequarter- (Lunar.NEW, Q1, FULL, or Q3)- Returns:
- The relatively exact Julian day with decimal
-
getLatitude
public double getLatitude() throws NoInitExceptionCalculate the latitude in degrees.NOTE: The lunar fundamentals must be calculated before calling this function or a
NoInitExceptionwill be thrown.- Returns:
- The latitude in degrees
- Throws:
NoInitException
-
getLatitudeRadians
public double getLatitudeRadians() throws NoInitExceptionCalculate the lunar latitude in radians.NOTE: The lunar fundamentals must be calculated before calling this function or a
NoInitExceptionwill be thrown.- Returns:
- The lunar latitude in radians
- Throws:
NoInitException
-
getLongitude
public double getLongitude() throws NoInitExceptionCalculate the lunar longitude in degrees.NOTE: The lunar fundamentals must be calculated before calling this function or a
NoInitExceptionwill be thrown.- Returns:
- The lunar longitude in degrees
- Throws:
NoInitException
-
getLongitudeRadians
public double getLongitudeRadians() throws NoInitExceptionCalculate the lunar longitude in radians.NOTE: The lunar fundamentals must be calculated before calling this function or a
NoInitExceptionwill be thrown.- Returns:
- The lunar longitude in radians
- Throws:
NoInitException
-
getRadius
public double getRadius() throws NoInitExceptionCalculate the lunar radius (distance).NOTE: The lunar fundamentals must be calculated before calling this function or a
NoInitExceptionwill be thrown.- Returns:
- The lunar radius
- Throws:
NoInitException
-
calcAllLEs
public void calcAllLEs(LocationElements locs, double t) throws NoInitException
Calculate the fundamentals and then all three location elements for the given time. This function calls callFundamentals().- Parameters:
locs- Where the calculated LEs got- time in decimal centuries- Throws:
NoInitException
-
main
public static void main(java.lang.String[] args)
(for unit testing only)
-
-
DMelt 3.0 © DataMelt by jWork.ORG