Stellarium  24.3
Data Structures | Public Types | Public Member Functions | Static Public Member Functions | Data Fields | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends
Planet Class Reference

The Planet class is used for the major planets, moons, "Observer" planets, and artificial objects ("Spaceship"). More...

#include <Planet.hpp>

Data Structures

struct  PlanetOBJModel
 

Public Types

enum  PlanetType {
  isStar , isPlanet , isMoon , isObserver ,
  isArtificial , isAsteroid , isPlutino , isComet ,
  isDwarfPlanet , isCubewano , isSDO , isOCO ,
  isSednoid , isInterstellar , isUNDEFINED
}
 numeric typecodes for the type descriptions in ssystem.ini
 
enum  PlanetOrbitColorStyle { ocsOneColor , ocsGroups , ocsMajorPlanets , ocsMajorPlanetsMinorTypes }
 
enum  ApparentMagnitudeAlgorithm {
  Mueller_1893 , AstronomicalAlmanac_1984 , ExplanatorySupplement_1992 , ExplanatorySupplement_2013 ,
  MallamaHilton_2018 , UndefinedAlgorithm , Generic
}
 
enum  PositionQuality { Position , OrbitPlotting }
 enums to indicate for which purpose we check positional quality. More...
 
- Public Types inherited from StelObject
enum  InfoStringGroupFlags {
  None = 0x00000000 , Name = 0x00000001 , CatalogNumber = 0x00000002 , Magnitude = 0x00000004 ,
  RaDecJ2000 = 0x00000008 , RaDecOfDate = 0x00000010 , AltAzi = 0x00000020 , Distance = 0x00000040 ,
  Elongation = 0x00000080 , Size = 0x00000100 , Velocity = 0x00000200 , ProperMotion = 0x00000400 ,
  Extra = 0x00000800 , HourAngle = 0x00001000 , AbsoluteMagnitude = 0x00002000 , GalacticCoord = 0x00004000 ,
  SupergalacticCoord = 0x00008000 , OtherCoord = 0x00010000 , ObjectType = 0x00020000 , EclipticCoordJ2000 = 0x00040000 ,
  EclipticCoordOfDate = 0x00080000 , IAUConstellation = 0x00100000 , SiderealTime = 0x00200000 , RTSTime = 0x00400000 ,
  SolarLunarPosition = 0x00800000 , Script = 0x01000000 , DebugAid = 0x02000000 , NoFont = 0x04000000 ,
  PlainText = 0x08000000
}
 Used as named bitfield flags as specifiers to filter results of getInfoString. More...
 

Public Member Functions

 Planet (const QString &englishName, double equatorialRadius, double oblateness, Vec3f halocolor, float albedo, float roughness, const QString &texMapName, const QString &normalMapName, const QString &ahorizonMapName, const QString &objModelName, posFuncType _coordFunc, Orbit *anOrbitPtr, OsculatingFunctType *osculatingFunc, bool closeOrbit, bool hidden, bool hasAtmosphere, bool hasHalo, const QString &pTypeStr)
 
QString getInfoString (const StelCore *core, const InfoStringGroup &flags) const override
 Get a string with data about the Planet. More...
 
QVariantMap getInfoMap (const StelCore *core) const override
 In addition to the entries from StelObject::getInfoMap(), Planet objects provide. More...
 
double getCloseViewFov (const StelCore *core) const override
 Return the best FOV in degree to use for a close view of the object.
 
double getSatellitesFov (const StelCore *core) const override
 Return the best FOV in degree to use for a global view of the object satellite system (if there are satellites)
 
double getParentSatellitesFov (const StelCore *core) const override
 
float getVMagnitude (const StelCore *core) const override
 This actually calls getVMagnitude(core, 1.0); If there is danger the object is partly obscured (eclipsed), prefer to use getVMagnitude(core, eclipseFactor).
 
virtual float getVMagnitude (const StelCore *core, double eclipseFactor) const
 Compute visual magnitude following the algorithm set in setApparentMagnitudeAlgorithm(). More...
 
float getSelectPriority (const StelCore *core) const override
 Return a priority value which is used to discriminate objects by priority As for magnitudes, the lower is the higher priority.
 
Vec3f getInfoColor (void) const override
 Get a color used to display info about the object.
 
QString getType (void) const override
 
QString getObjectType (void) const override
 Get more specific Planet type for scripts. More...
 
QString getObjectTypeI18n (void) const override
 Get more specific Planet type for scripts. More...
 
QString getID (void) const override
 
Vec3d getJ2000EquatorialPos (const StelCore *core) const override
 A Planet's own eclipticPos is in VSOP87 ref. More...
 
QString getEnglishName (void) const override
 Return object's name in english.
 
QString getNameI18n (void) const override
 Return translated object's name.
 
virtual QString getIAUDesignation (void) const
 
QString getNativeName (void) const
 
QString getNativeNameI18n (void) const
 
QString getCommonEnglishName (void) const
 
QString getCommonNameI18n (void) const
 
double getAngularRadius (const StelCore *core) const override
 Get angular semidiameter, degrees. If planet display is artificially enlarged (e.g. Moon upscale), value will also be increased.
 
virtual bool hasAtmosphere (void)
 
virtual bool hasHalo (void)
 
bool hasValidPositionalData (const double JDE, const PositionQuality purpose) const
 Returns whether planet positions are valid and useful for the current simulation time. More...
 
Vec2d getValidPositionalDataRange (const PositionQuality purpose) const
 Returns JDE dates of presumably valid data for positional calculation or acceptable range for graphics. More...
 
float getAxisRotation (void)
 
virtual void translateName (const StelTranslator &trans)
 return axisRotation last computed in computeTransMatrix(). [degrees] More...
 
