Kstars

ksasteroid.h
1/*
2 SPDX-FileCopyrightText: 2001 Jason Harris <jharris@30doradus.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "ksplanetbase.h"
10
11#include <QDataStream>
12
13class dms;
14class KSNumbers;
15
16/** @class KSAsteroid
17 *@short A subclass of KSPlanetBase that implements asteroids.
18 *
19 * All elements are in the heliocentric ecliptic J2000 reference frame.
20 *
21 * Check here for full description: https://ssd.jpl.nasa.gov/?sb_elem#legend
22 *
23 *The orbital elements are stored as private member variables, and it
24 *provides methods to compute the ecliptic coordinates for any time
25 *from the orbital elements.
26 *
27 *The orbital elements are:
28 *@li JD Epoch of element values
29 *@li a semi-major axis length (AU)
30 *@li e eccentricity of orbit
31 *@li i inclination angle (with respect to J2000.0 ecliptic plane)
32 *@li w argument of perihelion (w.r.t. J2000.0 ecliptic plane)
33 *@li N longitude of ascending node (J2000.0 ecliptic)
34 *@li M mean anomaly at epoch JD
35 *@li H absolute magnitude
36 *@li G slope parameter
37 *
38 *@author Jason Harris
39 *@version 1.0
40 */
42{
43 public:
44 /** Constructor.
45 *@p catN number of asteroid
46 *@p s the name of the asteroid
47 *@p image_file the filename for an image of the asteroid
48 *@p JD the Julian Day for the orbital elements
49 *@p a the semi-major axis of the asteroid's orbit (AU)
50 *@p e the eccentricity of the asteroid's orbit
51 *@p i the inclination angle of the asteroid's orbit
52 *@p w the argument of the orbit's perihelion
53 *@p N the longitude of the orbit's ascending node
54 *@p M the mean anomaly for the Julian Day
55 *@p H absolute magnitude
56 *@p G slope parameter
57 */
58 KSAsteroid(int catN, const QString &s, const QString &image_file, long double JD, double a, double e, dms i, dms w,
59 dms N, dms M, double H, double G);
60
61 KSAsteroid *clone() const override;
62 SkyObject::UID getUID() const override;
63
64 static const SkyObject::TYPE TYPE = SkyObject::ASTEROID;
65
66 /** Destructor (empty)*/
67 ~KSAsteroid() override = default;
68
69 /** This is inherited from KSPlanetBase. We don't use it in this class,
70 *so it is empty.
71 */
72 bool loadData() override;
73
74 /** This lets other classes like KSPlanetBase access H and G values
75 *Used by KSPlanetBase::FindMagnitude
76 */
77 double inline getAbsoluteMagnitude() const { return H; }
78 double inline getSlopeParameter() const { return G; }
79
80 /**
81 *@short Sets the asteroid's perihelion distance
82 */
83 void setPerihelion(double perihelion);
84
85 /**
86 *@return Perihelion distance
87 */
88 inline double getPerihelion() const { return q; }
89
90 /**
91 *@short Sets the asteroid's earth minimum orbit intersection distance
92 */
93 void setEarthMOID(double earth_moid);
94
95 /**
96 *@return the asteroid's earth minimum orbit intersection distance in AU
97 */
98 inline double getEarthMOID() const { return EarthMOID; }
99
100 /**
101 *@short Sets the asteroid's orbit solution ID
102 */
103 void setOrbitID(QString orbit_id);
104
105 /**
106 *@return the asteroid's orbit solution ID
107 */
108 inline QString getOrbitID() const { return OrbitID; }
109
110 /**
111 *@short Sets the asteroid's orbit class
112 */
113 void setOrbitClass(QString orbit_class);
114
115 /**
116 *@return the asteroid's orbit class
117 */
118 inline QString getOrbitClass() const { return OrbitClass; }
119
120 /**
121 *@short Sets if the comet is a near earth object
122 */
123 void setNEO(bool neo);
124
125 /**
126 *@return true if the asteroid is a near earth object
127 */
128 inline bool isNEO() const { return NEO; }
129
130 /**
131 *@short Sets the asteroid's albedo
132 */
133 void setAlbedo(float albedo);
134
135 /**
136 *@return the asteroid's albedo
137 */
138 inline float getAlbedo() const { return Albedo; }
139
140 /**
141 *@short Sets the asteroid's diameter
142 */
143 void setDiameter(float diam);
144
145 /**
146 *@return the asteroid's diameter
147 */
148 inline float getDiameter() const { return Diameter; }
149
150 /**
151 *@short Sets the asteroid's dimensions
152 */
153 void setDimensions(QString dim);
154
155 /**
156 *@return the asteroid's dimensions
157 */
158 inline QString getDimensions() const { return Dimensions; }
159
160 /**
161 *@short Sets the asteroid's rotation period
162 */
163 void setRotationPeriod(float rot_per);
164
165 /**
166 *@return the asteroid's rotation period
167 */
168 inline float getRotationPeriod() const { return RotationPeriod; }
169
170 /**
171 *@short Sets the asteroid's period
172 */
173 void setPeriod(float per);
174
175 /**
176 *@return the asteroid's period
177 */
178 inline float getPeriod() const { return Period; }
179
180 // TODO: Add top level implementation
181 /**
182 * @brief toDraw
183 * @return whether to draw the asteroid
184 *
185 * Note that you'd check for other, older filtering methids
186 * upn implementing this on other types! (a.k.a find nearest)
187 */
188 inline bool toDraw() { return toCalculate(); }
189
190 /**
191 * @brief toCalculate
192 * @return whether to calculate the position
193 */
194 bool toCalculate();
195
196 protected:
197 /** Calculate the geocentric RA, Dec coordinates of the Asteroid.
198 *@note reimplemented from KSPlanetBase
199 *@param num time-dependent values for the desired date
200 *@param Earth planet Earth (needed to calculate geocentric coords)
201 *@return true if position was successfully calculated.
202 */
203 bool findGeocentricPosition(const KSNumbers *num, const KSPlanetBase *Earth = nullptr) override;
204
205 //these set functions are needed for the new KSPluto subclass
206 void set_a(double newa) { a = newa; }
207 void set_e(double newe) { e = newe; }
208 void set_P(double newP) { P = newP; }
209 void set_i(double newi) { i.setD(newi); }
210 void set_w(double neww) { w.setD(neww); }
211 void set_M(double newM) { M.setD(newM); }
212 void set_N(double newN) { N.setD(newN); }
213 void setJD(long double jd) { JD = jd; }
214
215
216 private:
217 /**
218 * Serializers
219 */
220 friend QDataStream &operator<<(QDataStream &out, const KSAsteroid &asteroid);
221 friend QDataStream &operator>>(QDataStream &in, KSAsteroid *&asteroid);
222
223 void findMagnitude(const KSNumbers *) override;
224
225 int catN { 0 };
226 long double JD { 0 };
227 double q { 0 };
228 double a { 0 };
229 double e { 0 };
230 double P { 0 };
231 double EarthMOID { 0 };
232 float Albedo { 0 };
233 float Diameter { 0 };
234 float RotationPeriod { 0 };
235 float Period { 0 };
236 dms i, w, M, N;
237 double H { 0 };
238 double G { 0 };
239 QString OrbitID, OrbitClass, Dimensions;
240 bool NEO { false };
241};
A subclass of KSPlanetBase that implements asteroids.
Definition ksasteroid.h:42
QString getOrbitClass() const
Definition ksasteroid.h:118
SkyObject::UID getUID() const override
Return UID for object.
void setPerihelion(double perihelion)
Sets the asteroid's perihelion distance.
bool isNEO() const
Definition ksasteroid.h:128
bool toDraw()
toDraw
Definition ksasteroid.h:188
KSAsteroid * clone() const override
Create copy of object.
void setPeriod(float per)
Sets the asteroid's period.
void setDiameter(float diam)
Sets the asteroid's diameter.
void setDimensions(QString dim)
Sets the asteroid's dimensions.
void setEarthMOID(double earth_moid)
Sets the asteroid's earth minimum orbit intersection distance.
void setNEO(bool neo)
Sets if the comet is a near earth object.
double getAbsoluteMagnitude() const
This lets other classes like KSPlanetBase access H and G values Used by KSPlanetBase::FindMagnitude.
Definition ksasteroid.h:77
void setOrbitID(QString orbit_id)
Sets the asteroid's orbit solution ID.
QString getOrbitID() const
Definition ksasteroid.h:108
double getEarthMOID() const
Definition ksasteroid.h:98
float getRotationPeriod() const
Definition ksasteroid.h:168
double getPerihelion() const
Definition ksasteroid.h:88
float getDiameter() const
Definition ksasteroid.h:148
QString getDimensions() const
Definition ksasteroid.h:158
float getPeriod() const
Definition ksasteroid.h:178
bool toCalculate()
toCalculate
void setAlbedo(float albedo)
Sets the asteroid's albedo.
bool findGeocentricPosition(const KSNumbers *num, const KSPlanetBase *Earth=nullptr) override
Calculate the geocentric RA, Dec coordinates of the Asteroid.
bool loadData() override
This is inherited from KSPlanetBase.
friend QDataStream & operator<<(QDataStream &out, const KSAsteroid &asteroid)
Serializers.
~KSAsteroid() override=default
Destructor (empty)
KSAsteroid(int catN, const QString &s, const QString &image_file, long double JD, double a, double e, dms i, dms w, dms N, dms M, double H, double G)
Constructor.
void setRotationPeriod(float rot_per)
Sets the asteroid's rotation period.
void setOrbitClass(QString orbit_class)
Sets the asteroid's orbit class.
float getAlbedo() const
Definition ksasteroid.h:138
There are several time-dependent values used in position calculations, that are not specific to an ob...
Definition ksnumbers.h:43
A subclass of TrailObject that provides additional information needed for most solar system objects.
qint64 UID
Type for Unique object IDenticator.
Definition skyobject.h:49
TYPE
The type classification of the SkyObject.
Definition skyobject.h:112
An angle, stored as degrees, but expressible in many ways.
Definition dms.h:38
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:41 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.