csharp_pain/Solar system/sss3d-source/sss3d/utils/astronomy/Moon.java
2014-06-26 17:13:46 +02:00

276 lines
No EOL
13 KiB
Java

/*
File: Moon.java
University of Applied Science Berne,HTA-Biel/Bienne,
Computer Science Department.
Diploma thesis J3D Solar System Simulator
Originally written by Marcel Portner & Bernhard Hari (c) 2000
CVS - Information :
$Header: /var/cvsreps/projects/c450/2000/sss3d/source_diploma/sss3d/utils/astronomy/Moon.java,v 1.4 2000/12/13 13:42:48 portm Exp $
$Author: portm $
$Date: 2000/12/13 13:42:48 $
$State: Exp $
*/
package sss3d.utils.astronomy;
import sss3d.calculations.*;
import javax.vecmath.Matrix3d;
/**
* This class calculate the position of the moon.
*
* @author Marcel Portner & Bernhard Hari
* @version $Revision: 1.4 $
*/
public class Moon {
/**
* Constructor
*/
public Moon() {
}
/**
* Calculate the ecliptical position of the moon with the theory of Brown
* (Improved Lunar Ephemeris).
*
* @param time time in julianish century.
*
* @return the geocentrically position of the moon (in [km]) based
* to the ecliptic and the spring point of the date.
*/
public Vec3D moonPos(double time) {
MoonPert pert = new MoonPert();
pert.init(time); // initialisierung
// Solare Stoerungen
pert.addSol( 13.902, 14.06,-0.001, 0.2607,0, 0, 0, 4);
pert.addSol( 0.403, -4.01,+0.394, 0.0023,0, 0, 0, 3);
pert.addSol( 2369.912, 2373.36,+0.601, 28.2333,0, 0, 0, 2);
pert.addSol( -125.154, -112.79,-0.725, -0.9781,0, 0, 0, 1);
pert.addSol( 1.979, 6.98,-0.445, 0.0433,1, 0, 0, 4);
pert.addSol( 191.953, 192.72,+0.029, 3.0861,1, 0, 0, 2);
pert.addSol( -8.466, -13.51,+0.455, -0.1093,1, 0, 0, 1);
pert.addSol(22639.500,22609.07,+0.079, 186.5398,1, 0, 0, 0);
pert.addSol( 18.609, 3.59,-0.094, 0.0118,1, 0, 0,-1);
pert.addSol(-4586.465,-4578.13,-0.077, 34.3117,1, 0, 0,-2);
pert.addSol( +3.215, 5.44,+0.192, -0.0386,1, 0, 0,-3);
pert.addSol( -38.428, -38.64,+0.001, 0.6008,1, 0, 0,-4);
pert.addSol( -0.393, -1.43,-0.092, 0.0086,1, 0, 0,-6);
pert.addSol( -0.289, -1.59,+0.123, -0.0053,0, 1, 0, 4);
pert.addSol( -24.420, -25.10,+0.040, -0.3000,0, 1, 0, 2);
pert.addSol( 18.023, 17.93,+0.007, 0.1494,0, 1, 0, 1);
pert.addSol( -668.146, -126.98,-1.302, -0.3997,0, 1, 0, 0);
pert.addSol( 0.560, 0.32,-0.001, -0.0037,0, 1, 0,-1);
pert.addSol( -165.145, -165.06,+0.054, 1.9178,0, 1, 0,-2);
pert.addSol( -1.877, -6.46,-0.416, 0.0339,0, 1, 0,-4);
pert.addSol( 0.213, 1.02,-0.074, 0.0054,2, 0, 0, 4);
pert.addSol( 14.387, 14.78,-0.017, 0.2833,2, 0, 0, 2);
pert.addSol( -0.586, -1.20,+0.054, -0.0100,2, 0, 0, 1);
pert.addSol( 769.016, 767.96,+0.107, 10.1657,2, 0, 0, 0);
pert.addSol( +1.750, 2.01,-0.018, 0.0155,2, 0, 0,-1);
pert.addSol( -211.656, -152.53,+5.679, -0.3039,2, 0, 0,-2);
pert.addSol( +1.225, 0.91,-0.030, -0.0088,2, 0, 0,-3);
pert.addSol( -30.773, -34.07,-0.308, 0.3722,2, 0, 0,-4);
pert.addSol( -0.570, -1.40,-0.074, 0.0109,2, 0, 0,-6);
pert.addSol( -2.921, -11.75,+0.787, -0.0484,1, 1, 0, 2);
pert.addSol( +1.267, 1.52,-0.022, 0.0164,1, 1, 0, 1);
pert.addSol( -109.673, -115.18,+0.461, -0.9490,1, 1, 0, 0);
pert.addSol( -205.962, -182.36,+2.056, +1.4437,1, 1, 0,-2);
pert.addSol( 0.233, 0.36, 0.012, -0.0025,1, 1, 0,-3);
pert.addSol( -4.391, -9.66,-0.471, 0.0673,1, 1, 0,-4);
pert.addSol( 0.283, 1.53,-0.111, +0.0060,1,-1, 0,+4);
pert.addSol( 14.577, 31.70,-1.540, +0.2302,1,-1, 0, 2);
pert.addSol( 147.687, 138.76,+0.679, +1.1528,1,-1, 0, 0);
pert.addSol( -1.089, 0.55,+0.021, 0.0 ,1,-1, 0,-1);
pert.addSol( 28.475, 23.59,-0.443, -0.2257,1,-1, 0,-2);
pert.addSol( -0.276, -0.38,-0.006, -0.0036,1,-1, 0,-3);
pert.addSol( 0.636, 2.27,+0.146, -0.0102,1,-1, 0,-4);
pert.addSol( -0.189, -1.68,+0.131, -0.0028,0, 2, 0, 2);
pert.addSol( -7.486, -0.66,-0.037, -0.0086,0, 2, 0, 0);
pert.addSol( -8.096, -16.35,-0.740, 0.0918,0, 2, 0,-2);
pert.addSol( -5.741, -0.04, 0.0 , -0.0009,0, 0, 2, 2);
pert.addSol( 0.255, 0.0 , 0.0 , 0.0 ,0, 0, 2, 1);
pert.addSol( -411.608, -0.20, 0.0 , -0.0124,0, 0, 2, 0);
pert.addSol( 0.584, 0.84, 0.0 , +0.0071,0, 0, 2,-1);
pert.addSol( -55.173, -52.14, 0.0 , -0.1052,0, 0, 2,-2);
pert.addSol( 0.254, 0.25, 0.0 , -0.0017,0, 0, 2,-3);
pert.addSol( +0.025, -1.67, 0.0 , +0.0031,0, 0, 2,-4);
pert.addSol( 1.060, 2.96,-0.166, 0.0243,3, 0, 0,+2);
pert.addSol( 36.124, 50.64,-1.300, 0.6215,3, 0, 0, 0);
pert.addSol( -13.193, -16.40,+0.258, -0.1187,3, 0, 0,-2);
pert.addSol( -1.187, -0.74,+0.042, 0.0074,3, 0, 0,-4);
pert.addSol( -0.293, -0.31,-0.002, 0.0046,3, 0, 0,-6);
pert.addSol( -0.290, -1.45,+0.116, -0.0051,2, 1, 0, 2);
pert.addSol( -7.649, -10.56,+0.259, -0.1038,2, 1, 0, 0);
pert.addSol( -8.627, -7.59,+0.078, -0.0192,2, 1, 0,-2);
pert.addSol( -2.740, -2.54,+0.022, 0.0324,2, 1, 0,-4);
pert.addSol( 1.181, 3.32,-0.212, 0.0213,2,-1, 0,+2);
pert.addSol( 9.703, 11.67,-0.151, 0.1268,2,-1, 0, 0);
pert.addSol( -0.352, -0.37,+0.001, -0.0028,2,-1, 0,-1);
pert.addSol( -2.494, -1.17,-0.003, -0.0017,2,-1, 0,-2);
pert.addSol( 0.360, 0.20,-0.012, -0.0043,2,-1, 0,-4);
pert.addSol( -1.167, -1.25,+0.008, -0.0106,1, 2, 0, 0);
pert.addSol( -7.412, -6.12,+0.117, 0.0484,1, 2, 0,-2);
pert.addSol( -0.311, -0.65,-0.032, 0.0044,1, 2, 0,-4);
pert.addSol( +0.757, 1.82,-0.105, 0.0112,1,-2, 0, 2);
pert.addSol( +2.580, 2.32,+0.027, 0.0196,1,-2, 0, 0);
pert.addSol( +2.533, 2.40,-0.014, -0.0212,1,-2, 0,-2);
pert.addSol( -0.344, -0.57,-0.025, +0.0036,0, 3, 0,-2);
pert.addSol( -0.992, -0.02, 0.0 , 0.0 ,1, 0, 2, 2);
pert.addSol( -45.099, -0.02, 0.0 , -0.0010,1, 0, 2, 0);
pert.addSol( -0.179, -9.52, 0.0 , -0.0833,1, 0, 2,-2);
pert.addSol( -0.301, -0.33, 0.0 , 0.0014,1, 0, 2,-4);
pert.addSol( -6.382, -3.37, 0.0 , -0.0481,1, 0,-2, 2);
pert.addSol( 39.528, 85.13, 0.0 , -0.7136,1, 0,-2, 0);
pert.addSol( 9.366, 0.71, 0.0 , -0.0112,1, 0,-2,-2);
pert.addSol( 0.202, 0.02, 0.0 , 0.0 ,1, 0,-2,-4);
pert.addSol( 0.415, 0.10, 0.0 , 0.0013,0, 1, 2, 0);
pert.addSol( -2.152, -2.26, 0.0 , -0.0066,0, 1, 2,-2);
pert.addSol( -1.440, -1.30, 0.0 , +0.0014,0, 1,-2, 2);
pert.addSol( 0.384, -0.04, 0.0 , 0.0 ,0, 1,-2,-2);
pert.addSol( +1.938, +3.60,-0.145, +0.0401,4, 0, 0, 0);
pert.addSol( -0.952, -1.58,+0.052, -0.0130,4, 0, 0,-2);
pert.addSol( -0.551, -0.94,+0.032, -0.0097,3, 1, 0, 0);
pert.addSol( -0.482, -0.57,+0.005, -0.0045,3, 1, 0,-2);
pert.addSol( 0.681, 0.96,-0.026, 0.0115,3,-1, 0, 0);
pert.addSol( -0.297, -0.27, 0.002, -0.0009,2, 2, 0,-2);
pert.addSol( 0.254, +0.21,-0.003, 0.0 ,2,-2, 0,-2);
pert.addSol( -0.250, -0.22, 0.004, 0.0014,1, 3, 0,-2);
pert.addSol( -3.996, 0.0 , 0.0 , +0.0004,2, 0, 2, 0);
pert.addSol( 0.557, -0.75, 0.0 , -0.0090,2, 0, 2,-2);
pert.addSol( -0.459, -0.38, 0.0 , -0.0053,2, 0,-2, 2);
pert.addSol( -1.298, 0.74, 0.0 , +0.0004,2, 0,-2, 0);
pert.addSol( 0.538, 1.14, 0.0 , -0.0141,2, 0,-2,-2);
pert.addSol( 0.263, 0.02, 0.0 , 0.0 ,1, 1, 2, 0);
pert.addSol( 0.426, +0.07, 0.0 , -0.0006,1, 1,-2,-2);
pert.addSol( -0.304, +0.03, 0.0 , +0.0003,1,-1, 2, 0);
pert.addSol( -0.372, -0.19, 0.0 , -0.0027,1,-1,-2, 2);
pert.addSol( +0.418, 0.0 , 0.0 , 0.0 ,0, 0, 4, 0);
pert.addSol( -0.330, -0.04, 0.0 , 0.0 ,3, 0, 2, 0);
// Solare Stoerungen in Breite
pert.addN(-526.069, 0, 0,1,-2); pert.addN( -3.352, 0, 0,1,-4);
pert.addN( +44.297,+1, 0,1,-2); pert.addN( -6.000,+1, 0,1,-4);
pert.addN( +20.599,-1, 0,1, 0); pert.addN( -30.598,-1, 0,1,-2);
pert.addN( -24.649,-2, 0,1, 0); pert.addN( -2.000,-2, 0,1,-2);
pert.addN( -22.571, 0,+1,1,-2); pert.addN( +10.985, 0,-1,1,-2);
pert.planetary(time); // Planetare Stoerungen
// Position
return new Vec3D(new Polar(pert.lambda(),
pert.beta(),
pert.dist()));
}
/**
* Calculate the equatorialy position of the moon with the theory of Brown
* (Improved Lunar Ephemeris).
*
* @param time time in julianish century.
*
* @return the geocentrically position of the moon (in [km]) based
* to the ecliptic and the spring point of the date.
*/
public Vec3D moonEqu(double time) {
// nutMatrix(time) * ecl2EquMatrix(time) * moonPos(time)
PrecNut precNut = new PrecNut();
Spheric spheric = new Spheric();
Matrix3d sMatrix = spheric.ecl2EquMatrix(time);
Matrix3d pMatrix = precNut.nutMatrix(time);
Vec3D vec = moonPos(time);
vec.mul(sMatrix);
vec.mul(pMatrix);
return vec;
}
/**
* Calculate the right ascension and declension of the moon with an
* analytical series with short precision.
*
* @param time time in julianish century.
*
* @return a double array with the values:<br>
* double[0] = right ascension of the moon in [rad].<br>
* double[1] = declension of the moon in [rad].
*/
public double[] miniMoon(double time) {
double eps = 23.43929111 * MoreMath.RAD;
// Mittlere Elemente der Mondbahn
double l_0 = MoreMath.frac(0.606433 + 1336.855225 * time); // mittlere Laenge [Umlaeufe]
double l = MoreMath.PI2 * MoreMath.frac(0.374897 +
1325.552410 * time); // Mittlere Anomalie des Mondes
double ls = MoreMath.PI2 * MoreMath.frac(0.993133 +
99.997361 * time); // Mittlere Anomalie der Sonne
double d = MoreMath.PI2 * MoreMath.frac(0.827361 +
1236.853086 * time); // Laengendiff. Mond-Sonnne
double f = MoreMath.PI2 * MoreMath.frac(0.259086 +
1342.227825 * time); // Knotenabstand
// Stoerungen in Laenge und Breite
double dL = 22640.0 * StrictMath.sin(l) -
4586.0 * StrictMath.sin(l - 2.0 * d) +
2370.0 * StrictMath.sin(2.0 * d) +
769.0 * StrictMath.sin(2.0 * l) -
668.0 * StrictMath.sin(ls) -
412.0 * StrictMath.sin(2.0 * f) -
212.0 * StrictMath.sin(2.0 * l - 2.0 * d) -
206.0 * StrictMath.sin(l + ls - 2.0 * d) +
192.0 * StrictMath.sin(l + 2.0 * d) -
165.0 * StrictMath.sin(ls - 2.0 * d) -
125.0 * StrictMath.sin(d) -
110.0 * StrictMath.sin(l + ls) +
148.0 * StrictMath.sin(l - ls) -
55.0 * StrictMath.sin(2.0 * f - 2.0 * d);
double s = f + (dL + 412.0 * StrictMath.sin(2.0 * f) +
541.0 * StrictMath.sin(ls)) / MoreMath.ARCS;
double h = f - 2.0 * d;
double n = -526.0 * StrictMath.sin(h) +
44.0 * StrictMath.sin(l + h) -
31.0 * StrictMath.sin(-l + h) -
23.0 * StrictMath.sin(ls + h) +
11.0 * StrictMath.sin(-ls + h) -
25.0 * StrictMath.sin(-2.0 * l + f) +
21.0 * StrictMath.sin(-l + f);
// Ekliptikale Laenge und Breite
double l_Moon = MoreMath.PI2 * MoreMath.frac(l_0 + dL / 1296.0e3 ); // [rad]
double b_Moon = (18520.0 * StrictMath.sin(s) + n) / MoreMath.ARCS; // [rad]
// Aequatoriale Koordinaten
Vec3D e_Moon = new Vec3D(new Polar(l_Moon, b_Moon));
Matrix3d matrix = new Matrix3d();
matrix.setIdentity();
matrix.rotX(-eps);
e_Moon.mul(matrix);
double[] result = new double[2];
result[0] = e_Moon.getAzimut();
result[1] = e_Moon.getElevation();
return result;
}
}