jsky.science
Class CoordinatesOffset

java.lang.Object
  extended by jsky.science.CoordinatesOffset
All Implemented Interfaces:
java.io.Serializable

public class CoordinatesOffset
extends java.lang.Object
implements java.io.Serializable

The difference between two coordinates in the World Coordinate System. This change is represented by a delta right-ascension and delta declination in degrees.

This code was developed by NASA, Goddard Space Flight Center, Code 588 for the Scientist's Expert Assistant (SEA) project.

Version:
06/23/99
Author:
J. Jones / 588
See Also:
Serialized Form

Field Summary
static int NUM_DECIMAL
          Number of decimal places to show when displaying as string
 
Constructor Summary
CoordinatesOffset()
          Constructs and initializes an offset of 0, 0 degrees.
CoordinatesOffset(CoordinatesOffset co)
          Constructs and initializes an offset with the same values as the specified CoordinatesOffset object.
CoordinatesOffset(double ra, double dec)
          Constructs and initializes an offset with the specified values in degrees.
CoordinatesOffset(double ra, double dec, java.lang.String units)
          Constructs and initializes an offset with the specified values in specified units
 
Method Summary
 CoordinatesOffset add(CoordinatesOffset delta)
          Adds another offset to the offset and returns a new offset which is the sum of the two.
 boolean equals(java.lang.Object obj)
          Determines whether two offsets are equal.
 double getDec()
          Returns the declination offset in degrees.
 double getDec(java.lang.String units)
          Returns the declination offset in specified units
 double getRa()
          Returns the right-ascension offset in degrees.
 double getRa(java.lang.String units)
          Returns the right-ascension offset in specified units
 void rotate(double angleRad)
          Rotates the position angleRad radians about a specified center position (ra, dec).
 void set(double ra, double dec)
          Sets the offset values.
 CoordinatesOffset subtract(CoordinatesOffset delta)
          Subtracts another offset from the offset and returns a new offset which is the difference of the two.
 java.lang.String toString()
          Returns a string representation of this offset's values.
 void translate(double dra, double ddec)
          Translates the offset values such that ra = ra + dra and dec = dec + ddec (degrees).
static double validateRa(double ra)
          Unlike Coordinates, CoordinatesOffsets can have a negative right ascension The reason is CoordinateOffsets represent deltas (+/-) to a Coordinate.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NUM_DECIMAL

public static final int NUM_DECIMAL
Number of decimal places to show when displaying as string

See Also:
Constant Field Values
Constructor Detail

CoordinatesOffset

public CoordinatesOffset()
Constructs and initializes an offset of 0, 0 degrees.


CoordinatesOffset

public CoordinatesOffset(CoordinatesOffset co)
Constructs and initializes an offset with the same values as the specified CoordinatesOffset object.


CoordinatesOffset

public CoordinatesOffset(double ra,
                         double dec)
Constructs and initializes an offset with the specified values in degrees.

Parameters:
ra - the right-ascension
dec - the declination

CoordinatesOffset

public CoordinatesOffset(double ra,
                         double dec,
                         java.lang.String units)
Constructs and initializes an offset with the specified values in specified units

Parameters:
ra - the right-ascension
dec - the declination
units - the source units of the ra and dec
Method Detail

getRa

public double getRa()
Returns the right-ascension offset in degrees.


getDec

public double getDec()
Returns the declination offset in degrees.


getRa

public double getRa(java.lang.String units)
Returns the right-ascension offset in specified units


getDec

public double getDec(java.lang.String units)
Returns the declination offset in specified units


set

public void set(double ra,
                double dec)
Sets the offset values. Values are in degrees.


validateRa

public static final double validateRa(double ra)
Unlike Coordinates, CoordinatesOffsets can have a negative right ascension The reason is CoordinateOffsets represent deltas (+/-) to a Coordinate. When the CoordinateOffsets is added to the Coordinate then the proper result happens.

Parameters:
ra - a right-ascension of a position in degrees
Returns:
a validated +/- right-ascension of the position in degrees.

translate

public void translate(double dra,
                      double ddec)
Translates the offset values such that ra = ra + dra and dec = dec + ddec (degrees).


add

public CoordinatesOffset add(CoordinatesOffset delta)
Adds another offset to the offset and returns a new offset which is the sum of the two.

Parameters:
delta - add this amount to the offset
Returns:
new offset that is the sum of the two offsets

subtract

public CoordinatesOffset subtract(CoordinatesOffset delta)
Subtracts another offset from the offset and returns a new offset which is the difference of the two.

Parameters:
delta - subtract this amount to the offset
Returns:
new offset that is the difference of the two offsets

rotate

public void rotate(double angleRad)
Rotates the position angleRad radians about a specified center position (ra, dec).

Parameters:
angleRad - rotation angle in radians about center point 0,0

equals

public boolean equals(java.lang.Object obj)
Determines whether two offsets are equal. Two instances of CoordinatesOffset are equal if the values of their ra and dec member fields, representing their offset values in the coordinate system, are equal.

Overrides:
equals in class java.lang.Object
Parameters:
obj - an object to be compared with this point.
Returns:
true if the object to be compared is an instance of CoordinatesOffset and has the same values; false otherwise.

toString

public java.lang.String toString()
Returns a string representation of this offset's values.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this offset's values