Kstars

kspluto.cpp
1 /*
2  SPDX-FileCopyrightText: 2001 Jason Harris <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #include "kspluto.h"
8 
9 #include <typeinfo>
10 
11 #include <cmath>
12 
13 #include <QFile>
14 
15 #include <QDebug>
16 
17 #include "ksnumbers.h"
18 #include "kstarsdatetime.h" //for J2000 define
19 
20 #ifdef B0
21 // There are systems that #define B0 as a special termios flag (for baud rate)
22 #undef B0
23 #endif
24 
25 KSPluto::KSPluto(const QString &fn, double pSize)
26  : KSAsteroid(0, xi18n("Pluto"), fn, J2000, 39.48168677, 0.24880766, dms(17.14175), dms(113.76329), dms(110.30347),
27  dms(14.86205), 1.0, 0.0)
28 {
29  //Initialize the base orbital element values for J2000:
30  a0 = 39.48168677; //semi-major axis (AU)
31  e0 = 0.24880766; //eccentricity
32  i0.setD(17.14175); //inclination (degrees)
33  w0.setD(113.76329); //argument of perihelion (degrees)
34  N0.setD(110.30347); //long. of ascending node (degrees)
35  M0.setD(14.86205); //mean anomaly (degrees)
36 
37  //rate-of-change values for the orbital elements
38  a1 = -0.00076912; // da/dt (AU/century)
39  e1 = 0.00006465; // de/dt (1/century)
40  i1 = 11.07 / 3600.; // di/dt (degrees/century)
41  w1 = -94.92 / 3600.; // dw/dt (degrees/century)
42  N1 = -37.33 / 3600.; // dN/dt (degrees/century)
43  M1 = 522880.15 / 3600.; // dM/dt (degrees/century)
44 
45  setPhysicalSize(pSize);
46 }
47 
49 {
50  Q_ASSERT(typeid(this) == typeid(static_cast<const KSPluto *>(this))); // Ensure we are not slicing a derived class
51  return new KSPluto(*this);
52 }
53 
55 {
56 }
57 
58 //Determine values for the orbital elements for the requested JD, then
59 //call KSAsteroid::findGeocentricPosition()
61 {
62  //First, set the orbital element values according to the current epoch
63  double t = num->julianCenturies();
64  set_a(a0 + a1 * t);
65  set_e(e0 + e1 * t);
66  set_i(i0.Degrees() + i1 * t);
67  set_N(N0.Degrees() + N1 * t);
68  set_M(M0.Degrees() + M1 * t);
69  set_P(365.2568984 * pow((a0 + a1 * t), 1.5)); //set period from Kepler's 3rd law
70  setJD(num->julianDay());
71 
72  return KSAsteroid::findGeocentricPosition(num, Earth);
73 }
74 
75 void KSPluto::findMagnitude(const KSNumbers *)
76 {
77  setMag(-1.01 + 5 * log10(rsun() * rearth()) + 0.041 * phase().Degrees());
78 }
Provides necessary information about Pluto.
Definition: kspluto.h:32
virtual void setD(const double &x)
Sets floating-point value of angle, in degrees.
Definition: dms.h:179
A subclass of KSPlanetBase that implements asteroids.
Definition: ksasteroid.h:41
double rsun() const
Definition: ksplanetbase.h:130
double rearth() const
Definition: ksplanetbase.h:139
QString xi18n(const char *text, const TYPE &arg...)
KSPluto * clone() const override
Create copy of object.
Definition: kspluto.cpp:48
KSPluto(const QString &fn=QString(), double pSize=0)
Constructor.
Definition: kspluto.cpp:25
Store several time-dependent astronomical quantities.
Definition: ksnumbers.h:42
void setMag(float m)
Set the object's sorting magnitude.
Definition: skyobject.h:403
long double julianDay() const
Definition: ksnumbers.h:91
An angle, stored as degrees, but expressible in many ways.
Definition: dms.h:37
const double & Degrees() const
Definition: dms.h:141
bool findGeocentricPosition(const KSNumbers *num, const KSPlanetBase *Earth=nullptr) override
Calculate the geocentric RA, Dec coordinates of the Asteroid.
Definition: ksasteroid.cpp:39
~KSPluto() override
Destructor (empty)
Definition: kspluto.cpp:54
double julianCenturies() const
Definition: ksnumbers.h:88
void setPhysicalSize(double size)
set the planet's physical size, in km.
Definition: ksplanetbase.h:197
bool findGeocentricPosition(const KSNumbers *num, const KSPlanetBase *Earth=nullptr) override
A custom findPosition() function for Pluto.
Definition: kspluto.cpp:60
Provides necessary information about objects in the solar system.
Definition: ksplanetbase.h:49
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Mon Aug 8 2022 04:13:21 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.