Commit 973359e2 authored by Luc Maisonobe's avatar Luc Maisonobe
Browse files

use Constants.JULIAN_CENTURY where possible

parent 63d27c2c
......@@ -54,9 +54,6 @@ class CIRF2000Frame extends Frame {
/** Radians per arcsecond. */
private static final double RADIANS_PER_ARC_SECOND = Math.PI / 648000;
/** Julian century per second. */
private static final double JULIAN_CENTURY_PER_SECOND = 1.0 / (36525.0 * Constants.JULIAN_DAY);
// CHECKSTYLE: stop JavadocVariable check
// lunisolar nutation elements
......@@ -343,7 +340,7 @@ class CIRF2000Frame extends Frame {
protected void computePoleCoordinates(final double t) {
// offset in julian centuries
final double tc = t * JULIAN_CENTURY_PER_SECOND;
final double tc = t / Constants.JULIAN_CENTURY;
final BodiesElements elements =
new BodiesElements((((F14 * tc + F13) * tc + F12) * tc + F11) * tc + F10, // mean anomaly of the Moon
......
......@@ -41,9 +41,6 @@ class ITRF2005Frame extends Frame {
/** Radians per arcsecond. */
private static final double RADIANS_PER_ARC_SECOND = TWO_PI / 1296000;
/** Julian century per second. */
private static final double JULIAN_CENTURY_PER_SECOND = 1.0 / (36525.0 * Constants.JULIAN_DAY);
/** S' rate in radians per julian century.
* Approximately -47 microarcsecond per julian century (Lambert and Bizouard, 2002)
*/
......@@ -91,7 +88,7 @@ class ITRF2005Frame extends Frame {
// offset from J2000 epoch in julian centuries
final double tts = date.durationFrom(AbsoluteDate.J2000_EPOCH);
final double ttc = tts * JULIAN_CENTURY_PER_SECOND;
final double ttc = tts / Constants.JULIAN_CENTURY;
// pole correction parameters
final PoleCorrection pCorr = ((TIRF2000Frame) getParent()).getPoleCorrection(date);
......
......@@ -37,9 +37,6 @@ class MEMEFrame extends Frame {
/** Radians per arcsecond. */
private static final double RADIANS_PER_ARC_SECOND = Math.PI / (180.0 * 3600.0);
/** Julian century per second. */
private static final double JULIAN_CENTURY_PER_SECOND = 1.0 / (36525.0 * Constants.JULIAN_DAY);
/** 1st coefficient for ZETA precession angle. */
private static final double ZETA_1 = 2306.2181 * RADIANS_PER_ARC_SECOND;
/** 2nd coefficient for ZETA precession angle. */
......@@ -135,7 +132,7 @@ class MEMEFrame extends Frame {
// offset from J2000 epoch in julian centuries
final double tts = date.durationFrom(AbsoluteDate.J2000_EPOCH);
final double ttc = tts * JULIAN_CENTURY_PER_SECOND;
final double ttc = tts / Constants.JULIAN_CENTURY;
// compute the zeta precession angle
final double zeta = ((ZETA_3 * ttc + ZETA_2) * ttc + ZETA_1) * ttc;
......
......@@ -50,9 +50,6 @@ class PEFFrame extends Frame {
/** Radians per arcsecond. */
private static final double RADIANS_PER_ARC_SECOND = Math.PI / 648000;
/** Julian century per second. */
private static final double JULIAN_CENTURY_PER_SECOND = 1.0 / (36525.0 * SECONDS_PER_DAY);
/** Angular velocity of the Earth, in rad/s. */
private static final double AVE = 7.292115146706979e-5;
......@@ -343,7 +340,7 @@ class PEFFrame extends Frame {
setInterpolatedNutationElements(tts);
// offset from J2000 epoch in julian centuries
final double ttc = tts * JULIAN_CENTURY_PER_SECOND;
final double ttc = tts / Constants.JULIAN_CENTURY;
// compute the mean obliquity of the ecliptic
moe = ((MOE_3 * ttc + MOE_2) * ttc + MOE_1) * ttc + MOE_0;
......@@ -357,7 +354,7 @@ class PEFFrame extends Frame {
final double dut1 = meme.getUT1MinusUTC(date);
final double tut1 = dtai + dutc + dut1;
final double tt = tut1 * JULIAN_CENTURY_PER_SECOND;
final double tt = tut1 / Constants.JULIAN_CENTURY;
// Seconds in the day, adjusted by 12 hours because the
// UT1 is supplied as a Julian date beginning at noon.
......@@ -459,7 +456,7 @@ class PEFFrame extends Frame {
protected void computeNutationElements(final double t) {
// offset in julian centuries
final double tc = t * JULIAN_CENTURY_PER_SECOND;
final double tc = t / Constants.JULIAN_CENTURY;
// mean anomaly of the Moon
final double l = ((F13 * tc + F12) * tc + F110) * tc + F10 + ((F111 * tc) % 1.0) * TWO_PI;
// mean anomaly of the Sun
......
......@@ -50,9 +50,6 @@ class TEMEFrame extends Frame {
/** Radians per arcsecond. */
private static final double RADIANS_PER_ARC_SECOND = Math.PI / 648000;
/** Julian century per second. */
private static final double JULIAN_CENTURY_PER_SECOND = 1.0 / (36525.0 * Constants.JULIAN_DAY);
// CHECKSTYLE: stop JavadocVariable check
// Coefficients for the Mean Obliquity of the Ecliptic.
......@@ -325,7 +322,7 @@ class TEMEFrame extends Frame {
setInterpolatedNutationElements(tts);
// offset from J2000 epoch in julian centuries
final double ttc = tts * JULIAN_CENTURY_PER_SECOND;
final double ttc = tts / Constants.JULIAN_CENTURY;
// compute the mean obliquity of the ecliptic
moe = ((MOE_3 * ttc + MOE_2) * ttc + MOE_1) * ttc + MOE_0;
......@@ -433,7 +430,7 @@ class TEMEFrame extends Frame {
protected void computeNutationElements(final double t) {
// offset in julian centuries
final double tc = t * JULIAN_CENTURY_PER_SECOND;
final double tc = t / Constants.JULIAN_CENTURY;
// mean anomaly of the Moon
final double l = ((F13 * tc + F12) * tc + F110) * tc + F10 + ((F111 * tc) % 1.0) * TWO_PI;
// mean anomaly of the Sun
......
......@@ -24,11 +24,19 @@ package org.orekit.utils;
public interface Constants {
/** Speed of light: 299792458.0 m/s. */
double SPEED_OF_LIGHT = 299792458.0;
/** Duration of a mean solar day: 86400.0 s. */
double JULIAN_DAY = 86400.0;
/** Speed of light: 299792458.0 m/s. */
double SPEED_OF_LIGHT = 299792458.0;
/** Duration of a julian year: 365.25 {@link #JULIAN_DAY}. */
double JULIAN_YEAR = 31557600.0;
/** Duration of a julian century: 36525 {@link #JULIAN_DAY}. */
double JULIAN_CENTURY = 36525 * JULIAN_DAY;
/** Sun radius: 695500000 m. */
double SUN_RADIUS = 6.955e8;
......@@ -36,6 +44,7 @@ public interface Constants {
/** Moon equatorial radius: 1737400 m. */
double MOON_EQUATORIAL_RADIUS = 1737400.0;
/** Earth equatorial radius from WGS84 model: 6378137.0 m. */
double WGS84_EARTH_EQUATORIAL_RADIUS = 6378137.0;
......@@ -139,7 +148,8 @@ public interface Constants {
/** Earth un-normalized sixth zonal coefficient from EIGEN5C model: -5.406653715879098e-7. */
double EIGEN5C_EARTH_C60 = -5.406653715879098e-7;
/** Gaussian gravitational constant: 0.01720209895 &sqrt;(AU<sup>3</sup>/d<sup>2</sup>). */
/** Gaussian gravitational constant: 0.01720209895 &radic;(AU<sup>3</sup>/d<sup>2</sup>). */
double JPL_SSD_GAUSSIAN_GRAVITATIONAL_CONSTANT = 0.01720209895;
/** Astronomical Unit: 149597870691 m. */
......
......@@ -230,7 +230,7 @@ public class DrozinerAttractionModelTest {
SpacecraftState drozOrb = propagator.propagate(date.shiftedBy(Constants.JULIAN_DAY));
Vector3D dif = cunnOrb.getPVCoordinates().getPosition().subtract(drozOrb.getPVCoordinates().getPosition());
Assert.assertEquals(0, dif.getNorm(), 1.0e-6);
Assert.assertEquals(0, dif.getNorm(), 1.5e-6);
Assert.assertTrue(propagator.getCalls() < 3500);
}
......
......@@ -59,8 +59,8 @@ public class PEFFrameTest {
// at 2004-04-06 there is a 0.471ms difference in dut1 and a 0.077ms difference
// in lod with the data used by Vallado to set up this test case
PVCoordinates delta = new PVCoordinates(t.transformPVCoordinates(pvTEME), pvPEF);
Assert.assertEquals(0.283011, delta.getPosition().getNorm(), 1.0e-8);
Assert.assertEquals(1.533846e-4, delta.getVelocity().getNorm(), 3.0e-11);
Assert.assertEquals(0.283011, delta.getPosition().getNorm(), 1.0e-6);
Assert.assertEquals(1.533846e-4, delta.getVelocity().getNorm(), 1.0e-10);
// if dut1 and lod corrections are ignored, results must be really bad
t = FramesFactory.getTEME(false).getTransformTo(FramesFactory.getPEF(false), t0);
......@@ -97,7 +97,7 @@ public class PEFFrameTest {
// at 2004-06-01 there is a 0.047ms difference in dut1 and a 0.416ms difference
// in lod with the data used by Vallado to set up this test case
PVCoordinates delta = new PVCoordinates(t.transformPVCoordinates(pvTEME), pvPEF);
Assert.assertEquals(0.193876, delta.getPosition().getNorm(), 2.0e-7);
Assert.assertEquals(0.193876, delta.getPosition().getNorm(), 1.0e-6);
Assert.assertEquals(1.427464e-5, delta.getVelocity().getNorm(), 9.0e-12);
// if dut1 and lod corrections are ignored, results must be really bad
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment