Kstars

ksearthshadow.h
1 /*
2  SPDX-FileCopyrightText: 2018 Valentin Boettcher <[email protected] (do not hesitate to contact)>
3  matrix : @[email protected]
4 
5  SPDX-License-Identifier: GPL-2.0-or-later
6 */
7 
8 #pragma once
9 
10 #include "ksplanetbase.h"
11 
12 class KSSun;
13 class KSMoon;
14 class KSPlanet;
15 
16 /**
17  * @class KSEarthShadow
18  * @short A class that manages the calculation of the
19  * earths shadow (in moon distance) as a 'virtual' skyobject.
20  * KSMoon is responsible for coordinating this object. While a
21  * rather unusual measure, this method ensures that unnecessary
22  * calculations are avoided.
23  *
24  * @author Valentin Boettcher
25  * @version 1.0
26  */
28 {
29  public:
30  /**
31  * @param moon - an instance of KSMoon
32  * @param sun - an instance of KSSun
33  * @param earth - an instance of KSPlanet
34  * @note The three parameters must be supplied to avoid initialization order
35  * problems. This class may be generalized to any three bodies if it becomes
36  * necessary in the future.
37  * This class is relatively cheap, so it's save to create new instances instead
38  * of reusing an existing one.
39  */
40  KSEarthShadow(const KSMoon *moon, const KSSun *sun, const KSPlanet * earth);
41 
42  /**
43  * @brief The ECLIPSE_TYPE enum describes the quality of an eclipse.
44  */
46  {
47  PARTIAL, FULL_PENUMBRA, FULL_UMBRA, NONE
48  };
49 
50  /**
51  * @short The earths shadow on the moon appears only at new moon
52  * so calculating it on other occasions is rather pointless.
53  * @return whether to update the shadow or not
54  */
55  bool shouldUpdate();
56 
57 
58  /**
59  * @brief isInEclipse - a slim version of getEclipseType()
60  * @return Whether the earth shadow eclipses the moon.
61  */
62  bool isInEclipse();
63 
64  /**
65  * @brief eclipse
66  * @return The eclipse type. @see KSEarthShadow::ECLIPSE_TYPE
67  */
69 
70  bool findGeocentricPosition(const KSNumbers *, const KSPlanetBase * Earth = nullptr) override;
71 
72  /**
73  * @short Update the Coordinates of the shadow.
74  * In truth it finds the sun and calls KSEarthShadow::updateCoords(const KSSun *)
75  */
76  void updateCoords(const KSNumbers *num, bool includePlanets = true, const CachingDms *lat = nullptr,
77  const CachingDms *LST = nullptr, bool forceRecompute = false) override;
78 
79  /**
80  * @short Update the RA/DEC of the shadow.
81  */
82  void updateCoords();
83 
84  /**
85  * @short Updates umbra and penumbra radius from the positions of the three bodies.
86  */
87  void calculateShadowRadius();
88 
89  /**
90  * @return The angular radius of the umbra.
91  */
92  double getUmbraAngSize() const
93  {
94  return m_umbra_ang;
95  }
96 
97  /**
98  * @return The angular radius of the penumbra.
99  */
100  double getPenumbraAngSize() const
101  {
102  return m_penumbra_ang;
103  }
104 
105  /**
106  * @brief angSize
107  * @return the angular size (penumbra) in arc minutes
108  */
109  double findAngularSize() final override
110  {
112  return m_penumbra_ang;
113  }
114 
115  // Some Compatibility Nonsense
116  void findMagnitude(const KSNumbers *) override {} // Empty
117  bool loadData() override
118  {
119  return true;
120  }
121  void findPhase() override {}
122 
123  private:
124  double m_umbra_ang { 0 }; // Radius!
125  double m_penumbra_ang { 0 }; // Radius!
126 
127  const KSSun* m_sun { nullptr };
128  const KSMoon* m_moon { nullptr };
129  const KSPlanet* m_earth { nullptr };
130 
131  void findSun();
132  void findMoon();
133  void findEarth();
134 };
ECLIPSE_TYPE
The ECLIPSE_TYPE enum describes the quality of an eclipse.
Definition: ksearthshadow.h:45
a dms subclass that caches its sine and cosine values every time the angle is changed.
Definition: cachingdms.h:18
void findMagnitude(const KSNumbers *) override
Computes the visual magnitude for the major planets.
void updateCoords()
Update the RA/DEC of the shadow.
void calculateShadowRadius()
Updates umbra and penumbra radius from the positions of the three bodies.
bool isInEclipse()
isInEclipse - a slim version of getEclipseType()
KSEarthShadow(const KSMoon *moon, const KSSun *sun, const KSPlanet *earth)
Provides necessary information about the Moon. A subclass of SkyObject that provides information need...
Definition: ksmoon.h:25
A class that manages the calculation of the earths shadow (in moon distance) as a 'virtual' skyobject...
Definition: ksearthshadow.h:27
Provides necessary information about the Sun.
Definition: kssun.h:23
Store several time-dependent astronomical quantities.
Definition: ksnumbers.h:42
double getUmbraAngSize() const
Definition: ksearthshadow.h:92
bool findGeocentricPosition(const KSNumbers *, const KSPlanetBase *Earth=nullptr) override
find the object's current geocentric equatorial coordinates (RA and Dec) This function is pure virtua...
Provides necessary information about objects in the solar system.
Definition: ksplanet.h:32
double getPenumbraAngSize() const
double findAngularSize() final override
angSize
void findPhase() override
Determine the phase of the planet.
bool shouldUpdate()
The earths shadow on the moon appears only at new moon so calculating it on other occasions is rather...
Provides necessary information about objects in the solar system.
Definition: ksplanetbase.h:49
ECLIPSE_TYPE getEclipseType()
eclipse
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Jun 4 2023 03:57:13 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.