mhuss utils 1.1.5ws

com.mhuss.AstroLib
Class Lunar

java.lang.Object
  extended by com.mhuss.AstroLib.Lunar

public class Lunar
extends java.lang.Object

A 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
static int FULL
          phase constant
static int NEW
          phase constant
static int Q1
          phase constant
static int Q3
          phase constant
 
Constructor Summary
Lunar()
          Default constructor
Lunar(double t)
          Date/time constructor.
 
Method Summary
 void calcAllLEs(LocationElements locs, double t)
          Calculate the fundamentals and then all three location elements for the given time.
 void calcFundamentals(double t)
          Calculates the lunar fundamanentals for a given time.
 double getLatitude()
          Calculate the latitude in degrees.
 double getLatitudeRadians()
          Calculate the lunar latitude in radians.
 double getLongitude()
          Calculate the lunar longitude in degrees.
 double getLongitudeRadians()
          Calculate the lunar longitude in radians.
static double getPhase(long jd, int quarter)
          Calculate the time of the quarter nearest the given Julian day.
static double getPhase(long jd, int quarter, java.util.Calendar cal)
          Calculate the time of the quarter nearest the given Julian day.
 double getRadius()
          Calculate the lunar radius (distance).
 double illuminatedFraction()
          Calculate the illuminated fraction.
static void main(java.lang.String[] args)
          (for unit testing only)
 double phaseAngle()
          Calculate the phase angle in radians.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 NoInitException
Calculate the phase angle in radians.
(Using Meeus' easy lower precision method).

NOTE: The lunar fundamentals must be calculated before calling this function or a NoInitException will be thrown.

Returns:
The current phase angle in radians
Throws:
NoInitException

illuminatedFraction

public double illuminatedFraction()
                           throws NoInitException
Calculate the illuminated fraction.

NOTE: The lunar fundamentals must be calculated before calling this function or a NoInitException will 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 date
quarter - (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 date
quarter - (Lunar.NEW, Q1, FULL, or Q3)
Returns:
The relatively exact Julian day with decimal

getLatitude

public double getLatitude()
                   throws NoInitException
Calculate the latitude in degrees.

NOTE: The lunar fundamentals must be calculated before calling this function or a NoInitException will be thrown.

Returns:
The latitude in degrees
Throws:
NoInitException

getLatitudeRadians

public double getLatitudeRadians()
                          throws NoInitException
Calculate the lunar latitude in radians.

NOTE: The lunar fundamentals must be calculated before calling this function or a NoInitException will be thrown.

Returns:
The lunar latitude in radians
Throws:
NoInitException

getLongitude

public double getLongitude()
                    throws NoInitException
Calculate the lunar longitude in degrees.

NOTE: The lunar fundamentals must be calculated before calling this function or a NoInitException will be thrown.

Returns:
The lunar longitude in degrees
Throws:
NoInitException

getLongitudeRadians

public double getLongitudeRadians()
                           throws NoInitException
Calculate the lunar longitude in radians.

NOTE: The lunar fundamentals must be calculated before calling this function or a NoInitException will be thrown.

Returns:
The lunar longitude in radians
Throws:
NoInitException

getRadius

public double getRadius()
                 throws NoInitException
Calculate the lunar radius (distance).

NOTE: The lunar fundamentals must be calculated before calling this function or a NoInitException will 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 go
t - time in decimal centuries
Throws:
NoInitException

main

public static void main(java.lang.String[] args)
(for unit testing only)


mhuss utils 1.1.5ws

bottom text