Kstars

planetmoons.h
1/*
2 SPDX-FileCopyrightText: Vipul Kumar Singh <vipulkrsingh@gmail.com>
3 SPDX-FileCopyrightText: Médéric Boquien <mboquien@free.fr>
4
5 SPDX-License-Identifier: GPL-2.0-or-later
6*/
7
8#pragma once
9
10#include <QString>
11#include <QVector>
12
13class KSNumbers;
14class KSPlanetBase;
15class KSSun;
16class TrailObject;
17class dms;
18
19/**
20 * @class PlanetMoons
21 *
22 * Implements the moons of a planet.
23 *
24 * TODO: make the moons SkyObjects, rather than just points.
25 *
26 * @author Vipul Kumar Singh
27 * @version 1.0
28 */
30{
31 public:
32 /**
33 * Constructor. Assign the name of each moon,
34 * and initialize their XYZ positions to zero.
35 */
36 PlanetMoons() = default;
37
38 /** Destructor. Delete moon objects */
39 virtual ~PlanetMoons();
40
41 /**
42 * @return pointer to a moon given the ID number.
43 * @param id which moon?
44 */
45 inline TrailObject *moon(int id) { return Moon[id]; }
46
47 /**
48 * @return the name of a moon.
49 * @param id which moon?
50 */
51 QString name(int id) const;
52
53 /**
54 * Convert the RA,Dec coordinates of each moon to Az,Alt
55 *
56 * @param LSTh pointer to the current local sidereal time
57 * @param lat pointer to the geographic latitude
58 */
59 void EquatorialToHorizontal(const dms *LSTh, const dms *lat);
60
61 /**
62 * @short Find the positions of each Moon, relative to the planet.
63 *
64 * We use an XYZ coordinate system, centered on the planet,
65 * where the X-axis corresponds to the planet's Equator,
66 * the Y-Axis is parallel to the planet's Poles, and the
67 * Z-axis points along the line joining the Earth and
68 * the planet. Once the XYZ positions are known, this
69 * function also computes the RA, Dec positions of each
70 * Moon, and sets the inFront bool variable to indicate
71 * whether the Moon is nearer to us than the planet or not
72 * (this information is used to determine whether the
73 * Moon should be drawn on top of the planet, or vice versa).
74 *
75 * @param num pointer to the KSNumbers object describing
76 * the date/time at which to find the positions.
77 * @param pla pointer to the planet object
78 * @param sunptr pointer to the Sun object
79 */
80 virtual void findPosition(const KSNumbers *num, const KSPlanetBase *pla, const KSSun *sunptr) = 0;
81
82 /**
83 * @return true if the Moon is nearer to Earth than Saturn.
84 * @param id which moon? 0=Mimas,1=Enceladus,2=Tethys,3=Dione,4=Rhea,5=Titan,6=Hyperion,7=Lapetus
85 */
86 inline bool inFront(int id) const { return InFront[id]; }
87
88 /**
89 * @return the X-coordinate in the planet-centered coord. system.
90 * @param i which moon?
91 */
92 double x(int i) const { return XP[i]; }
93
94 /**
95 * @return the Y-coordinate in the planet-centered coord. system.
96 * @param i which moon?
97 */
98 double y(int i) const { return YP[i]; }
99
100 /**
101 * @return the Z-coordinate in the Planet-centered coord. system.
102 * @param i which moon?
103 */
104 double z(int i) const { return ZP[i]; }
105
106 /** @return the number of moons around the planet */
107 int nMoons() const { return Moon.size(); }
108
109 protected:
111 QVector<bool> InFront;
112 //the rectangular position, relative to the planet. X-axis is equator of the planet; units are planet Radius
113 QVector<double> XP, YP, ZP;
114
115 private:
116 PlanetMoons(const PlanetMoons &);
117 PlanetMoons &operator=(const PlanetMoons &);
118};
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.
Child class of KSPlanetBase; encapsulates information about the Sun.
Definition kssun.h:24
Implements the moons of a planet.
Definition planetmoons.h:30
double y(int i) const
Definition planetmoons.h:98
int nMoons() const
TrailObject * moon(int id)
Definition planetmoons.h:45
bool inFront(int id) const
Definition planetmoons.h:86
virtual void findPosition(const KSNumbers *num, const KSPlanetBase *pla, const KSSun *sunptr)=0
Find the positions of each Moon, relative to the planet.
double z(int i) const
virtual ~PlanetMoons()
Destructor.
double x(int i) const
Definition planetmoons.h:92
void EquatorialToHorizontal(const dms *LSTh, const dms *lat)
Convert the RA,Dec coordinates of each moon to Az,Alt.
PlanetMoons()=default
Constructor.
QString name(int id) const
provides a SkyObject with an attachable Trail
Definition trailobject.h:22
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 Fri Jul 12 2024 12:00:41 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.