virtual void draw (StelCore *core, float maxMagLabels, const QFont &planetNameFont, const double eclipseFactor)
 
double getEquatorialRadius (void) const
 Get the equator radius of the planet in AU. More...
 
double getOneMinusOblateness (void) const
 Get the value (1-f) for oblateness f=polarRadius/equatorialRadius.
 
double getPolarRadius (void) const
 Get the polar radius of the planet in AU. More...
 
double getSiderealDay (void) const
 Get duration of sidereal day (earth days, may come from rot_periode or orbit_period (for moons) from ssystem_*.ini)
 
virtual double getSiderealPeriod (void) const
 Get duration of sidereal year [earth days].
 
void setSiderealPeriod (const double siderealPeriod)
 set duration of sidereal year. More...
 
double getMeanSolarDay (void) const
 Get duration of mean solar day, in earth days.
 
double getAlbedo (void) const
 Get albedo.
 
const QString & getTextMapName () const
 
PlanetType getPlanetType () const
 
OrbitgetOrbit () const
 
void setNativeName (QString planet)
 
void setNativeNameMeaning (QString planet)
 
void setIAUMoonNumber (const QString &designation)
 set the IAU moon number (designation of the moon), if any.
 
void setColorIndexBV (float bv=99.f)
 set value for color index B-V
 
void setDiscoveryData (const QString &date, const QString &name)
 set the discovery circumstances of celestial body More...
 
float getAbsoluteMagnitude () const
 Return the absolute magnitude (read from file ssystem.ini)
 
float getMeanOppositionMagnitude () const
 Return the mean opposition magnitude, defined as V(1,0)+5log10(a(a-1)) A return value of 100 signals invalid result.
 
double getMass () const
 Return the mass in kg.
 
double getSiderealTime (double JD, double JDE) const
 Compute the axial z rotation (daily rotation around the polar axis) [degrees] to use from equatorial to hour angle based coordinates. More...
 
Mat4d getRotEquatorialToVsop87 (void) const
 return a rotation matrix from the planet's equatorial coordinate frame to the VSOP87 (ecliptical J2000) frame. More...
 
void setRotEquatorialToVsop87 (const Mat4d &m)
 set a rotation matrix from the planet's equatorial coordinate frame to the VSOP87 (ecliptical J2000) frame. More...
 
const RotationElementsgetRotationElements (void) const
 
void setRotationElements (const QString name, const double _period, const double _offset, const double _epoch, const double _obliquity, const double _ascendingNode, const double _ra0, const double _ra1, const double _de0, const double _de1, const double _w0, const double _w1)
 Set the rotational elements. More...
 
double getRotAscendingNode (void) const
 Note: The only place where this is used is to build up orbits for planet moons w.r.t. the parent planet orientation.
 
double getRotObliquity (double JDE) const
 return angle between axis and normal of ecliptic plane (or, for a moon, equatorial/reference plane defined by parent). More...
 
virtual void computePosition (const StelObserver *observer, const double dateJDE, const Vec3d &aberrationPush)
 Compute the position and orbital velocity in the parent Planet coordinate system and set aberrationPush Does not compute new position when dateJDE is less than deltaJDE away from lastJDE You can add the aberrationPush value according to Edot*lightTime in Explanatory Supplement (2013) formula 7.55.
 
virtual void computePosition (const double dateJDE, Vec3d &eclPosition, Vec3d &eclVelocity) const
 Compute the position and orbital velocity in the parent Planet coordinate system, and return them in eclPosition and eclVelocity These may be preferred when we want to avoid setting the actual position (e.g., RTS computation)
 
void computeTransMatrix (double JD, double JDE)
 Compute the transformation matrix from the local Planet coordinate to the parent Planet coordinate. More...
 
Vec4d getRectangularCoordinates (const double longDeg, const double latDeg, const double altMetres=0.) const
 Retrieve planetocentric rectangular coordinates of a location on the ellipsoid surface, or with altitude altMetres above the ellipsoid surface. More...
 
Vec4d getHourlyProperMotion (const StelCore *core) const
 Retrieve the hourly proper motion of Solar system bodies. More...
 
double getPhaseAngle (const Vec3d &obsPos) const
 Get the phase angle (radians) for an observer at pos obsPos in heliocentric coordinates (in AU)
 
bool isWaning (const Vec3d &observerPosition, const Vec3d &observerVelocity) const
 Check whether the planet is in a waning phase, i.e. its phase angle is increasing.
 
double getElongation (const Vec3d &obsPos) const
 Get the elongation angle (radians) for an observer at pos obsPos in heliocentric coordinates (in AU)
 
double getSpheroidAngularRadius (const StelCore *core) const
 Get the angular radius (degrees) of the planet spheroid (i.e. without the rings)
 
float getPhase (const Vec3d &obsPos) const
 Get the planet phase (illuminated fraction of the planet disk, [0=dark..1=full]) for an observer at pos obsPos in heliocentric coordinates (in AU)
 
QPair< Vec4d, Vec3dgetSubSolarObserverPoints (const StelCore *core, bool jupiterGraphical=false) const
 Get planetographic coordinates of subsolar and sub-observer points. More...
 
bool isRotatingRetrograde () const
 returns if planet has retrograde rotation
 
Vec3d getEclipticPos (double dateJDE) const
 Get the Planet position in the parent Planet ecliptic coordinate in AU.
 
Vec3d getEclipticPos () const
 Get the last computed Planet position in the parent Planet ecliptic coordinate in AU.
 
Vec3d getHeliocentricEclipticPos () const
 Return the heliocentric ecliptical position.
 
Vec3d getHeliocentricEclipticPos (double dateJDE) const
 
Vec3d getHeliocentricPos (Vec3d p) const
 Return the heliocentric transformation for local (parentocentric) coordinate. More...
 
