Package gaiasky.util.coord
Class Coordinates
java.lang.Object
gaiasky.util.coord.Coordinates
public class Coordinates
extends java.lang.Object
Provides utility coordinate conversions between some astronomical coordinate
systems and to Cartesian coordinates. All angles are in radians.
-
Field Summary
Fields Modifier and Type Field Description static double
OBLIQUITY_ARCSEC_J2000
Obliquity of ecliptic in J2000 in arcsecstatic double
OBLIQUITY_DEG_J2000
Obliquity for low precision calculations in degrees and radians.static double
OBLIQUITY_RAD_J2000
-
Constructor Summary
Constructors Constructor Description Coordinates()
-
Method Summary
Modifier and Type Method Description static Vector3b
cartesianToSpherical(Vector3b vec, Vector3b out)
Converts from Cartesian coordinates to spherical coordinates.static Vector3d
cartesianToSpherical(Vector3b vec, Vector3d out)
Converts from Cartesian coordinates to spherical coordinates.static Vector3d
cartesianToSpherical(Vector3d vec, Vector3d out)
Converts from Cartesian coordinates to spherical coordinates.static Matrix4d
eclipticToEquatorial()
static Matrix4d
eclipticToEquatorial(double jd)
static Vector2d
eclipticToEquatorial(double lambda, double beta, Vector2d out)
Transforms from ecliptic to equatorial coordinatesstatic Vector2d
eclipticToEquatorial(Vector2d vec, Vector2d out)
Transforms from ecliptic to equatorial coordinatesstatic com.badlogic.gdx.math.Matrix4
eclipticToEquatorialF()
static Matrix4d
eclipticToGalactic()
static com.badlogic.gdx.math.Matrix4
eclipticToGalacticF()
static Matrix4d
eclToEq()
Gets the rotation matrix to transform equatorial to the ecliptic coordinates.static Matrix4d
eclToEq(double julianDate)
Gets the rotation matrix to transform from the ecliptic system to the equatorial system.static com.badlogic.gdx.math.Matrix4
eclToEqF()
static Matrix4d
eqToEcl()
Gets the rotation matrix to transform from the ecliptic system to the equatorial system.static Matrix4d
eqToEcl(double julianDate)
Gets the rotation matrix to transform equatorial to the ecliptic coordinates.static com.badlogic.gdx.math.Matrix4
eqToEclF()
static Matrix4d
eqToGal()
Gets the rotation matrix to transform equatorial to galactic coordinates.static com.badlogic.gdx.math.Matrix4
eqToGalF()
static Matrix4d
equatorialToEcliptic()
static Matrix4d
equatorialToEcliptic(double jd)
static com.badlogic.gdx.math.Matrix4
equatorialToEclipticF()
static Matrix4d
equatorialToGalactic()
static com.badlogic.gdx.math.Matrix4
equatorialToGalacticF()
static Matrix4d
galacticToEcliptic()
static com.badlogic.gdx.math.Matrix4
galacticToEclipticF()
static Matrix4d
galacticToEquatorial()
static com.badlogic.gdx.math.Matrix4
galacticToEquatorialF()
static Matrix4d
galToEq()
Gets the rotation matrix to transform from the galactic system to the equatorial system.static com.badlogic.gdx.math.Matrix4
galToEqF()
static Matrix4d
getRotationMatrix(double alpha, double beta, double gamma)
Gets the rotation matrix to apply for the given Euler angles α, β and γ.static Matrix4d
getTransformD(java.lang.String name)
static com.badlogic.gdx.math.Matrix4
getTransformF(java.lang.String name)
static Vector3d
sphericalToCartesian(double longitude, double latitude, double radius, Vector3d out)
Converts from spherical to Cartesian coordinates, given a longitude (α), a latitude (δ) and the radius.static Vector3b
sphericalToCartesian(double longitude, double latitude, org.apfloat.Apfloat radius, Vector3b out)
static Vector3b
sphericalToCartesian(Vector3b vec, Vector3b out)
static Vector3d
sphericalToCartesian(Vector3d vec, Vector3d out)
Converts from spherical to Cartesian coordinates, given a longitude (α), a latitude (δ) and the radius.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
OBLIQUITY_DEG_J2000
public static final double OBLIQUITY_DEG_J2000Obliquity for low precision calculations in degrees and radians. J2000 with T=0- See Also:
- Constant Field Values
-
OBLIQUITY_RAD_J2000
public static final double OBLIQUITY_RAD_J2000 -
OBLIQUITY_ARCSEC_J2000
public static final double OBLIQUITY_ARCSEC_J2000Obliquity of ecliptic in J2000 in arcsec- See Also:
- Constant Field Values
-
-
Constructor Details
-
Coordinates
public Coordinates()
-
-
Method Details
-
getRotationMatrix
Gets the rotation matrix to apply for the given Euler angles α, β and γ. It applies Ry(γ)*Rz(β)*Ry(α), so that it rotates the fixed xyz system to make it coincide with the XYZ, where α is the angle between the axis z and the line of nodes N, β is the angle between the y axis and the Y axis, and γ is the angle between the Z axis and the line of nodes N.
The assumed reference system is as follows:- ZX is the fundamental plane.
- Z points to the origin of the reference plane (the line of nodes N).
- Y points upwards.
- Parameters:
alpha
- The α angle in degrees, between z and N.beta
- The β angle in degrees, between y and Y.gamma
- The γ angle in degrees, Z and N.- Returns:
- The rotation matrix.
-
eclToEq
Gets the rotation matrix to transform equatorial to the ecliptic coordinates. Since the zero point in both systems is the same (the vernal equinox, γ, defined as the intersection between the equator and the ecliptic), α and γ are zero. β, the angle between the up directions of both systems, is precisely the obliquity of the ecliptic, ε. So we have the Euler angles α=0°, β=ε;, γ=0°.- Returns:
- The matrix to transform from equatorial coordinates to ecliptic coordinates.
-
eclipticToEquatorial
-
eclToEqF
public static com.badlogic.gdx.math.Matrix4 eclToEqF() -
eclipticToEquatorialF
public static com.badlogic.gdx.math.Matrix4 eclipticToEquatorialF() -
eclToEq
Gets the rotation matrix to transform from the ecliptic system to the equatorial system. SeeequatorialToEcliptic()
for more information, for this is the inverse transformation.- Returns:
- The transformation matrix.
-
eclipticToEquatorial
-
eqToEcl
Gets the rotation matrix to transform from the ecliptic system to the equatorial system. SeeeclToEq()
for more information, for this is the inverse transformation.- Returns:
- The transformation matrix.
-
equatorialToEcliptic
-
eqToEclF
public static com.badlogic.gdx.math.Matrix4 eqToEclF() -
equatorialToEclipticF
public static com.badlogic.gdx.math.Matrix4 equatorialToEclipticF() -
eqToEcl
Gets the rotation matrix to transform equatorial to the ecliptic coordinates. Since the zero point in both systems is the same (the vernal equinox, γ, defined as the intersection between the equator and the ecliptic), α and γ are zero. β, the angle between the up directions of both systems, is precisely the obliquity of the ecliptic, ε. So we have the Euler angles α=0°, β=ε;, γ=0°.- Returns:
- The matrix to transform from equatorial coordinates to ecliptic coordinates.
-
equatorialToEcliptic
-
galToEq
Gets the rotation matrix to transform from the galactic system to the equatorial system. SeegalToEq()
for more information, since this is the inverse transformation. Use this matrix if you need to convert equatorial cartesian coordinates to galactic cartesian coordinates.- Returns:
- The transformation matrix.
-
galacticToEquatorial
-
galToEqF
public static com.badlogic.gdx.math.Matrix4 galToEqF() -
galacticToEquatorialF
public static com.badlogic.gdx.math.Matrix4 galacticToEquatorialF() -
eqToGal
Gets the rotation matrix to transform equatorial to galactic coordinates. The inclination of the galactic equator to the celestial equator is 62.9°. The intersection, or node line, of the two equators is at RA=282.25° DEC=0° and l=33° b=0°. So we have the Euler angles α=-33°, β=62.9°, γ=282.25°.- Returns:
- The transformation matrix.
-
equatorialToGalactic
-
eqToGalF
public static com.badlogic.gdx.math.Matrix4 eqToGalF() -
equatorialToGalacticF
public static com.badlogic.gdx.math.Matrix4 equatorialToGalacticF() -
eclipticToEquatorial
Transforms from ecliptic to equatorial coordinates- Parameters:
vec
- Vector with ecliptic longitude (λ) and ecliptic latitude (β) in radians.out
- The output vector.- Returns:
- The output vector with ra (α) and dec (δ) in radians, for chaining.
-
eclipticToEquatorial
Transforms from ecliptic to equatorial coordinates- Parameters:
lambda
- Ecliptic longitude (λ) in radians.beta
- Ecliptic latitude (β) in radians.out
- The output vector.- Returns:
- The output vector with ra (α) and dec (δ) in radians, for chaining.
-
eclipticToGalactic
-
eclipticToGalacticF
public static com.badlogic.gdx.math.Matrix4 eclipticToGalacticF() -
galacticToEcliptic
-
galacticToEclipticF
public static com.badlogic.gdx.math.Matrix4 galacticToEclipticF() -
sphericalToCartesian
Converts from spherical to Cartesian coordinates, given a longitude (α), a latitude (δ) and the radius. The result is in the XYZ space, where ZX is the fundamental plane, with Z pointing to the the origin of coordinates (equinox) and Y pointing to the north pole.- Parameters:
vec
- Vector containing the spherical coordinates.- The longitude or right ascension (α), from the Z direction to the X direction, in radians.
- The latitude or declination (δ), in radians.
- The radius or distance to the point.
out
- The output vector.- Returns:
- Output vector in Cartesian coordinates where x and z are on the horizontal plane and y is in the up direction.
-
sphericalToCartesian
-
sphericalToCartesian
public static Vector3d sphericalToCartesian(double longitude, double latitude, double radius, Vector3d out)Converts from spherical to Cartesian coordinates, given a longitude (α), a latitude (δ) and the radius.- Parameters:
longitude
- The longitude or right ascension angle, from the z direction to the x direction, in radians.latitude
- The latitude or declination, in radians.radius
- The radius or distance to the point.out
- The output vector.- Returns:
- Output vector with the Cartesian coordinates[x, y, z] where x and z are on the horizontal plane and y is in the up direction, for chaining.
-
sphericalToCartesian
-
cartesianToSpherical
Converts from Cartesian coordinates to spherical coordinates.- Parameters:
vec
- Vector with the Cartesian coordinates[x, y, z] where x and z are on the horizontal plane and y is in the up direction.out
- Output vector.- Returns:
- Output vector containing the spherical coordinates.
- The longitude or right ascension (α), from the z direction to the x direction.
- The latitude or declination (δ).
- The radius or distance to the point.
-
cartesianToSpherical
Converts from Cartesian coordinates to spherical coordinates.- Parameters:
vec
- Vector with the Cartesian coordinates[x, y, z] where x and z are on the horizontal plane and y is in the up direction.out
- Output vector.- Returns:
- Output vector containing the spherical coordinates.
- The longitude or right ascension (α), from the z direction to the x direction.
- The latitude or declination (δ).
- The radius or distance to the point.
-
cartesianToSpherical
Converts from Cartesian coordinates to spherical coordinates.- Parameters:
vec
- Vector with the Cartesian coordinates[x, y, z] where x and z are on the horizontal plane and y is in the up direction.out
- Output vector.- Returns:
- Output vector containing the spherical coordinates.
- The longitude or right ascension (α), from the z direction to the x direction.
- The latitude or declination (δ).
- The radius or distance to the point.
-
getTransformD
-
getTransformF
public static com.badlogic.gdx.math.Matrix4 getTransformF(java.lang.String name)
-