de430.cpp   de430.cpp 
skipping to change at line 26 skipping to change at line 26
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FRO M, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FRO M,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
#include "de430.hpp" #include "de430.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#ifndef UNIT_TEST
#include "StelCore.hpp" #include "StelCore.hpp"
#include "StelApp.hpp" #include "StelApp.hpp"
#else
#include "VecMath.hpp"
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
static void * ephem; static void * ephem;
static Vec3d tempECL = Vec3d(0,0,0); static Vec3d tempECL = Vec3d(0,0,0);
static Vec3d tempICRF = Vec3d(0,0,0); static Vec3d tempICRF = Vec3d(0,0,0);
static char nams[JPL_MAX_N_CONSTANTS][6]; static char nams[JPL_MAX_N_CONSTANTS][6];
static double vals[JPL_MAX_N_CONSTANTS]; static double vals[JPL_MAX_N_CONSTANTS];
static double tempXYZ[6]; static double tempXYZ[6];
#ifdef UNIT_TEST
// NOTE: Added hook for unit testing
static const Mat4d matJ2000ToVsop87(Mat4d::xrotation(-23.439280305555555555
6*(M_PI/180)) * Mat4d::zrotation(0.0000275*(M_PI/180)));
#endif
static bool initDone = false; static bool initDone = false;
void InitDE430(const char* filepath) void InitDE430(const char* filepath)
{ {
ephem = jpl_init_ephemeris(filepath, nams, vals); ephem = jpl_init_ephemeris(filepath, nams, vals);
if(jpl_init_error_code() != 0) if(jpl_init_error_code() != 0)
{ {
#ifndef UNIT_TEST
StelApp::getInstance().getCore()->setDe430Active(false); StelApp::getInstance().getCore()->setDe430Active(false);
#endif
qDebug() << "Error "<< jpl_init_error_code() << "at DE430 in it:" << jpl_init_error_message(); qDebug() << "Error "<< jpl_init_error_code() << "at DE430 in it:" << jpl_init_error_message();
} }
else else
{ {
initDone = true; initDone = true;
double jd1, jd2; double jd1, jd2;
jd1=jpl_get_double(ephem, JPL_EPHEM_START_JD); jd1=jpl_get_double(ephem, JPL_EPHEM_START_JD);
jd2=jpl_get_double(ephem, JPL_EPHEM_END_JD); jd2=jpl_get_double(ephem, JPL_EPHEM_END_JD);
qDebug() << "DE430 init successful. startJD=" << QString::nu mber(jd1, 'f', 4) << "endJD=" << QString::number(jd2, 'f', 4); qDebug() << "DE430 init successful. startJD=" << QString::nu mber(jd1, 'f', 4) << "endJD=" << QString::number(jd2, 'f', 4);
} }
skipping to change at line 107 skipping to change at line 117
break; break;
default: // Should never happen... default: // Should never happen...
qDebug() << "GetDe430Coor: unknown error" << jplresu lt << "at jde" << jde << "for planet" << planet_id; qDebug() << "GetDe430Coor: unknown error" << jplresu lt << "at jde" << jde << "for planet" << planet_id;
return false; return false;
break; break;
} }
jpl_pleph(ephem, jde, planet_id, centralBody_id, tempXYZ, 0); jpl_pleph(ephem, jde, planet_id, centralBody_id, tempXYZ, 0);
tempICRF = Vec3d(tempXYZ[0], tempXYZ[1], tempXYZ[2]); tempICRF = Vec3d(tempXYZ[0], tempXYZ[1], tempXYZ[2]);
#ifdef UNIT_TEST
tempECL = matJ2000ToVsop87 * tempICRF;
#else
tempECL = StelCore::matJ2000ToVsop87 * tempICRF; tempECL = StelCore::matJ2000ToVsop87 * tempICRF;
#endif
xyz[0] = tempECL[0]; xyz[0] = tempECL[0];
xyz[1] = tempECL[1]; xyz[1] = tempECL[1];
xyz[2] = tempECL[2]; xyz[2] = tempECL[2];
return true; return true;
} }
return false; return false;
} }
#ifdef __cplusplus #ifdef __cplusplus
 End of changes. 7 change blocks. 
0 lines changed or deleted 15 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/