void setHeliocentricEclipticPos (const Vec3d &pos)
 Propagate the heliocentric coordinates to parentocentric coordinates. More...
 
Vec3d getEclipticVelocity () const
 Get the planet velocity around the parent planet in ecliptical coordinates in AU/d.
 
Vec3d getHeliocentricEclipticVelocity () const
 Get the planet's heliocentric velocity in the solar system in ecliptical coordinates in AU/d. Required for aberration!
 
double computeDistance (const Vec3d &obsHelioPos)
 Compute and return the distance to the given position in heliocentric ecliptical (J2000) coordinates (in AU) Preserves result for later retrieval by getDistance() As side effect, improve fps by juggling update frequency (deltaJDE) for asteroids and other minor bodies. More...
 
double getDistance (void) const
 Return the last computed distance to the given position in heliocentric ecliptical (J2000) coordinates (in AU)
 
void setRings (Ring *r)
 
void setSphereScale (double s)
 
double getSphereScale () const
 
const QSharedPointer< PlanetgetParent (void) const
 
virtual void update (int deltaTime)
 
void setFlagHints (bool b)
 
bool getFlagHints (void) const
 
void setFlagLabels (bool b)
 
bool getFlagLabels (void) const
 
void setFlagNativeName (bool b)
 
bool getFlagNativeName (void) const
 
void setFlagOrbits (bool b)
 
bool getFlagOrbits (void) const
 
void drawOrbit (const StelCore *)
 
QVector< const Planet * > getCandidatesForShadow () const
 Return the list of planets which project some shadow on this planet.
 
Vec3d getAberrationPush () const
 
virtual Vec4d getClosestRTSTime (const StelCore *core, const double altitude=0.) const
 Compute times of nearest rise, transit and set for a solar system object for current location. More...
 
Vec4d getRTSTime (const StelCore *core, const double altitude=0.) const override
 Adaptation of getClosestRTSTime() to compute times of rise, transit and set for a solar system object for current location and date. More...
 
void resetTextures ()
 
void replaceTexture (const QString &texName)
 
- Public Member Functions inherited from StelObject
SphericalRegionP getRegion () const override
 Default implementation of the getRegion method. More...
 
Vec3d getPointInRegion () const override
 Default implementation of the getPointInRegion method. More...
 
Vec3d getEquinoxEquatorialPos (const StelCore *core) const
 Get observer-centered equatorial coordinate at the current equinox The frame has its Z axis at the planet's current rotation axis At time 2000-01-01 this frame is almost the same as J2000, but ONLY if the observer is on earth.
 
Vec3d getEquinoxEquatorialPosApparent (const StelCore *core) const
 Like getEquinoxEquatorialPos(core), but always adds refraction correction to the position.
 
Vec3d getEquinoxEquatorialPosAuto (const StelCore *core) const
 Like getEquinoxEquatorialPos(core), but adds refraction correction to the position if atmosphere is active.
 
Vec3d getGalacticPos (const StelCore *core) const
 Get observer-centered galactic coordinates.
 
Vec3d getSupergalacticPos (const StelCore *core) const
 Get observer-centered supergalactic coordinates.
 
Vec3d getSiderealPosGeometric (const StelCore *core) const
 Get observer-centered hour angle + declination (at current equinox) It is the geometric position, i.e. More...
 
Vec3d getSiderealPosApparent (const StelCore *core) const
 Get observer-centered hour angle + declination (at current equinox) It is the apparent position, i.e. More...
 
Vec3d getAltAzPosGeometric (const StelCore *core) const
 Get observer-centered alt/az position It is the geometric position, i.e. More...
 
Vec3d getAltAzPosApparent (const StelCore *core) const
 Get observer-centered alt/az position It is the apparent position, i.e. More...
 
Vec3d getAltAzPosAuto (const StelCore *core) const
 Get observer-centered alt/az position It is the automatic position, i.e. More...
 
float getParallacticAngle (const StelCore *core) const
 Get parallactic angle, which is the deviation between zenith angle and north angle. [radians].
 
bool isAboveHorizon (const StelCore *core) const
 Checking position an object above mathematical horizon for current location. More...
 
bool isAboveRealHorizon (const StelCore *core) const
 Checking position an object above real horizon for current location. More...
 
float getVMagnitudeWithExtinction (const StelCore *core, const float knownVMag=-1000.f) const
 Return object's apparent V magnitude as seen from observer including extinction. More...
 
virtual float getAirmass (const StelCore *core) const
 Return airmass value for the object (for atmosphere-dependent calculations) More...
 

Static Public Member Functions

static void init ()
 Initializes static vars. Must be called before creating first planet.
 
static ApparentMagnitudeAlgorithm getApparentMagnitudeAlgorithm ()
 
static const QString getApparentMagnitudeAlgorithmString ()
 
static void setApparentMagnitudeAlgorithm (QString algorithm)
 
static void setApparentMagnitudeAlgorithm (ApparentMagnitudeAlgorithm algorithm)
 
static float getPAsun (const Vec3d &sunPos, const Vec3d &objPos)
 Get the position angle of the illuminated limb of a planet The result depends on the arguments' coordinate system which must be identical. More...
 
static void setLabelColor (const Vec3f &lc)
 
static const Vec3fgetLabelColor (void)
 
static void setOrbitColor (const Vec3f &oc)
 
static const Vec3fgetOrbitColor ()
 
static void setMajorPlanetOrbitColor (const Vec3f &oc)
 
static const Vec3fgetMajorPlanetOrbitColor ()
 
static void setMoonOrbitColor (const Vec3f &oc)
 
static const Vec3fgetMoonOrbitColor ()
 
static void setMinorPlanetOrbitColor (const Vec3f &oc)
 
static const Vec3fgetMinorPlanetOrbitColor ()
 
