astro
Class SunPosition

java.lang.Object
  extended by astro.SunPosition
All Implemented Interfaces:
SolarPosition

public class SunPosition
extends Object
implements SolarPosition

A class calculating the position of the moon. It is based on the AstroLib package provided by Mark Huss. He gives no hint about the precision of the formulas used, but from a first test I estimate an accuracy of down to one arc minute.


Nested Class Summary
static class SunPosition.Test
          Testing purpose mainly.
 
Nested classes/interfaces inherited from interface astro.SolarPosition
SolarPosition.Plato
 
Field Summary
private static double ASUN
          The constant coefficient.
private static double BSUN
          The linear coefficient.
private  Date when
          The date for which the sun position is valid.
 
Constructor Summary
SunPosition()
          Constructs a new moon position object.
SunPosition(Date fordate)
          Constructs a new moon position object for the given date.
 
Method Summary
 double getDec()
          Returns the declination of the moon for the center of the earth in radians.
 double getDistance()
           
 double getEclipticalLongitude()
          Returns the ecliptical longitude of the Sun for the center of the earth in radians.
 double getRa()
          Returns the right ascension of the moon for the center of the earth in radians.
 void setDate(Date fordate)
          Sets a (new) date for the moon position object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ASUN

private static final double ASUN
The constant coefficient.

See Also:
Constant Field Values

BSUN

private static final double BSUN
The linear coefficient.

See Also:
Constant Field Values

when

private Date when
The date for which the sun position is valid.

Constructor Detail

SunPosition

public SunPosition()
Constructs a new moon position object. The position data may only be retrieved after a date was set.


SunPosition

public SunPosition(Date fordate)
Constructs a new moon position object for the given date. Data retrieval may proceed at once.

Method Detail

setDate

public void setDate(Date fordate)
Sets a (new) date for the moon position object. Right ascension and declination are invalidated.

Specified by:
setDate in interface SolarPosition

getEclipticalLongitude

public double getEclipticalLongitude()
Returns the ecliptical longitude of the Sun for the center of the earth in radians.

Specified by:
getEclipticalLongitude in interface SolarPosition
Throws:
IllegalArgumentException - If no date was set.

getDistance

public double getDistance()

getRa

public double getRa()
Returns the right ascension of the moon for the center of the earth in radians.

Specified by:
getRa in interface SolarPosition
Throws:
IllegalArgumentException - If no date was set.

getDec

public double getDec()
Returns the declination of the moon for the center of the earth in radians.

Specified by:
getDec in interface SolarPosition
Throws:
IllegalArgumentException - If no date was set.