File indexing completed on 2024-04-14 14:11:27

0001 /*
0002     SPDX-FileCopyrightText: 2001 Jason Harris <jharris@30doradus.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "ksplanetbase.h"
0010 
0011 /**
0012  * @class KSComet
0013  * @short A subclass of KSPlanetBase that implements comets.
0014  *
0015  * The orbital elements are stored as private member variables, and
0016  * it provides methods to compute the ecliptic coordinates for any
0017  * time from the orbital elements.
0018  *
0019  * All elements are in the heliocentric ecliptic J2000 reference frame.
0020  *
0021  * Check here for full description: https://ssd.jpl.nasa.gov/?sb_elem#legend
0022  *
0023  * The orbital elements are:
0024  * @li JD    Epoch of element values
0025  * @li q     perihelion distance (AU)
0026  * @li e     eccentricity of orbit
0027  * @li i     inclination angle (with respect to J2000.0 ecliptic plane)
0028  * @li w     argument of perihelion (w.r.t. J2000.0 ecliptic plane)
0029  * @li N     longitude of ascending node (J2000.0 ecliptic)
0030  * @li Tp    time of perihelion passage (YYYYMMDD.DDD)
0031  * @li M1    comet total magnitude parameter
0032  * @li M2    comet nuclear magnitude parameter
0033  * @li K1    total magnitude slope parameter
0034  * @li K2    nuclear magnitude slope parameter
0035  *
0036  * @author Jason Harris
0037  * @version 1.1
0038  */
0039 
0040 class KSNumbers;
0041 class dms;
0042 
0043 class KSComet : public KSPlanetBase
0044 {
0045   public:
0046     /**
0047      * Constructor.
0048      * @param s the name of the comet
0049      * @param image_file the filename for an image of the comet
0050      * @param q the perihelion distance of the comet's orbit (AU)
0051      * @param e the eccentricity of the comet's orbit
0052      * @param i the inclination angle of the comet's orbit
0053      * @param w the argument of the orbit's perihelion
0054      * @param N the longitude of the orbit's ascending node
0055      * @param Tp The date of the most proximate perihelion passage (YYYYMMDD.DDD)
0056      * @param M1 the comet total magnitude parameter
0057      * @param M2 the comet nuclear magnitude parameter
0058      * @param K1 the comet total magnitude slope parameter
0059      * @param K2 the comet nuclear magnitude slope parameter
0060      */
0061     KSComet(const QString &s, const QString &image_file, double q, double e, dms i, dms w, dms N,
0062             double Tp, float M1, float M2, float K1, float K2);
0063 
0064     KSComet *clone() const override;
0065     SkyObject::UID getUID() const override;
0066 
0067     /** Destructor (empty)*/
0068     ~KSComet() override = default;
0069 
0070     /**
0071      * Unused virtual function inherited from KSPlanetBase thus it's simply empty here.
0072      */
0073     bool loadData() override;
0074 
0075     /**
0076      * @short Returns the Julian Day of Perihelion passage
0077      * @return Julian Day of Perihelion Passage
0078      */
0079     inline long double getPerihelionJD() { return JDp; }
0080 
0081     /**
0082      * @short Returns Perihelion distance
0083      * @return Perihelion distance
0084      */
0085     inline double getPerihelion() { return q; }
0086 
0087     /** @return the comet total magnitude parameter */
0088     inline float getTotalMagnitudeParameter() { return M1; }
0089 
0090     /** @return the comet nuclear magnitude parameter */
0091     inline float getNuclearMagnitudeParameter() { return M2; }
0092 
0093     /** @return the total magnitude slope parameter */
0094     inline float getTotalSlopeParameter() { return K1; }
0095 
0096     /** @return the nuclear magnitude slope parameter */
0097     inline float getNuclearSlopeParameter() { return K2; }
0098 
0099     /** @short Sets the comet's tail length in km */
0100     void setTailSize(double tailsize) { TailSize = tailsize; }
0101 
0102     /** @return the estimated tail length in km */
0103     inline float getTailSize() { return TailSize; }
0104 
0105     /** @short Sets the comet's apparent tail length in degrees */
0106     void setComaAngSize(double comaAngSize) { ComaAngSize = comaAngSize; }
0107 
0108     /** @return the estimated angular size of the tail as a dms */
0109     inline dms getComaAngSize() { return dms(ComaAngSize); }
0110 
0111     /** @return the estimated diameter of the nucleus in km */
0112     inline float getNuclearSize() { return NuclearSize; }
0113 
0114     /** @short Sets the comet's earth minimum orbit intersection distance */
0115     void setEarthMOID(double earth_moid);
0116 
0117     /** @return the comet's earth minimum orbit intersection distance in km */
0118     inline double getEarthMOID() { return EarthMOID; }
0119 
0120     /** @short Sets the comet's orbit solution ID */
0121     void setOrbitID(QString orbit_id);
0122 
0123     /** @return the comet's orbit solution ID */
0124     inline QString getOrbitID() { return OrbitID; }
0125 
0126     /** @short Sets the comet's orbit class */
0127     void setOrbitClass(QString orbit_class);
0128 
0129     /** @return the comet's orbit class */
0130     inline QString getOrbitClass() { return OrbitClass; }
0131 
0132     /** @short Sets if the comet is a near earth object */
0133     void setNEO(bool neo);
0134 
0135     /** @return true if the comet is a near earth object */
0136     inline bool isNEO() { return NEO; }
0137 
0138     /** @short Sets the comet's albedo */
0139     void setAlbedo(float albedo);
0140 
0141     /** @return the comet's albedo */
0142     inline float getAlbedo() { return Albedo; }
0143 
0144     /** @short Sets the comet's diameter */
0145     void setDiameter(float diam);
0146 
0147     /** @return the comet's diameter */
0148     inline float getDiameter() { return Diameter; }
0149 
0150     /** @short Sets the comet's dimensions */
0151     void setDimensions(QString dim);
0152 
0153     /** @return the comet's dimensions */
0154     inline QString getDimensions() { return Dimensions; }
0155 
0156     /** @short Sets the comet's rotation period */
0157     void setRotationPeriod(float rot_per);
0158 
0159     /** @return the comet's rotation period */
0160     inline float getRotationPeriod() { return RotationPeriod; }
0161 
0162     /** @short Sets the comet's period */
0163     void setPeriod(float per);
0164 
0165     /** @return the comet's period */
0166     inline float getPeriod() { return Period; }
0167 
0168   protected:
0169     /**
0170      * Calculate the geocentric RA, Dec coordinates of the Comet.
0171      * @note reimplemented from KSPlanetBase
0172      * @param num time-dependent values for the desired date
0173      * @param Earth planet Earth (needed to calculate geocentric coords)
0174      * @return true if position was successfully calculated.
0175      */
0176     bool findGeocentricPosition(const KSNumbers *num, const KSPlanetBase *Earth = nullptr) override;
0177 
0178     /**
0179      * @short Estimate physical parameters of the comet such as coma size, tail length and size of the nucleus
0180      * @note invoked from findGeocentricPosition in order
0181      */
0182     void findPhysicalParameters();
0183 
0184   private:
0185     void findMagnitude(const KSNumbers *) override;
0186 
0187     long double JDp { 0 };
0188     double q { 0 };
0189     double e { 0 };
0190     double a { 0 };
0191     double P { 0 };
0192     double EarthMOID { 0 };
0193     double TailSize { 0 };
0194     double ComaAngSize { 0 };
0195     double ComaSize { 0 };
0196     double NuclearSize { 0 };
0197     float M1 { 0 };
0198     float M2 { 0 };
0199     float K1 { 0 };
0200     float K2 { 0 };
0201     float Albedo { 0 };
0202     float Diameter { 0 };
0203     float RotationPeriod { 0 };
0204     float Period { 0 };
0205     dms i, w, N;
0206     QString OrbitID, OrbitClass, Dimensions;
0207     bool NEO { false };
0208     /// Part of UID
0209     qint64 uidPart { 0 };
0210 };