static void setDwarfPlanetOrbitColor (const Vec3f &oc)
 
static const Vec3fgetDwarfPlanetOrbitColor ()
 
static void setCubewanoOrbitColor (const Vec3f &oc)
 
static const Vec3fgetCubewanoOrbitColor ()
 
static void setPlutinoOrbitColor (const Vec3f &oc)
 
static const Vec3fgetPlutinoOrbitColor ()
 
static void setScatteredDiscObjectOrbitColor (const Vec3f &oc)
 
static const Vec3fgetScatteredDiscObjectOrbitColor ()
 
static void setOortCloudObjectOrbitColor (const Vec3f &oc)
 
static const Vec3fgetOortCloudObjectOrbitColor ()
 
static void setCometOrbitColor (const Vec3f &oc)
 
static const Vec3fgetCometOrbitColor ()
 
static void setSednoidOrbitColor (const Vec3f &oc)
 
static const Vec3fgetSednoidOrbitColor ()
 
static void setInterstellarOrbitColor (const Vec3f &oc)
 
static const Vec3fgetInterstellarOrbitColor ()
 
static void setMercuryOrbitColor (const Vec3f &oc)
 
static const Vec3fgetMercuryOrbitColor ()
 
static void setVenusOrbitColor (const Vec3f &oc)
 
static const Vec3fgetVenusOrbitColor ()
 
static void setEarthOrbitColor (const Vec3f &oc)
 
static const Vec3fgetEarthOrbitColor ()
 
static void setMarsOrbitColor (const Vec3f &oc)
 
static const Vec3fgetMarsOrbitColor ()
 
static void setJupiterOrbitColor (const Vec3f &oc)
 
static const Vec3fgetJupiterOrbitColor ()
 
static void setSaturnOrbitColor (const Vec3f &oc)
 
static const Vec3fgetSaturnOrbitColor ()
 
static void setUranusOrbitColor (const Vec3f &oc)
 
static const Vec3fgetUranusOrbitColor ()
 
static void setNeptuneOrbitColor (const Vec3f &oc)
 
static const Vec3fgetNeptuneOrbitColor ()
 

Data Fields

bool flagNativeName
 
LinearFader orbitFader
 
Vec3d orbit [ORBIT_SEGMENTS+1]
 
double deltaJDE
 
double deltaOrbitJDE
 
bool closeOrbit
 

Static Public Attributes

static const QString PLANET_TYPE
 
static Vec3f orbitColor
 
static Vec3f orbitMajorPlanetsColor
 
static Vec3f orbitMoonsColor
 
static Vec3f orbitMinorPlanetsColor
 
static Vec3f orbitDwarfPlanetsColor
 
static Vec3f orbitCubewanosColor
 
static Vec3f orbitPlutinosColor
 
static Vec3f orbitScatteredDiscObjectsColor
 
static Vec3f orbitOortCloudObjectsColor
 
static Vec3f orbitCometsColor
 
static Vec3f orbitSednoidsColor
 
static Vec3f orbitInterstellarColor
 
static Vec3f orbitMercuryColor
 
static Vec3f orbitVenusColor
 
static Vec3f orbitEarthColor
 
static Vec3f orbitMarsColor
 
static Vec3f orbitJupiterColor
 
static Vec3f orbitSaturnColor
 
static Vec3f orbitUranusColor
 
static Vec3f orbitNeptuneColor
 
static PlanetOrbitColorStyle orbitColorStyle
 
- Static Public Attributes inherited from StelObject
static constexpr InfoStringGroup AllInfo
 A pre-defined "all available" set of specifiers for the getInfoString flags argument to getInfoString. More...
 
static constexpr InfoStringGroup DefaultInfo
 A pre-defined "default" set of specifiers for the getInfoString flags argument to getInfoString It appears useful to propose this set as post-install settings and let users configure more on demand. More...
 
static constexpr InfoStringGroup ShortInfo = static_cast<InfoStringGroup>(Name|CatalogNumber|Magnitude|RaDecJ2000)
 A pre-defined "shortest useful" set of specifiers for the getInfoString flags argument to getInfoString.
 

Protected Member Functions

virtual QString getInfoStringName (const StelCore *core, const InfoStringGroup &flags) const
 
virtual QString getInfoStringAbsoluteMagnitude (const StelCore *core, const InfoStringGroup &flags) const
 
virtual QString getInfoStringExtraMag (const StelCore *core, const InfoStringGroup &flags) const
 Any flag=Extra information to be displayed after the magnitude strings.
 
virtual QString getInfoStringSize (const StelCore *core, const InfoStringGroup &flags) const
 Any flag=Size information to be displayed.
 
virtual QString getInfoStringEloPhase (const StelCore *core, const InfoStringGroup &flags, const bool withIllum) const
 Return elongation and phase angle when flags=Elongation.
 
virtual QString getInfoStringPeriods (const StelCore *core, const InfoStringGroup &flags) const
 Return sidereal and synodic periods when flags=Extra.
 
virtual QString getInfoStringExtra (const StelCore *core, const InfoStringGroup &flags) const
 Any flag=Extra information to be displayed at the end.
 
virtual QString getDiscoveryCircumstances () const
 
void computeModelMatrix (Mat4d &result, bool solarEclipseCase) const
 Used in drawSphere() to compute shadows, and inside a function to derive eclipse sizes. More...
 
void computeOrbit ()
 Update the orbit position values.
 
Vec3f getCurrentOrbitColor () const
 
QString getPlanetLabel () const
 Return the information string "ready to print".
 
void draw3dModel (StelCore *core, StelProjector::ModelViewTranformP transfo, float screenRd, double solarEclipseFactor, bool drawOnlyRing=false)
 Draw the 3d model. More...
 
bool drawObjModel (StelPainter *painter, float screenRd)
 Draws the OBJ model, assuming it is available. More...
 
