astro
Class Position

java.lang.Object
  extended by astro.Position

public class Position
extends Object

A class defining a position in the sky via right ascension and declination. All angles are in radians if not stated otherwise.


Field Summary
private  double decrad
          The declination in radians.
private  double rarad
          The right ascension in radians.
 
Constructor Summary
protected Position()
          Constructs a new position object.
 
Method Summary
static Position fromDegrees(double rad, double ded)
          Creates a new position with ra and dec specified in degress.
static Position fromHourAndDegree(double rah, double ded)
          Creates a new position with ra in hours and dec in degrees.
static Position fromHourAndDegreeString(String ras, String des)
          Creates a new position with ra in dec specified as a string.
static Position fromRadians(double rar, double der)
          Creates a new position with ra and dec specified in radians.
 double getDec()
          Returns the declination in radians.
 double getRa()
          Returns the right ascension in radians.
protected  void setDec(double de)
          Sets the declination.
protected  void setRa(double ra)
          Sets the right ascension.
 String toString()
          Returns a string-description of the position.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

rarad

private double rarad
The right ascension in radians.


decrad

private double decrad
The declination in radians.

Constructor Detail

Position

protected Position()
Constructs a new position object. Ra and dec are loaded with NaN, indicating an invalid position.

Method Detail

getRa

public double getRa()
Returns the right ascension in radians. If the value was not set, i.e. if the position is invalid, NaN is returned.


getDec

public double getDec()
Returns the declination in radians. If the value was not set, i.e. if the position is invalid, NaN is returned.


fromRadians

public static Position fromRadians(double rar,
                                   double der)
Creates a new position with ra and dec specified in radians.


fromDegrees

public static Position fromDegrees(double rad,
                                   double ded)
Creates a new position with ra and dec specified in degress.


fromHourAndDegree

public static Position fromHourAndDegree(double rah,
                                         double ded)
Creates a new position with ra in hours and dec in degrees.


fromHourAndDegreeString

public static Position fromHourAndDegreeString(String ras,
                                               String des)
Creates a new position with ra in dec specified as a string. The format of the ra-string is ##h##m##.#s, the format of the dec string is ##d##'##.#"


setRa

protected void setRa(double ra)
Sets the right ascension. The argument is confined to 2*PI.

Parameters:
ra - The right ascension in radians.

setDec

protected void setDec(double de)
Sets the declination. The argument is confined to +/-PI. That means, specifying a declination of PI+positive results in a declination of -PI+positive.

Parameters:
dec - The declination in radians.

toString

public String toString()
Returns a string-description of the position. Output is in radians.

Overrides:
toString in class Object