/*
File: KeplerEquation.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/calculations/keplerequation/KeplerEquation.java,v 1.10 2000/12/13 13:36:38 portm Exp $
$Author: portm $
$Date: 2000/12/13 13:36:38 $
$State: Exp $
*/
package sss3d.calculations.keplerequation;
import sss3d.calculations.constants.AstronomicalConstants;
import sss3d.utils.SSS3dConstants;
import sss3d.utils.astronomy.*;
import sss3d.calculations.*;
import sss3d.contentbranch.*;
import javax.vecmath.Point3f;
import javax.vecmath.Matrix3d;
/**
* Used to calculate the planet positions using kepler equation.
* This part is left as a exercise for the diploma work, at the end of
* October 2000. We use the simpler ellipse equation method instead.
* For example:
*
* use : * KeplerEquation keplereq = new KeplerEquation(); * Point3f [] positions = keplereq.getPositions(CelestialObjectInfo,time); ** * @author Marcel Portner & Bernhard Hari * @version $Revision: 1.10 $ * @see sss3d.calculations.ellipseequation.EllipseEquation */ public class KeplerEquation extends OrbitCalculator { private CelestialObjectInfo objInfo; private double jDay; private boolean compressed; private boolean kepler; private int nbrOfPoints; private Point3f[] positions; /** * Returns the positions of the given planet. * The algorithm used is the kepler equation. * * @param objInfo Information about the planet. * @param jDay calculates positions corresponding to the given julian day * @param compressed true if the universe is logorithmic compressed or false if * it has the real proportion. * @return Point3f[] an array of vectors containing the positions. */ public Point3f[] getPositions(CelestialObjectInfo objInfo, double jDay, boolean compressed) { this.objInfo = objInfo; // modifiziertes julianisches Datum this.jDay = jDay - 2400000.5; this.compressed = compressed; kepler = false; // last is used to mark the end of the array. nbrOfPoints = objInfo.getNbrOfPositions(); positions = new Point3f[nbrOfPoints]; String type = objInfo.getType(); if(type.equals(SSS3dConstants.TYPES[SSS3dConstants.PLANET_TYPE])) { int planetNr = -1; String name = objInfo.getName(); if(name.equals(SSS3dConstants.CELESTIAL[SSS3dConstants.MERCURY])) { planetNr = SSS3dConstants.MERCURY; } else if(name.equals(SSS3dConstants.CELESTIAL[SSS3dConstants.VENUS])) { planetNr = SSS3dConstants.VENUS; } else if(name.equals(SSS3dConstants.CELESTIAL[SSS3dConstants.EARTH])) { planetNr = SSS3dConstants.EARTH; } else if(name.equals(SSS3dConstants.CELESTIAL[SSS3dConstants.MARS])) { planetNr = SSS3dConstants.MARS; } else if(name.equals(SSS3dConstants.CELESTIAL[SSS3dConstants.JUPITER])) { planetNr = SSS3dConstants.JUPITER; } else if(name.equals(SSS3dConstants.CELESTIAL[SSS3dConstants.SATURN])) { planetNr = SSS3dConstants.SATURN; } else if(name.equals(SSS3dConstants.CELESTIAL[SSS3dConstants.URANUS])) { planetNr = SSS3dConstants.URANUS; } else if(name.equals(SSS3dConstants.CELESTIAL[SSS3dConstants.NEPTUNE])) { planetNr = SSS3dConstants.NEPTUNE; } else if(name.equals(SSS3dConstants.CELESTIAL[SSS3dConstants.PLUTO])) { planetNr = SSS3dConstants.PLUTO; } else { System.out.println("Error in KeplerEquation: planet not knowned"); return null; } calcPlanetPos(planetNr); } else if(type.equals(SSS3dConstants.TYPES[SSS3dConstants.MOON_TYPE])) { String name = objInfo.getName(); if(name.equals(SSS3dConstants.CELESTIAL[SSS3dConstants.MOON])) { calcOurMoonPos(); } else { calcMoonPos(); } } else if(type.equals(SSS3dConstants.TYPES[SSS3dConstants.COMET_TYPE])) { calcCometPos(); } else { System.out.println("Error in KeplerEquation: Other not supported yet"); return null; } return positions; } /** * Returns an array of positons for the given positions, based * on the given jDay.