bool drawObjShadowMap (StelPainter *painter, QMatrix4x4 &shadowMatrix)
 
bool ensureObjLoaded ()
 Starts the OBJ loading process, if it has not been done yet. More...
 
void drawSphere (StelPainter *painter, float screenRd, bool drawOnlyRing=false)
 Draw the 3D sphere.
 
void drawSurvey (StelCore *core, StelPainter *painter)
 Draw the Hips survey.
 
void drawHints (const StelCore *core, StelPainter &sPainter, const QFont &planetNameFont)
 Draw the circle and name of the Planet.
 
PlanetOBJModelloadObjModel () const
 
- Protected Member Functions inherited from StelObject
QString getCommonInfoString (const StelCore *core, const InfoStringGroup &flags) const
 Format the positional info string containing J2000/of date/altaz/hour angle positions and constellation, sidereal time, etc. More...
 
virtual QString getMagnitudeInfoString (const StelCore *core, const InfoStringGroup &flags, const int decimals=1) const
 Format the magnitude info string for the object. More...
 
QString getSolarLunarInfoString (const StelCore *core, const InfoStringGroup &flags) const
 Add a section to the InfoString with just horizontal data for the Sun and Moon, when observed from Earth. More...
 
void postProcessInfoString (QString &str, const InfoStringGroup &flags) const
 Apply post processing on the info string. More...
 

Protected Attributes

QString englishName
 
QString nameI18
 
QString nativeName
 
QString nativeNameMeaning
 
QString nativeNameMeaningI18n
 
QString texMapName
 
QString normalMapName
 
QString horizonMapName
 
RotationElements re
 
double siderealPeriod
 
double equatorialRadius
 
double oneMinusOblateness
 
Vec3d eclipticPos
 
Vec3d eclipticVelocity
 
Vec3d aberrationPush
 
Vec3d screenPos
 
Vec3f haloColor
 
float absoluteMagnitude
 
double massKg
 
float albedo
 
float roughness
 
float outgas_intensity
 
float outgas_falloff
 
Mat4d rotLocalToParent
 
float axisRotation
 
StelTextureSP texMap
 
StelTextureSP normalMap
 
StelTextureSP horizonMap
 
PlanetOBJModelobjModel
 
QFuture< PlanetOBJModel * > * objModelLoader
 
QString objModelPath
 
HipsSurveyP survey
 
Ringrings
 
double distance
 
double sphereScale
 
double lastJDE
 
posFuncType coordFunc
 
OrbitorbitPtr
 
OsculatingFunctType *const osculatingFunc
 
QSharedPointer< Planetparent
 
QList< QSharedPointer< Planet > > satellites
 
LinearFader hintFader
 
LinearFader labelsFader
 
bool flagLabels
 
bool hidden
 
bool atmosphere
 
bool halo
 
PlanetType pType
 
bool multisamplingEnabled_
 
bool planetShadowsSupersampEnabled_
 
QOpenGLFunctions * gl
 

Static Protected Attributes

static StelTextureSP texEarthShadow
 
static ApparentMagnitudeAlgorithm vMagAlgorithm
 
static Vec3f labelColor
 
static StelTextureSP hintCircleTex
 
static const QMap< PlanetType, QString > pTypeMap
 
static const QMap< QString, QString > nPlanetMap
 
static const QMap< ApparentMagnitudeAlgorithm, QString > vMagAlgorithmMap
 
static bool drawMoonHalo
 
static bool drawSunHalo
 
static bool permanentDrawingOrbits
 If true, planet orbits will be drawn even if planet is off screen.
 
static int orbitsThickness
 

Friends

class SolarSystem
 

Additional Inherited Members

- Public Slots inherited from StelObject
virtual void setExtraInfoString (const InfoStringGroup &flags, const QString &str)
 Allow additions to the Info String. More...
 
virtual void addToExtraInfoString (const StelObject::InfoStringGroup &flags, const QString &str)
 Add str to the extra string. More...
 
QStringList getExtraInfoStrings (const InfoStringGroup &flags) const
 Retrieve an (unsorted) QStringList of all extra info strings that match flags. More...
 
void removeExtraInfoStrings (const InfoStringGroup &flags)
 Remove the extraInfoStrings with the given flags. More...
 

Detailed Description

The Planet class is used for the major planets, moons, "Observer" planets, and artificial objects ("Spaceship").

Major planets and many moons have their own positional computation, the others, and derivatives Comet and MinorPlanet, use KeplerOrbit for their position. "Observer" objects (Solar System Observer, Earth Observer, Mars Observer, Jupiter Observer, Saturn Observer, Uranus Observer, Neptune Observer) are positioned with a GimbalOrbit and can be rotated around their parent by keyboard interaction. These are oriented parallel to their parents' polar axis. The actual observer location must be on the North pole so that the vertical screen axis aligns with the parent planet's rotational axis.

Member Enumeration Documentation

◆ PositionQuality

enums to indicate for which purpose we check positional quality.

Objects on KeplerOrbits may be too far from their epoch to provide useful data.

Member Function Documentation

◆ computeDistance()

double Planet::computeDistance ( const Vec3d obsHelioPos)

Compute and return the distance to the given position in heliocentric ecliptical (J2000) coordinates (in AU) Preserves result for later retrieval by getDistance() As side effect, improve fps by juggling update frequency (deltaJDE) for asteroids and other minor bodies.

They must be fast if close to observer, but can be slow if further away.

◆ computeModelMatrix()

void Planet::computeModelMatrix ( Mat4d result,
bool  solarEclipseCase 
) const
protected

Used in drawSphere() to compute shadows, and inside a function to derive eclipse sizes.

Parameters
solarEclipseCaseFor reasons currently unknown we must handle solar eclipses as special case.

