JEphem site
tig API
Build classes

jephem.astro.spacetime
Class Units

java.lang.Object
  |
  +--jephem.astro.spacetime.Units
All Implemented Interfaces:
GeneralConstants, SolarSystemConstants, SpaceConstants, UnitsConstants

public abstract class Units
extends java.lang.Object
implements GeneralConstants, SolarSystemConstants, SpaceConstants, UnitsConstants

Contains methods to format and transform units and coordinates.
Realted constants are located in UnitsConstants
Methods of this class permit to get labels associated with coordinates. They are normally retrieved from 'properties' files, for internationalization ; if a problem occurs, hard coded English labels are used.


Field Summary
 
Fields inherited from interface tig.GeneralConstants
BLANK, FS, LS, NO_SPECIF, SPACE
 
Fields inherited from interface jephem.astro.solarsystem.SolarSystemConstants
E0_1900, E0_1950, E0_2000, EARTH, JUPITER, KM_PER_AU, MARS, MERCURY, MOON, NB_BODIES, NEPTUNE, PLUTO, SATURN, SIDERAL_RATE, SUN, URANUS, VENUS
 
Fields inherited from interface jephem.astro.spacetime.SpaceConstants
CARTESIAN, COORD_V0, COORD_V1, COORD_V2, COORD_X0, COORD_X1, COORD_X2, COORDGROUP_DELTA_BETA_LAMBDA, COORDGROUP_DIST_ALPHA_DELTA, COORDGROUP_RLB, COORDGROUP_XYZ, FRAME_EC_HELIO_GEOMETRIC, FRAME_ECLIPTIC, FRAME_EQUATORIAL, FRAME_GALACTIC, FRAME_HORIZONTAL_TOPOCENTRIC, FRAME_THEORY, LIGHT_VELOCITY, NB_COORDS, SPHERICAL
 
Fields inherited from interface jephem.astro.spacetime.UnitsConstants
ANGULAR_SPEED_UNIT_ARCSEC_PER_DAY, ANGULAR_SPEED_UNIT_ARCSEC_PER_S, ANGULAR_SPEED_UNIT_DEG_PER_DAY, ANGULAR_SPEED_UNIT_DEG_PER_S, ANGULAR_SPEED_UNIT_RAD_PER_DAY, ANGULAR_UNIT_ARCSEC, ANGULAR_UNIT_DEG, ANGULAR_UNIT_RAD, BASE_ANGULAR_SPEED_UNIT, BASE_ANGULAR_UNIT, BASE_DISTANCE_UNIT, BASE_LINEAR_SPEED_UNIT, DEGREES_DECIMAL, DEGREES_DMS, DELTA_BETWEEN_BASES, DISTANCE_UNIT_AU, DISTANCE_UNIT_KM, DISTANCE_UNIT_M, LINEAR_SPEED_UNIT_AU_PER_D, LINEAR_SPEED_UNIT_KM_PER_D, LINEAR_SPEED_UNIT_KM_PER_HOUR, LINEAR_SPEED_UNIT_M_PER_S, TYPE_ANGULAR, TYPE_ANGULAR_SPEED, TYPE_DISTANCE, TYPE_LINEAR_SPEED, UNITGROUP_AU_AU_AU, UNITGROUP_AU_DEG_DEG, UNITGROUP_AU_RAD_RAD, UNITGROUP_AUD_AUD_AUD, UNITGROUP_KM_KM_KM
 
Constructor Summary
Units()
           
 
Method Summary
static double[] convertUnits(double[] coords, int[] units1, int[] units2)
          Converts coordinates expressed with 'units1' to coordinates expressed with 'units2'.
static Vector3 convertUnits(Vector3 coords, int[] units1, int[] units2)
          Method equivalent to convertUnits(double[],int[],int[]), using Vector3 instead of double.
static java.lang.String getUnitLabel(int unit)
          Returns the English label of a unit.
static java.lang.String[] getUnitLabels(int unitType)
          Returns the English labels of units of a certain type.
static int[] getUnits(int unitType)
          Returns the constants expressing the units of a certain type.
static int getUnitType(int coordExpr, int whichCoord)
          Returns the type of unit depending on coordinate expression (spherical / cartesian) and the concerned coordinate (X0, X1, X2, V0, V1, V2).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Units

public Units()
Method Detail

convertUnits

public static double[] convertUnits(double[] coords,
                                    int[] units1,
                                    int[] units2)
Converts coordinates expressed with 'units1' to coordinates expressed with 'units2'.

Parameters:
coords - The coordinates to convert, expressed with 'units1'.
units1 - The units used to express 'coords'.
units2 - The units used to express the returned coordinates.
Returns:
The coordinates expressed with 'units2'.
Throws:
java.lang.IllegalArgumentException - if :
1 - the sizes of arrays 'units1' and 'units2' are different from the size of 'coords'.
2 - an attempt is made to perform a transformation between units of different types (if each elements of 'units1' is not coherent with the corresponding element of 'units2' - for example converting from an angular unit to a linear unit).

convertUnits

public static Vector3 convertUnits(Vector3 coords,
                                   int[] units1,
                                   int[] units2)
Method equivalent to convertUnits(double[],int[],int[]), using Vector3 instead of double.


getUnitLabel

public static java.lang.String getUnitLabel(int unit)
Returns the English label of a unit.
The returned array matches the array returned by getUnits(int).


getUnitLabels

public static java.lang.String[] getUnitLabels(int unitType)
Returns the English labels of units of a certain type.


getUnits

public static int[] getUnits(int unitType)
Returns the constants expressing the units of a certain type.
The returned array matches the array returned by getUnitLabels(int).


getUnitType

public static int getUnitType(int coordExpr,
                              int whichCoord)
Returns the type of unit depending on coordinate expression (spherical / cartesian) and the concerned coordinate (X0, X1, X2, V0, V1, V2).
Ex : getUnitType(SPHERICAL, COORD_X0) returns TYPE_DISTANCE.

Parameters:
coordExpr - Coordinate expression (use SpaceConstants.SPHERICAL or SpaceConstants.CARTESIAN).
whichCoord - The concerned coordinate (use SpaceConstants.COORD_XX constants).

JEphem site
tig API
Build classes