◆ computeTransMatrix()

void Planet::computeTransMatrix ( double  JD,
double  JDE 
)

Compute the transformation matrix from the local Planet coordinate to the parent Planet coordinate.

This requires both flavours of JD in cases involving Earth.

◆ draw3dModel()

void Planet::draw3dModel ( StelCore core,
StelProjector::ModelViewTranformP  transfo,
float  screenRd,
double  solarEclipseFactor,
bool  drawOnlyRing = false 
)
protected

Draw the 3d model.

Call the proper functions if there are rings etc..

Parameters
screenRdradius in screen pixels
solarEclipseFactorFull sun is 1.0, fully covered sun is 0.0. This should be determined beforehand so that repeated calls to this function can be avoided. It is usually safe to use 1.0 when eclipses are rare and umimportant.

◆ drawObjModel()

bool Planet::drawObjModel ( StelPainter painter,
float  screenRd 
)
protected

Draws the OBJ model, assuming it is available.

Parameters
screenRdradius in screen pixels.
Returns
false if the model can currently not be drawn (not loaded)

◆ ensureObjLoaded()

bool Planet::ensureObjLoaded ( )
protected

Starts the OBJ loading process, if it has not been done yet.

Returns true when the OBJ is ready to draw

◆ getClosestRTSTime()

virtual Vec4d Planet::getClosestRTSTime ( const StelCore core,
const double  altitude = 0. 
) const
virtual

Compute times of nearest rise, transit and set for a solar system object for current location.

Parameters
corethe currently active StelCore object
altitude(optional; default=0) altitude of the object, degrees. Setting this to -6. for the Sun will find begin and end for civil twilight.
Returns
Vec4d - time of rise, transit and set closest to current time; JD.
Note
The fourth element flags particular conditions:
  • +100. for circumpolar objects. Rise and set give lower culmination times.
  • -100. for objects never rising. Rise and set give transit times.
  • -1000. is used as "invalid" value. The result should then not be used.
This is based on Meeus, Astronomical Algorithms (2nd ed.), but deviates in details.
Limitation for efficiency: If this is a planet moon from another planet, we compute RTS for the parent planet instead!

◆ getEquatorialRadius()

double Planet::getEquatorialRadius ( void  ) const
inline

Get the equator radius of the planet in AU.

Returns
the equator radius of the planet in astronomical units.

◆ getHeliocentricPos()

Vec3d Planet::getHeliocentricPos ( Vec3d  p) const

Return the heliocentric transformation for local (parentocentric) coordinate.

  • p planetocentric rectangular ecliptical coordinate (J2000)
    Returns
    heliocentric rectangular ecliptical coordinates (J2000)

◆ getHourlyProperMotion()

Vec4d Planet::getHourlyProperMotion ( const StelCore core) const

Retrieve the hourly proper motion of Solar system bodies.

Returns
[hourlyMotion, positionAngle, deltaAlpha, deltaDelta] where hourlyMotion = hourly proper motion [radians] positionAngle = position angle (the direction of proper motion) [radians] deltaAlpha = hourly motion in R.A. [radians] deltaDelta = hourly motion in Dec. [radians]

◆ getID()

QString Planet::getID ( void  ) const
inlineoverridevirtual
Returns
English name of planet

Implements StelObject.

◆ getInfoMap()

QVariantMap Planet::getInfoMap ( const StelCore core) const
overridevirtual

In addition to the entries from StelObject::getInfoMap(), Planet objects provide.

  • phase (result of getPhase)
  • illumination (=100*phase)
  • phase-angle (radians)
  • phase-angle-dms (formatted string; DMS)
  • phase-angle-deg (formatted string; degrees)
  • elongation (radians)
  • elongation-dms (formatted string; DMS)
  • elongation-deg (formatted string; degrees)
  • ecl-elongation (elongation in ecliptic longitude or Δλ; on Earth only; radians)
  • ecl-elongation-dms (elongation in ecliptic longitude or Δλ; on Earth only; formatted string; DMS)
  • ecl-elongation-deg (elongation in ecliptic longitude or Δλ; on Earth only; formatted string; degrees)
  • type (object type description)
  • velocity (formatted string)
  • heliocentric-velocity (formatted string)
  • scale
  • eclipse-obscuration (for Sun only)
  • eclipse-magnitude (for Sun only)
  • eclipse-crescent-angle (for Sun only; degrees)
  • central_l (on Earth only; degrees)
  • central_b (on Earth only; degrees)
  • pa_axis (on Earth only; degrees)
  • subsolar_l (on Earth only; degrees)
  • subsolar_b (on Earth only; degrees)
  • libration_l (on Earth for Moon only; degrees)
  • libration_b (on Earth for Moon only; degrees)
  • colongitude (on Earth for Moon only; degrees)
  • phase-name (on Earth for Moon only; string)
  • age (on Earth for Moon only; days. This is currently "elongation angle age" only, not time since last conjunction!)
  • penumbral-eclipse-magnitude (on Earth for Moon only)
  • umbral-eclipse-magnitude (on Earth for Moon only)
  • heliocentric-distance (distance to object from the Sun; for Solar system objects, except the Sun; A.U.)
  • heliocentric-distance-km (distance to object from the Sun; for Solar system objects, except the Sun; kilometers)
  • distance (distance to object; for Solar system objects only; A.U.)
  • distance-km (distance to object; for Solar system objects only; kilometers)

Reimplemented from StelObject.

◆ getInfoString()

QString Planet::getInfoString ( const StelCore core,
const InfoStringGroup &  flags 
) const
overridevirtual

Get a string with data about the Planet.

Planets support the following InfoStringGroup flags:

  • Name
  • Magnitude
  • RaDec
  • AltAzi
  • Distance
  • Size
  • PlainText
  • Extra: Heliocentric Ecliptical Coordinates & Observer-planetocentric Ecliptical Coordinates, Phase, illumination, phase angle & elongation from the Sun
    Note
    subclasses should prefer to override only the component infostrings getInfoString...(), not this method!
    Parameters
    corethe StelCore object
    flagsa set of InfoStringGroup items to include in the return value.
    Returns
    a QString containing an HMTL encoded description of the Planet.

Implements StelObject.

◆ getJ2000EquatorialPos()

Vec3d Planet::getJ2000EquatorialPos ( const StelCore core) const
overridevirtual

A Planet's own eclipticPos is in VSOP87 ref.

frame (practically equal to ecliptic of J2000 for us) coordinates relative to the parent body (sun, planet). To get J2000 equatorial coordinates, we require heliocentric ecliptical positions (adding up parent positions) of observer and Planet. Then we use the matrix rotation multiplication with an existing matrix in StelCore to orient from eclipticalJ2000 to equatorialJ2000. The end result is a non-normalized 3D vector which allows retrieving distances etc. The positional computation is called by SolarSystem. If the core's aberration setting is active, the J2000 position will then include it.

Implements StelObject.

◆ getObjectType()

QString Planet::getObjectType ( void  ) const
inlineoverridevirtual

Get more specific Planet type for scripts.

Returns
an English type description of planet (star, planet, moon, observer, artificial, asteroid, plutino, comet, dwarf planet, cubewano, scattered disc object, Oort cloud object, sednoid, interstellar object)

Implements StelObject.

◆ getObjectTypeI18n()

QString Planet::getObjectTypeI18n ( void  ) const
inlineoverridevirtual

Get more specific Planet type for scripts.

Returns
a localized type description of planet (star, planet, moon, observer, artificial, asteroid, plutino, comet, dwarf planet, cubewano, scattered disc object, Oort cloud object, sednoid, interstellar object)

Implements StelObject.

◆ getPAsun()

static float Planet::getPAsun ( const Vec3d sunPos,
const Vec3d objPos 
)
static

Get the position angle of the illuminated limb of a planet The result depends on the arguments' coordinate system which must be identical.

E.g. if both are equatorial for equinox of date or J2000, the angle is zero when the bright limb is towards the north of the disk. An angle of 90° indicates a bright limb on the eastern limb, like an old moon. Source: Meeus, Astr.Algorithms (2nd ed.), 48.5.

◆ getPlanetType()

PlanetType Planet::getPlanetType ( ) const
inline
Returns
a type code enum

◆ getPolarRadius()

double Planet::getPolarRadius ( void  ) const
inline

Get the polar radius of the planet in AU.

Returns
the polar radius of the planet in astronomical units.

◆ getRectangularCoordinates()

Vec4d Planet::getRectangularCoordinates ( const double  longDeg,
const double  latDeg,
const double  altMetres = 0. 
) const

Retrieve planetocentric rectangular coordinates of a location on the ellipsoid surface, or with altitude altMetres above the ellipsoid surface.

Meeus, Astr. Alg. 2nd ed, Ch.11.

Parameters
longDeglongitude of location, degrees. (currently unused. Set to 0.)
latDegplanetographic latitude, degrees.
altMetresaltitude above ellipsoid surface (metres)
Returns
[rhoCosPhiPrime*a, rhoSinPhiPrime*a, phiPrime, rho*a] where a=equatorial radius [AU] phiPrime=planetocentric latitude rho*a=planetocentric distance of point [AU]

◆ getRotEquatorialToVsop87()

Mat4d Planet::getRotEquatorialToVsop87 ( void  ) const

return a rotation matrix from the planet's equatorial coordinate frame to the VSOP87 (ecliptical J2000) frame.

For planets/moons with WGCCRE rotation elements, this is just a single matrix. For objects with traditional elements, this builds up the matrix from the parents.

◆ getRotObliquity()

double Planet::getRotObliquity ( double  JDE) const

return angle between axis and normal of ecliptic plane (or, for a moon, equatorial/reference plane defined by parent).

For Earth, this is the angle between axis and normal to current ecliptic of date, i.e. the ecliptic obliquity of date JDE. Note: The only place where this is not used for Earth is to build up orbits for planet moons w.r.t. the parent planet orientation.

◆ getRTSTime()

Vec4d Planet::getRTSTime ( const StelCore core,
const double  altitude = 0. 
) const
overridevirtual

Adaptation of getClosestRTSTime() to compute times of rise, transit and set for a solar system object for current location and date.

Note
The fourth element flags particular conditions:
  • +20 for objects with no transit time on current date.
  • +30 for objects with no rise time on current date.
  • +40 for objects with no set time on current date.

Reimplemented from StelObject.

◆ getSiderealTime()

double Planet::getSiderealTime ( double  JD,
double  JDE 
) const

Compute the axial z rotation (daily rotation around the polar axis) [degrees] to use from equatorial to hour angle based coordinates.

On Earth, sidereal time on the other hand is the angle along the planet equator from RA0 to the meridian, i.e. hour angle of the first point of Aries. For Earth (of course) it is sidereal time at Greenwich. V0.21+ update: For planets and Moons, in this context this is the rotation angle W of the Prime meridian from the ascending node of the planet equator on the ICRF equator. The usual WGCCRE model is W=W0+d*W1. Some planets/moons have more complicated rotations though, these are also handled in here. The planet objects with old-style data are computed like in earlier versions of Stellarium. Their computational model is however questionable. For general applicability we need both time flavours:

Parameters
JDis JD(UT) for Earth
JDEis used for other locations

◆ getSubSolarObserverPoints()

QPair<Vec4d, Vec3d> Planet::getSubSolarObserverPoints ( const StelCore core,
bool  jupiterGraphical = false 
) const

Get planetographic coordinates of subsolar and sub-observer points.

These are defined so that over time the longitude of the central meridian increases. This means longitudes are counted positive towards the west for direct rotators and positive towards the East for negative rotators (e.g. Venus). Other cartographic conventions may have to be followed elsewhere in the program, though. (e.g. planetary feature nomenclature!) Only meaningful for earth-bound observers. Source: Explanatory Supplement 2013, 10.4.1

Parameters
jupiterGraphicalJupiter requires special treatment because its LII coordinate system does not stay in sync with the texture. (GRS is moving). Set this to true to return the incorrect, graphics-only longitude. first[0] = 10.26 phi_e [rad] Planetocentric latitude of sub-earth point first[1] = 10.26 phi'_e [rad] Planetographic latitude of sub-earth point first[2] = 10.26 lambda'_e [rad] Planetographic longitude of sub-earth point (0..2pi) first[3] = 10.29 P_n [rad] Position angle of axis north pole in equatorial coordinates of date second[0] = 10.26 phi_s [rad] Planetocentric latitude of sub-solar point second[1] = 10.26 phi'_s [rad] Planetographic latitude of sub-solar point second[2] = 10.26 lambda'_s [rad] Planetographic longitude of sub-solar point (0..2pi)
Note
: For the Moon, it is more common to give Libration angles, where L=-lambda'_e, B=phi'_e.
: For Jupiter, this returns central meridian in L_II.
: For Saturn, this returns central meridian in L_III (rotation of magnetic field).

◆ getTextMapName()

const QString& Planet::getTextMapName ( ) const
inline
Returns
texture map name

◆ getType()

QString Planet::getType ( void  ) const
inlineoverridevirtual
Returns
"Planet". For technical reasons this is also returned by Comets and MinorPlanets and the Sun. A better type is returned by getObjectType()

Implements StelObject.

◆ getValidPositionalDataRange()

Vec2d Planet::getValidPositionalDataRange ( const PositionQuality  purpose) const

Returns JDE dates of presumably valid data for positional calculation or acceptable range for graphics.

For the major planets and moons, this is always (std::numeric_limits<double>::min(), std::numeric_limits<double>::max()) For planets with Keplerian orbits, this is [epoch-orbit_good, epoch+orbit_good] or, if purpose=Position, [epoch-min(orbit_good, 365), epoch+min(orbit_good, 365)]. This should help to detect and avoid using outdated orbital elements.

◆ getVMagnitude()

virtual float Planet::getVMagnitude ( const StelCore core,
double  eclipseFactor 
) const
virtual

Compute visual magnitude following the algorithm set in setApparentMagnitudeAlgorithm().

This is most important to compute Solar magnitude during a solar eclipse.

Parameters
eclipseFactorcan be computed with SolarSystem::getSolarEclipseFactor(core)

Reimplemented in MinorPlanet, and Comet.

◆ hasValidPositionalData()

bool Planet::hasValidPositionalData ( const double  JDE,
const PositionQuality  purpose 
) const

Returns whether planet positions are valid and useful for the current simulation time.

E.g. outdated orbital elements for Kepler orbits (beyond their orbit_good .ini file entries) may lead to invalid positions which should better not be used.

Parameters
purposesignal whether result should be good enough for observation of just for plotting orbit data. For observation, date should be within the orbit_good value, or within 1 year from epoch of the orbital elements.
Note
for major planets and moons this method will always return true

◆ setDiscoveryData()

void Planet::setDiscoveryData ( const QString &  date,
const QString &  name 
)
inline

set the discovery circumstances of celestial body

Parameters
dateof discovery
nameof discoverer

◆ setHeliocentricEclipticPos()

void Planet::setHeliocentricEclipticPos ( const Vec3d pos)

Propagate the heliocentric coordinates to parentocentric coordinates.

  • pos heliocentric rectangular ecliptical coordinate (J2000)

◆ setRotationElements()

void Planet::setRotationElements ( const QString  name,
const double  _period,
const double  _offset,
const double  _epoch,
const double  _obliquity,
const double  _ascendingNode,
const double  _ra0,
const double  _ra1,
const double  _de0,
const double  _de1,
const double  _w0,
const double  _w1 
)

Set the rotational elements.

Given two data models, we must support both: the traditional elements relative to the parent object: name: English name of the object. A corrective function may be attached which depends on the name. _period: duration of sidereal rotation [Julian days] _offset: [angle at _epoch. ] _epoch: [JDE] _obliquity [rad] _ascendingNode of equator on ecliptic[rad] The more modern way to specify these elements are relative to the ICRF: ra_pole=_ra0 + T*_ra1. ra_pole and de_pole must be computed more than for initialisation for J2000 de_pole=_de0 + T*_de1. ra and de values to be stored in [rad] _w0, _w1 to be given in degrees! If _ra0 is not zero, we understand WGCCRE data ra0, ra1, de0, de1, w0, w1 are used.

◆ setRotEquatorialToVsop87()

void Planet::setRotEquatorialToVsop87 ( const Mat4d m)

set a rotation matrix from the planet's equatorial coordinate frame to the VSOP87 (ecliptical J2000) frame.

For planets/moons with WGCCRE rotation elements, this just sets this matrix. For objects with traditional elements, this builds up the matrix from the parents.

◆ setSiderealPeriod()

void Planet::setSiderealPeriod ( const double  siderealPeriod)

set duration of sidereal year.

Also sets deltaOrbitJDE and may set closeOrbit for Planet objects which have KeplerOrbits. siderealPeriod [earth days] orbital duration.

◆ translateName()

virtual void Planet::translateName ( const StelTranslator trans)
virtual

return axisRotation last computed in computeTransMatrix(). [degrees]

Translate planet name using the passed translator

Reimplemented in MinorPlanet, and Comet.