Stellarium  23.4
Data Structures | Functions
StelUtils Namespace Reference

contains general purpose utility functions. More...

Data Structures

struct  binary_function
 

Functions

QString getApplicationName ()
 Return the full name of stellarium, i.e. "Stellarium 23.1".
 
QString getApplicationVersion ()
 Return the version of stellarium, i.e. "23.1.0".
 
QString getApplicationPublicVersion ()
 Return the public version of stellarium, i.e. "23.1".
 
QString getApplicationSeries ()
 Return the series of stellarium, i.e. "23.0".
 
QString getOperatingSystemInfo ()
 Return the name and the version of operating system, i.e. "macOS 12.5".
 
QString getCompilerInfo ()
 Return the name and the version of compiler, which was used for building the planetarium, i.e. "GCC 9.3.0".
 
QString getUserAgentString ()
 Return the user agent name, i.e. "Stellarium/0.15.0 (Linux)".
 
const QString getEndLineChar ()
 
double hmsToHours (const unsigned int h, const unsigned int m, const double s)
 Convert hours, minutes, seconds to decimal hours.
 
double hmsToRad (const unsigned int h, const unsigned int m, const double s)
 Convert an angle in hms format to radian. More...
 
double dmsToRad (const int d, const unsigned int m, const double s)
 Convert an angle in +-dms format to radian. More...
 
void radToHms (double rad, unsigned int &h, unsigned int &m, double &s)
 Convert an angle in radian to hms format. More...
 
void radToDms (double rad, bool &sign, unsigned int &d, unsigned int &m, double &s)
 Convert an angle in radian to +-dms format. More...
 
void radToDecDeg (double rad, bool &sign, double &deg)
 Convert an angle in radian to decimal degree. More...
 
QString radToDecDegStr (const double angle, const int precision=4, const bool useD=false, const bool positive=false)
 Convert an angle in radian to a decimal degree string. More...
 
QString radToHmsStrAdapt (const double angle)
 Convert an angle in radian to a hms formatted string. More...
 
QString radToHmsStr (const double angle, const bool decimal=false)
 Convert an angle in radian to a hms formatted string. More...
 
QString radToDmsStrAdapt (const double angle, const bool useD=false)
 Convert an angle in radian to a dms formatted string. More...
 
QString radToDmsStr (const double angle, const bool decimal=false, const bool useD=false)
 Convert an angle in radian to a dms formatted string. More...
 
QString radToDmsPStr (const double angle, const int precision=0, const bool useD=false)
 Convert an angle in radian to a dms formatted string. More...
 
void decDegToDms (double angle, bool &sign, unsigned int &d, unsigned int &m, double &s)
 Convert an angle in decimal degree to +-dms format. More...
 
QString decDegToDmsStr (const double angle)
 Convert an angle in decimal degrees to a dms formatted string. More...
 
QString decDegToLatitudeStr (const double latitude, bool dms=true)
 Convert latitude in decimal degrees to a dms formatted string or use decimal values. More...
 
QString decDegToLongitudeStr (const double longitude, bool eastPositive=true, bool semiSphere=true, bool dms=true)
 Convert longitude in decimal degrees to a dms formatted string. More...
 
double dmsStrToRad (const QString &s)
 Convert a dms formatted string to an angle in radian. More...
 
void spheToRect (const double lng, const double lat, Vec3d &v)
 Convert from spherical coordinates to Rectangular direction. More...
 
void spheToRect (const float lng, const float lat, Vec3f &v)
 Convert from spherical coordinates to Rectangular direction. More...
 
void spheToRect (const double lng, const double lat, Vec3f &v)
 Convert from spherical coordinates to Rectangular direction. More...
 
void spheToRect (const float lng, const float lat, Vec3d &v)
 Convert from spherical coordinates to Rectangular direction. More...
 
void rectToSphe (double *lng, double *lat, const Vec3d &v)
 Convert from Rectangular direction to spherical coordinate components. More...
 
void rectToSphe (float *lng, float *lat, const Vec3d &v)
 Convert from Rectangular direction to spherical coordinate components. More...
 
void rectToSphe (float *lng, float *lat, const Vec3f &v)
 Convert from Rectangular direction to spherical coordinate components. More...
 
void rectToSphe (double *lng, double *lat, const Vec3f &v)
 Convert from Rectangular direction to spherical coordinate components. More...
 
void spheToRect (const double lng, const double lat, const double r, Vec3d &v)
 Convert from spherical coordinates (including distance) to Rectangular direction. More...
 
void rectToSphe (double *lng, double *lat, double *r, const Vec3d &v)
 Convert from Rectangular direction to spherical coordinate components (including distance). More...
 
void equToEcl (const double raRad, const double decRad, const double eclRad, double *lambdaRad, double *betaRad)
 Coordinate Transformation from equatorial to ecliptical.
 
void eclToEqu (const double lambdaRad, const double betaRad, const double eclRad, double *raRad, double *decRad)
 Coordinate Transformation from ecliptical to equatorial.
 
double getDecAngle (const QString &str)
 Convert a string longitude, latitude, RA or declination angle to radians. More...
 
bool isPowerOfTwo (const int value)
 Check if a number is a power of 2.
 
int getBiggerPowerOfTwo (int value)
 Return the smallest power of two greater than or equal to the given value.
 
int getSmallerPowerOfTwo (const int value)
 Return the largest power of two smaller than or equal to the given value.
 
double asinh (const double z)
 Return the inverse sinus hyperbolic of z.
 
int imod (const int a, const int b)
 Integer modulo where the result is always nonnegative. [0..b-1].
 
int amod (const int a, const int b)
 Integer modulo where the result is always positive. [1..b].
 
int amod (const int x, const int a, const int b)
 Integer interval modulo. [a..b)
 
double fmodpos (const double a, const double b)
 Double modulo where the result is always nonnegative. [0..(b.
 
float fmodpos (const float a, const float b)
 Float modulo where the result is always nonnegative. [0..(b.
 
int intFloorDiv (int num, int den)
 Floor integer division provides truncating to the next lower integer, also for negative numerators. More...
 
int intFloorDivLL (qint64 num, qint64 den)
 version of intFloorDiv() for large integers.
 
void getDateFromJulianDay (const double julianDay, int *year, int *month, int *day)
 Extract from julianDay a year, month, day for the Julian Date julianDay represents. More...
 
void getTimeFromJulianDay (const double julianDay, int *hour, int *minute, int *second, int *millis=Q_NULLPTR, bool *wrapDay=Q_NULLPTR)
 Extract from julianDay an hour, minute, second. More...
 
void getDateTimeFromJulianDay (const double julianDay, int *year, int *month, int *day, int *hour, int *minute, int *second, int *millis=Q_NULLPTR)
 Extract from julianDay a year, month, day, hour, minute, second and (optional) millisecond for the Julian Day julianDay represents. More...
 
double getHoursFromJulianDay (const double julianDay)
 Make hours (decimal format) from julianDay.
 
bool getDateTimeFromISO8601String (const QString &iso8601Date, int *y, int *m, int *d, int *h, int *min, float *s)
 Parse an ISO8601 date string. More...
 
QString julianDayToISO8601String (const double jd, bool addMS=false)
 Format the given Julian Day in (UTC) ISO8601 date string. More...
 
double getJulianDayFromISO8601String (const QString &iso8601Date, bool *ok)
 Return the Julian Date matching the ISO8601 date string. More...
 
QString localeDateString (const int year, const int month, const int day, const int dayOfWeek, const QString &fmt)
 Format the date and day-of-week per the format in fmt (see QDateTime::toString()). More...
 
QString localeDateString (const int year, const int month, const int day, const int dayOfWeek)
 Format the date and day-of-week per the system locale's QLocale::ShortFormat. More...
 
int getDayOfWeek (int year, int month, int day)
 Return a day number of week for date. More...
 
int getDayOfWeek (double JD)
 
QString localeDiscoveryDateString (const QString &discovery)
 Format the discovery date. More...
 
double getJDFromSystem ()
 Get the current Julian Date from system time. More...
 
double getJDFromBesselianEpoch (const double epoch)
 Get the Julian Day Number (JD) from Besselian epoch. More...
 
double qTimeToJDFraction (const QTime &time)
 Convert a time of day to the fraction of a Julian Day. More...
 
QTime jdFractionToQTime (const double jd)
 Convert a fraction of a Julian Day to a QTime.
 
double qDateTimeToJd (const QDateTime &dateTime)
 Convert a QT QDateTime class to julian day. More...
 
QDateTime jdToQDateTime (const double &jd, const Qt::TimeSpec timeSpec)
 Convert a Julian Day number to a QDateTime. More...
 
bool getJDFromDate (double *newjd, const int y, const int m, const int d, const int h, const int min, const float s)
 Compute Julian day number from calendar date. More...
 
int numberOfDaysInMonthInYear (const int month, const int year)
 
bool isLeapYear (const int year)
 
int dayInYear (const int year, const int month, const int day)
 Find day number for date in year. More...
 
Vec3i dateFromDayYear (const int day, const int year)
 Find date from day number within year and the year. More...
 
double yearFraction (const int year, const int month, const double day)
 Return a fractional year like YYYY.ddddd. For negative years, the year number is decreased. E.g. -500.5 occurs in -501.
 
bool changeDateTimeForRollover (int oy, int om, int od, int oh, int omin, int os, int *ry, int *rm, int *rd, int *rh, int *rmin, int *rs)
 
void debugQVariantMap (const QVariant &m, const QString &indent="", const QString &key="")
 Output a QVariantMap to qDebug(). Formats like a tree where there are nested objects.
 
float fastAcos (const float x)
 Compute acos(x) The taylor serie is not accurate around x=1 and x=-1.
 
float fastExp (const float x)
 Compute exp(x) for small exponents x.
 
QString hoursToHmsStr (const double hours, const bool lowprecision=false)
 Convert decimal hours to hours, minutes, seconds.
 
QString hoursToHmsStr (const float hours, const bool lowprecision=false)
 
double hmsStrToHours (const QString &s)
 Convert a hms formatted string to decimal hours.
 
QString daysFloatToDHMS (float days)
 Convert days (float) to a time string.
 
QString wrapText (const QString &s, const int limit=52)
 The method to splitting the text by substrings by some limit of string length.
 
double getDeltaTwithoutCorrection (const double jDay)
 Get Delta-T estimation for a given date. More...
 
double getDeltaTByEspenakMeeus (const double jDay)
 Get Delta-T estimation for a given date. More...
 
double getDeltaTByEspenakMeeusModified (const double jDay)
 Get Delta-T estimation for a given date. More...
 
double getDeltaTBySchoch (const double jDay)
 Get Delta-T estimation for a given date. More...
 
double getDeltaTByClemence (const double jDay)
 Get Delta-T estimation for a given date. More...
 
double getDeltaTByIAU (const double jDay)
 Get Delta-T estimation for a given date. More...
 
double getDeltaTByAstronomicalEphemeris (const double jDay)
 Get Delta-T estimation for a given date. More...
 
double getDeltaTByTuckermanGoldstine (const double jDay)
 Get Delta-T estimation for a given date. More...
 
double getDeltaTByMullerStephenson (const double jDay)
 Get Delta-T estimation for a given date. More...
 
double getDeltaTByStephenson1978 (const double jDay)
 Get Delta-T estimation for a given date. More...
 
double getDeltaTByStephenson1997 (const double jDay)
 Get Delta-T estimation for a given date. More...
 
double getDeltaTBySchmadelZech1979 (const double jDay)
 Get Delta-T estimation for a given date. More...
 
double getDeltaTByMorrisonStephenson1982 (const double jDay)
 Get Delta-T estimation for a given date. More...
 
double getDeltaTByStephensonMorrison1984 (const double jDay)
 Get Delta-T estimation for a given date. More...
 
double getDeltaTByStephensonMorrison1995 (const double jDay)
 Get Delta-T estimation for a given date. More...
 
double getDeltaTByStephensonHoulden (const double jDay)
 Get Delta-T estimation for a given date. More...
 
double getDeltaTByEspenak (const double jDay)
 Get Delta-T estimation for a given date. More...
 
double getDeltaTByBorkowski (const double jDay)
 Get Delta-T estimation for a given date. More...
 
double getDeltaTBySchmadelZech1988 (const double jDay)
 Get Delta-T estimation for a given date. More...
 
double getDeltaTByChaprontTouze (const double jDay)
 Get Delta-T estimation for a given date. More...
 
double getDeltaTByJPLHorizons (const double jDay)
 Get Delta-T estimation for a given date. More...
 
double getDeltaTByMorrisonStephenson2004 (const double jDay)
 Get Delta-T estimation for a given date. More...
 
double getDeltaTByReijs (const double jDay)
 Get Delta-T estimation for a given date. More...
 
double getDeltaTByChaprontMeeus (const double jDay)
 Get Delta-T estimation for a given date. More...
 
double getDeltaTByMeeusSimons (const double jDay)
 Get Delta-T estimation for a given date. More...
 
double getDeltaTByMontenbruckPfleger (const double jDay)
 Get Delta-T estimation for a given date. More...
 
double getDeltaTByReingoldDershowitz (const double jDay)
 Get Delta-T estimation for a given date. More...
 
double getDeltaTByBanjevic (const double jDay)
 Get Delta-T estimation for a given date. More...
 
double getDeltaTByIslamSadiqQureshi (const double jDay)
 Get Delta-T estimation for a given date. More...
 
double getDeltaTByKhalidSultanaZaidi (const double jDay)
 Get Delta-T estimation for a given date. More...
 
double getDeltaTByStephensonMorrisonHohenkerk2016 (const double jDay)
 Get Delta-T estimation for a given date. More...
 
double getMoonSecularAcceleration (const double jDay, const double ndot, const bool useDE4xx)
 Get Secular Acceleration estimation for a given year. More...
 
double getDeltaTStandardError (const double jDay)
 Get the standard error (sigma) for the value of DeltaT. More...
 
double getMoonFluctuation (const double jDay)
 Get value of the Moon fluctuation Source: The Rotation of the Earth, and the Secular Accelerations of the Sun, Moon and Planets Spencer Jones, H. More...
 
template<typename T >
int sign (T val)
 Sign function from http://stackoverflow.com/questions/1903954/is-there-a-standard-sign-function-signum-sgn-in-c-c.
 
float * ComputeCosSinTheta (const unsigned int slices)
 Compute cosines and sines around a circle which is split in "slices" parts. More...
 
float * ComputeCosSinRho (const unsigned int segments)
 Compute cosines and sines around a half-circle which is split in "segments" parts. More...
 
float * ComputeCosSinRhoZone (const float dRho, const unsigned int segments, const float minAngle)
 Compute cosines and sines around part of a circle (from top to bottom) which is split in "segments" parts. More...
 
int getFixedFromGregorian (const int year, const int month, const int day)
 Calculate fixed days (R.D.) from Gregorian date (proleptic Gregorian calendar) More...
 
int compareVersions (const QString v1, const QString v2)
 Comparison two string versions and return a result in range -1,0,1. More...
 
QByteArray uncompress (const QByteArray &data)
 Uncompress gzip or zlib compressed data.
 
QByteArray uncompress (QIODevice &device, qint64 maxBytes=-1)
 Uncompress (gzip/zlib) data from this QIODevice, which must be open and readable. More...
 
int gcd (int a, int b)
 Greatest Common Divisor (Euclid's algorithm) More...
 
int lcm (int a, int b)
 Least Common Multiple. More...
 
template<class T >
interpolate3 (T n, T y1, T y2, T y3)
 Given regularly spaced steps x1, x2, x3 and curve values y1, y2, y3, calculate an intermediate value of the 3 arguments for the given interpolation point n. More...
 
template<class T >
interpolate5 (T n, T y1, T y2, T y3, T y4, T y5)
 Given regularly spaced steps x1, x2, x3, x4, x5 and curve values y1, y2, y3, y4, y5, calculate an intermediate value of the 5 arguments for the given interpolation point n. More...
 
template<typename T >
bool isWithin (const T &value, const T &low, const T &high)
 Interval test. This checks whether. More...
 
double trunc (double x)
 
float trunc (float x)
 

Detailed Description

contains general purpose utility functions.


Data Structure Documentation

◆ StelUtils::binary_function

struct StelUtils::binary_function

template<class Arg1, class Arg2, class Result>
struct StelUtils::binary_function< Arg1, Arg2, Result >

Data Fields
typedef Arg1 first_argument_type
typedef Result result_type
typedef Arg2 second_argument_type

Function Documentation

◆ compareVersions()

int StelUtils::compareVersions ( const QString  v1,
const QString  v2 
)

Comparison two string versions and return a result in range -1,0,1.

Parameters
v1string for version 1
v2string for version 2
Returns
result (-1: v1<v2; 0: v1==v2; 1: v1>v2)

◆ ComputeCosSinRho()

float* StelUtils::ComputeCosSinRho ( const unsigned int  segments)

Compute cosines and sines around a half-circle which is split in "segments" parts.

Values are stored in the global static array cos_sin_rho. Used for the sin/cos values along a meridian for a spherical mesh.

Parameters
segmentsnumber of partitions (elsewhere called "stacks") for the half-circle

◆ ComputeCosSinRhoZone()

float* StelUtils::ComputeCosSinRhoZone ( const float  dRho,
const unsigned int  segments,
const float  minAngle 
)

Compute cosines and sines around part of a circle (from top to bottom) which is split in "segments" parts.

Values are stored in the global static array cos_sin_rho. Used for the sin/cos values along a meridian. This allows leaving away pole caps. The array now contains values for the region minAngle+segments*phi

Parameters
dRhoa difference angle between the stops
segmentsnumber of segments
minAnglestart angle inside the half-circle. maxAngle=minAngle+segments*phi

◆ ComputeCosSinTheta()

float* StelUtils::ComputeCosSinTheta ( const unsigned int  slices)

Compute cosines and sines around a circle which is split in "slices" parts.

Values are stored in the global static array cos_sin_theta. Used for the sin/cos values along a latitude circle, equator, etc. for a spherical mesh.

Parameters
slicesnumber of partitions (elsewhere called "segments") for the circle

◆ dateFromDayYear()

Vec3i StelUtils::dateFromDayYear ( const int  day,
const int  year 
)

Find date from day number within year and the year.

Meeus, AA 2nd, 1998, ch.7 p.66

Returns
Vec3i(year, month, day)

◆ dayInYear()

int StelUtils::dayInYear ( const int  year,
const int  month,
const int  day 
)

Find day number for date in year.

Meeus, Astronomical Algorithms 2nd ed., 1998, ch.7, p.65

◆ decDegToDms()

void StelUtils::decDegToDms ( double  angle,
bool &  sign,
unsigned int &  d,
unsigned int &  m,
double &  s 
)

Convert an angle in decimal degree to +-dms format.

Parameters
angleinput angle in decimal degree
signtrue if positive, false otherwise
ddegree component
mminute component
ssecond component

◆ decDegToDmsStr()

QString StelUtils::decDegToDmsStr ( const double  angle)

Convert an angle in decimal degrees to a dms formatted string.

Parameters
angleinput angle in decimal degrees

◆ decDegToLatitudeStr()

QString StelUtils::decDegToLatitudeStr ( const double  latitude,
bool  dms = true 
)

Convert latitude in decimal degrees to a dms formatted string or use decimal values.

Parameters
latitudein decimal degrees
dmsset true to use DMS formatted string

◆ decDegToLongitudeStr()

QString StelUtils::decDegToLongitudeStr ( const double  longitude,
bool  eastPositive = true,
bool  semiSphere = true,
bool  dms = true 
)

Convert longitude in decimal degrees to a dms formatted string.

Parameters
longitudein decimal degrees
eastPositiveset true to counting East direction positive
semiSphereset true to use -180..180 degrees range (0..360 degrees otherwise)
dmsset true to use DMS formatted string

◆ dmsStrToRad()

double StelUtils::dmsStrToRad ( const QString &  s)

Convert a dms formatted string to an angle in radian.

Parameters
sThe input string

◆ dmsToRad()

double StelUtils::dmsToRad ( const int  d,
const unsigned int  m,
const double  s 
)
inline

Convert an angle in +-dms format to radian.

Parameters
ddegree component
marcmin component
sarcsec component
Returns
angle in radian

◆ gcd()

int StelUtils::gcd ( int  a,
int  b 
)

Greatest Common Divisor (Euclid's algorithm)

Parameters
afirst number
bsecond number
Returns
Greatest Common Divisor

◆ getDateFromJulianDay()

void StelUtils::getDateFromJulianDay ( const double  julianDay,
int *  year,
int *  month,
int *  day 
)

Extract from julianDay a year, month, day for the Julian Date julianDay represents.

Attention
Under rare circumstances with a rounded result where julianDay=*.49999999xyz this will still round off whereas the time is less than a fraction from midnight of the next day. Depending on circumstances this may matter or not. If you need a full decoding of a Julian day number, prefer to use getDateTimeFromJulianDay()

◆ getDateTimeFromISO8601String()

bool StelUtils::getDateTimeFromISO8601String ( const QString &  iso8601Date,
int *  y,
int *  m,
int *  d,
int *  h,
int *  min,
float *  s 
)

Parse an ISO8601 date string.

Also handles negative and distant years.

◆ getDateTimeFromJulianDay()

void StelUtils::getDateTimeFromJulianDay ( const double  julianDay,
int *  year,
int *  month,
int *  day,
int *  hour,
int *  minute,
int *  second,
int *  millis = Q_NULLPTR 
)

Extract from julianDay a year, month, day, hour, minute, second and (optional) millisecond for the Julian Day julianDay represents.

This is the preferred method of complete decoding of a Julian day number.

◆ getDayOfWeek()

int StelUtils::getDayOfWeek ( int  year,
int  month,
int  day 
)

Return a day number of week for date.

Returns
number of day: 0 - sunday, 1 - monday,..

◆ getDecAngle()

double StelUtils::getDecAngle ( const QString &  str)

Convert a string longitude, latitude, RA or declination angle to radians.

Parameters
strthe angle in a format according to: angle ::= [sign¹] ( real [degs | mins | secs] | [integer degs] ( [integer mins] real secs | real mins ) ) [cardinal¹]
sign ::= + | - digit := 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 integer ::= digit [digits] real ::= integer [. integer] degs ::= d | h² | U+00B0 | U+00BA³ mins ::= m | ' secs ::= s | " cardinal ::= N² | S² | E | W ¹) A cardinal point overrides any sign. N and E result in a positive, W and S in a negative angle. ²) The use of the cardinal points N and S together with the hour sign 'H' or 'h' is forbidden. ³) The MASCULINE ORDINAL INDICATOR U+00BA is accepted, considering Spanish QWERTY keyboards. The string is parsed without regarding to case, except that, after a single real, a solitary 's' indicates seconds whereas an 'S' indicates South. It is highly recommended to use lower case for hdms and upper case for NSEW. Latitude: North is positive, South is negative. Longitude: East is positive, West is negative.
Returns
the angle in radians.

◆ getDeltaTByAstronomicalEphemeris()

double StelUtils::getDeltaTByAstronomicalEphemeris ( const double  jDay)

Get Delta-T estimation for a given date.

Implementation of algorithm by Astronomical Ephemeris (1960) for DeltaT computation. Sources: Spencer Jones, H., "The Rotation of the Earth, and the Secular Accelerations of the Sun, Moon and Planets", Monthly Notices of the Royal Astronomical Society, 99 (1939), 541-558 http://adsabs.harvard.edu/abs/1939MNRAS..99..541S or Explanatory Supplement to the Astr. Ephemeris, 1961, p.87. Also used by Mucke&Meeus, Canon of Solar Eclipses, Vienna 1983.

Parameters
jDaythe date and time expressed as a Julian day
Returns
Delta-T in seconds

◆ getDeltaTByBanjevic()

double StelUtils::getDeltaTByBanjevic ( const double  jDay)

Get Delta-T estimation for a given date.

Implementation of algorithm by Banjevic (2006) for DeltaT computation. Source: Ancient eclipses and dating the fall of Babylon Banjevic, B. Publications of the Astronomical Observatory of Belgrade, Vol. 80, p. 251-257 (2006) 2006POBeo..80..251B [http://adsabs.harvard.edu/abs/2006POBeo..80..251B]

Parameters
jDaythe date and time expressed as a Julian day
Returns
Delta-T in seconds

◆ getDeltaTByBorkowski()

double StelUtils::getDeltaTByBorkowski ( const double  jDay)

Get Delta-T estimation for a given date.

Implementation of algorithm by Borkowski (1988) for DeltaT computation. Source: ELP 2000-85 and the dynamic time-universal time relation Borkowski, K. M. Astronomy and Astrophysics (ISSN 0004-6361), vol. 205, no. 1-2, Oct. 1988, p. L8-L10. 1988A&A...205L...8B [http://adsabs.harvard.edu/abs/1988A&A...205L...8B]

Parameters
jDaythe date and time expressed as a Julian day
Returns
Delta-T in seconds

◆ getDeltaTByChaprontMeeus()

double StelUtils::getDeltaTByChaprontMeeus ( const double  jDay)

Get Delta-T estimation for a given date.

Implementation of algorithm by Chapront, Chapront-Touze & Francou (1997) & Meeus (1998) for DeltaT computation

Parameters
jDaythe date and time expressed as a Julian day
Returns
Delta-T in seconds

◆ getDeltaTByChaprontTouze()

double StelUtils::getDeltaTByChaprontTouze ( const double  jDay)

Get Delta-T estimation for a given date.

Implementation of algorithm by Chapront-Touzé & Chapront (1991) for DeltaT computation

Parameters
jDaythe date and time expressed as a Julian day
Returns
Delta-T in seconds or 0 if year not in -391..1600

◆ getDeltaTByClemence()

double StelUtils::getDeltaTByClemence ( const double  jDay)

Get Delta-T estimation for a given date.

Implementation of algorithm by Clemence (1948) for DeltaT computation, outdated but may be useful for science-historical purposes. Source: On the system of astronomical constants. Clemence, G. M. Astronomical Journal, Vol. 53, p. 169 1948AJ.....53..169C [http://adsabs.harvard.edu/abs/1948AJ.....53..169C]

Parameters
jDaythe date and time expressed as a Julian day
Returns
Delta-T in seconds

◆ getDeltaTByEspenak()

double StelUtils::getDeltaTByEspenak ( const double  jDay)

Get Delta-T estimation for a given date.

Implementation of algorithm by Espenak (1987, 1989) for DeltaT computation. This relation should not be used before around 1950 or after around 2100 (Espenak, pers. comm.).

Parameters
jDaythe date and time expressed as a Julian day
Returns
Delta-T in seconds

◆ getDeltaTByEspenakMeeus()

double StelUtils::getDeltaTByEspenakMeeus ( const double  jDay)

Get Delta-T estimation for a given date.

Note that this method is recommended for the year range: -1999 to +3000. It gives details for -500...+2150. Implementation of algorithm by Espenak & Meeus (2006) for DeltaT computation

Parameters
jDaythe date and time expressed as a Julian day
Returns
Delta-T in seconds

◆ getDeltaTByEspenakMeeusModified()

double StelUtils::getDeltaTByEspenakMeeusModified ( const double  jDay)

Get Delta-T estimation for a given date.

Note that this method is recommended for the year range: -1999 to +3000. It gives details for -500...+2150. Implementation of algorithm by Espenak & Meeus (2006) with modified formulae for DeltaT computation

Parameters
jDaythe date and time expressed as a Julian day
Returns
Delta-T in seconds

◆ getDeltaTByIAU()

double StelUtils::getDeltaTByIAU ( const double  jDay)

Get Delta-T estimation for a given date.

Implementation of algorithm by IAU (1952) for DeltaT computation, outdated but may be useful for science-historical purposes. Source: Spencer Jones, H., "The Rotation of the Earth, and the Secular Accelerations of the Sun, Moon and Planets", Monthly Notices of the Royal Astronomical Society, 99 (1939), 541-558 http://adsabs.harvard.edu/abs/1939MNRAS..99..541S

Parameters
jDaythe date and time expressed as a Julian day
Returns
Delta-T in seconds

◆ getDeltaTByIslamSadiqQureshi()

double StelUtils::getDeltaTByIslamSadiqQureshi ( const double  jDay)

Get Delta-T estimation for a given date.

Implementation of algorithm by Islam, Sadiq & Qureshi (2008 + revisited 2013) for DeltaT computation. Source: Error Minimization of Polynomial Approximation of DeltaT Islam, S. & Sadiq, M. & Qureshi, M. S. Journal of Astrophysics & Astronomy, Vol. 29, p. 363-366 (2008) http://www.ias.ac.in/jaa/dec2008/JAA610.pdf Note: These polynomials are based on the uncorrected deltaT table from the Astronomical Almanac, thus ndot = -26.0 arcsec/cy^2. Meeus & Simons (2000) corrected the deltaT table for years before 1955.5 using ndot = -25.7376 arcsec/cy^2. Therefore the accuracies stated by Meeus & Simons are correct and cannot be compared with accuracies from Islam & Sadiq & Qureshi.

Parameters
jDaythe date and time expressed as a Julian day
Returns
Delta-T in seconds

◆ getDeltaTByJPLHorizons()

double StelUtils::getDeltaTByJPLHorizons ( const double  jDay)

Get Delta-T estimation for a given date.

Implementation of the "historical" part of the algorithm by JPL Horizons for DeltaT computation.

Parameters
jDaythe date and time expressed as a Julian day
Returns
Delta-T in seconds or 0 if year not in -2999..1620 (!)

◆ getDeltaTByKhalidSultanaZaidi()

double StelUtils::getDeltaTByKhalidSultanaZaidi ( const double  jDay)

Get Delta-T estimation for a given date.

Implementation of polynomial approximation of time period 1620-2013 for DeltaT by M. Khalid, Mariam Sultana and Faheem Zaidi (2014). Source: Delta T: Polynomial Approximation of Time Period 1620-2013 Journal of Astrophysics, Vol. 2014, Article ID 480964 https://doi.org/10.1155/2014/480964

Parameters
jDaythe date and time expressed as a Julian day
Returns
Delta-T in seconds

◆ getDeltaTByMeeusSimons()

double StelUtils::getDeltaTByMeeusSimons ( const double  jDay)

Get Delta-T estimation for a given date.

Implementation of algorithm by Meeus & Simons (2000) for DeltaT computation. Source: Polynomial approximations to Delta T, 1620-2000 AD Meeus, J.; Simons, L. Journal of the British Astronomical Association, vol.110, no.6, 323 2000JBAA..110..323M [http://adsabs.harvard.edu/abs/2000JBAA..110..323M]

Parameters
jDaythe date and time expressed as a Julian day
Returns
Delta-T in seconds or 0 if year not in 1620..2000

◆ getDeltaTByMontenbruckPfleger()

double StelUtils::getDeltaTByMontenbruckPfleger ( const double  jDay)

Get Delta-T estimation for a given date.

Implementation of algorithm by Montenbruck & Pfleger (2000) for DeltaT computation, a data fit through the table of values found in Meeus, Astronomical algorithms (1991). Book "Astronomy on the Personal Computer" by O. Montenbruck & T. Pfleger (4th ed., 2000), p.181-182

Parameters
jDaythe date and time expressed as a Julian day
Returns
Delta-T in seconds or 0 if not 1825<=year<2005

◆ getDeltaTByMorrisonStephenson1982()

double StelUtils::getDeltaTByMorrisonStephenson1982 ( const double  jDay)

Get Delta-T estimation for a given date.

Implementation of algorithm by Morrison & Stephenson (1982) for DeltaT computation

Parameters
jDaythe date and time expressed as a Julian day
Returns
Delta-T in seconds

◆ getDeltaTByMorrisonStephenson2004()

double StelUtils::getDeltaTByMorrisonStephenson2004 ( const double  jDay)

Get Delta-T estimation for a given date.

Implementation of algorithm by Morrison & Stephenson (2004, 2005) for DeltaT computation. Sources: Historical values of the Earth's clock error ΔT and the calculation of eclipses Morrison, L. V.; Stephenson, F. R. Journal for the History of Astronomy (ISSN 0021-8286), Vol. 35, Part 3, No. 120, p. 327 - 336 (2004) 2004JHA....35..327M [http://adsabs.harvard.edu/abs/2004JHA....35..327M] Addendum: Historical values of the Earth's clock error Morrison, L. V.; Stephenson, F. R. Journal for the History of Astronomy (ISSN 0021-8286), Vol. 36, Part 3, No. 124, p. 339 (2005) 2005JHA....36..339M [http://adsabs.harvard.edu/abs/2005JHA....36..339M]

Parameters
jDaythe date and time expressed as a Julian day
Returns
Delta-T in seconds

◆ getDeltaTByMullerStephenson()

double StelUtils::getDeltaTByMullerStephenson ( const double  jDay)

Get Delta-T estimation for a given date.

Implementation of algorithm by Muller & Stephenson (1975) for DeltaT computation. Source: The accelerations of the earth and moon from early astronomical observations Muller, P. M.; Stephenson, F. R. Growth rhythms and the history of the earth's rotation; Proceedings of the Interdisciplinary Winter Conference on Biological Clocks and Changes in the Earth's Rotation: Geophysical and Astronomical Consequences, Newcastle-upon-Tyne, England, January 8-10, 1974. (A76-18126 06-46) London, Wiley-Interscience, 1975, p. 459-533; Discussion, p. 534. 1975grhe.conf..459M [http://adsabs.harvard.edu/abs/1975grhe.conf..459M]

Parameters
jDaythe date and time expressed as a Julian day
Returns
Delta-T in seconds

◆ getDeltaTByReijs()

double StelUtils::getDeltaTByReijs ( const double  jDay)

Get Delta-T estimation for a given date.

Implementation of algorithm by Reijs (2006) for DeltaT computation Details: http://www.iol.ie/~geniet/eng/DeltaTeval.htm

Parameters
jDaythe date and time expressed as a Julian day
Returns
Delta-T in seconds

◆ getDeltaTByReingoldDershowitz()

double StelUtils::getDeltaTByReingoldDershowitz ( const double  jDay)

Get Delta-T estimation for a given date.

Implementation of algorithm by Reingold & Dershowitz (1997, 2001, 2002, 2007, 2018) for DeltaT computation. This is again mostly a data fit based on the table in Meeus, Astronomical Algorithms (1991). This is the version given in the 4th edition ("the ultimate edition"; 2018) which added the fit for -500..1699 and 2006..2150 omitted from previous editions. Calendrical Calculations: The Ultimate Edition / Edward M. Reingold, Nachum Dershowitz - 4th Edition, Cambridge University Press, 2018. - 660p. ISBN: 9781107057623, DOI: 10.1017/9781107415058

Parameters
jDaythe date and time expressed as a Julian day
Returns
Delta-T in seconds

◆ getDeltaTBySchmadelZech1979()

double StelUtils::getDeltaTBySchmadelZech1979 ( const double  jDay)

Get Delta-T estimation for a given date.

Implementation of algorithm by Schmadel & Zech (1979) for DeltaT computation. Outdated, but may be useful for science-historical purposes. Source: Polynomial approximations for the correction delta T E.T.-U.T. in the period 1800-1975 Schmadel, L. D.; Zech, G. Acta Astronomica, vol. 29, no. 1, 1979, p. 101-104. 1979AcA....29..101S [http://adsabs.harvard.edu/abs/1979AcA....29..101S]

Parameters
jDaythe date and time expressed as a Julian day
Returns
Delta-T in seconds
Note
The polynome is strictly applicable 1800...1975 only! Delivers values for the nearer edge (1800/1989) if jDay is outside.

◆ getDeltaTBySchmadelZech1988()

double StelUtils::getDeltaTBySchmadelZech1988 ( const double  jDay)

Get Delta-T estimation for a given date.

Implementation of algorithm by Schmadel & Zech (1988) for DeltaT computation. Source: Empirical Transformations from U.T. to E.T. for the Period 1800-1988 Schmadel, L. D.; Zech, G. Astronomische Nachrichten 309, 219-221 1988AN....309..219S [http://adsabs.harvard.edu/abs/1988AN....309..219S]

Parameters
jDaythe date and time expressed as a Julian day
Returns
Delta-T in seconds
Note
The polynome is strictly applicable 1800...1988 only! Delivers values for the nearer edge (1800/1989) if jDay is outside.

◆ getDeltaTBySchoch()

double StelUtils::getDeltaTBySchoch ( const double  jDay)

Get Delta-T estimation for a given date.

Implementation of algorithm by Schoch (1931) for DeltaT computation, outdated but may be useful for science-historical purposes. Source: Schoch, C. (1931). Die sekulare Accelaration des Mondes und der Sonne. Astronomische Abhandlungen, Ergnzungshefte zu den Astronomischen Nachrichten, Band 8, B2. Kiel.

Parameters
jDaythe date and time expressed as a Julian day
Returns
Delta-T in seconds

◆ getDeltaTByStephenson1978()

double StelUtils::getDeltaTByStephenson1978 ( const double  jDay)

Get Delta-T estimation for a given date.

Implementation of algorithm by Stephenson (1978) for DeltaT computation. Source: Pre-Telescopic Astronomical Observations Stephenson, F. R. Tidal Friction and the Earth's Rotation, Proceedings of a Workshop, held in Bielefeld, September 26-30, 1977, Edited by P. Brosche, and J. Sundermann. Berlin: Springer-Verlag, 1978, p.5 1978tfer.conf....5S [http://adsabs.harvard.edu/abs/1978tfer.conf....5S]

Parameters
jDaythe date and time expressed as a Julian day
Returns
Delta-T in seconds

◆ getDeltaTByStephenson1997()

double StelUtils::getDeltaTByStephenson1997 ( const double  jDay)

Get Delta-T estimation for a given date.

Implementation of algorithm by Stephenson (1997) for DeltaT computation. Source: Book "Historical Eclipses and Earth's Rotation" by F. R. Stephenson (1997) http://ebooks.cambridge.org/ebook.jsf?bid=CBO9780511525186

Parameters
jDaythe date and time expressed as a Julian day
Returns
Delta-T in seconds

◆ getDeltaTByStephensonHoulden()

double StelUtils::getDeltaTByStephensonHoulden ( const double  jDay)

Get Delta-T estimation for a given date.

Implementation of algorithm by Stephenson & Houlden (1986) for DeltaT computation Source: STEPHENSON F.R and HOULDEN M.A. - Atlas of Historical Eclipse Maps - Cambridge Univ.Press. (1986) [https://assets.cambridge.org/97805212/67236/frontmatter/9780521267236_frontmatter.pdf]

Parameters
jDaythe date and time expressed as a Julian day
Returns
Delta-T in seconds or 0 if year > 1600

◆ getDeltaTByStephensonMorrison1984()

double StelUtils::getDeltaTByStephensonMorrison1984 ( const double  jDay)

Get Delta-T estimation for a given date.

Implementation of algorithm by Stephenson & Morrison (1984) for DeltaT computation Source: Long-term changes in the rotation of the earth - 700 B.C. to A.D. 1980. Stephenson, F. R.; Morrison, L. V. Philosophical Transactions, Series A (ISSN 0080-4614), vol. 313, no. 1524, Nov. 27, 1984, p. 47-70. 1984RSPTA.313...47S [http://adsabs.harvard.edu/abs/1984RSPTA.313...47S]

Parameters
jDaythe date and time expressed as a Julian day
Returns
Delta-T in seconds or Zero if date outside years -391..1600

◆ getDeltaTByStephensonMorrison1995()

double StelUtils::getDeltaTByStephensonMorrison1995 ( const double  jDay)

Get Delta-T estimation for a given date.

Implementation of algorithm by Stephenson & Morrison (1995) for DeltaT computation Source: Long-Term Fluctuations in the Earth's Rotation: 700 BC to AD 1990. Stephenson, F. R.; Morrison, L. V. Philosophical Transactions: Physical Sciences and Engineering, Volume 351, Issue 1695, pp. 165-202 1995RSPTA.351..165S [http://adsabs.harvard.edu/abs/1995RSPTA.351..165S]

Parameters
jDaythe date and time expressed as a Julian day
Returns
Delta-T in seconds

◆ getDeltaTByStephensonMorrisonHohenkerk2016()

double StelUtils::getDeltaTByStephensonMorrisonHohenkerk2016 ( const double  jDay)

Get Delta-T estimation for a given date.

Implementation of a spline approximation for time period -720-2019.0 for DeltaT by Stephenson, Morrison and Hohenkerk (2016). Source: Measurement of the Earth's rotation: 720 BC to AD 2015, published in 2016 in the Royal Society's Proceedings A 472, and made freely available via Open Access, by Stephenson, F.R., Morrison, L.V. and Hohenkerk, C.Y.. https://doi.org/10.1098/rspa.2016.0404 Addendum 2020 to "Measurement of the Earth's Rotation: 720 BC to AD 2015", published in 2021 February in the Royal Society's Proceedings A 478, by Morrison, L. V., Stephenson, F.R., Hohenkerk, C.Y. and M. Zawilski, M.. https://doi.org/10.1098/rspa.2020.0776

Parameters
jDaythe date and time expressed as a Julian day
Returns
Delta-T in seconds. For times outside the limits, return result from the fitting parabola.

◆ getDeltaTByTuckermanGoldstine()

double StelUtils::getDeltaTByTuckermanGoldstine ( const double  jDay)

Get Delta-T estimation for a given date.

Implementation of algorithm by Tuckerman (1962, 1964) & Goldstine (1973) for DeltaT computation

Parameters
jDaythe date and time expressed as a Julian day
Returns
Delta-T in seconds

◆ getDeltaTStandardError()

double StelUtils::getDeltaTStandardError ( const double  jDay)

Get the standard error (sigma) for the value of DeltaT.

Parameters
jDaythe JD
Returns
sigma in seconds

◆ getDeltaTwithoutCorrection()

double StelUtils::getDeltaTwithoutCorrection ( const double  jDay)

Get Delta-T estimation for a given date.

This is just an "empty" correction function, returning 0.

◆ getFixedFromGregorian()

int StelUtils::getFixedFromGregorian ( const int  year,
const int  month,
const int  day 
)

Calculate fixed days (R.D.) from Gregorian date (proleptic Gregorian calendar)

Parameters
year
month
day
Returns
days from Rata Die

◆ getJDFromBesselianEpoch()

double StelUtils::getJDFromBesselianEpoch ( const double  epoch)

Get the Julian Day Number (JD) from Besselian epoch.

Parameters
epochBesselian epoch, expressed as year
Returns
Julian Day number (JD) for B<Year>

◆ getJDFromDate()

bool StelUtils::getJDFromDate ( double *  newjd,
const int  y,
const int  m,
const int  d,
const int  h,
const int  min,
const float  s 
)

Compute Julian day number from calendar date.

Uses QDate functionality if possible, but also works for negative JD. Dates before 1582-10-15 are in the Julian Calendar.

Parameters
newjdpointer to JD
yCalendar year.
mmonth, 1=January ... 12=December
dday
hhour
minminute
ssecond
Returns
true in all conceivable cases.

◆ getJDFromSystem()

double StelUtils::getJDFromSystem ( )

Get the current Julian Date from system time.

Returns
the current Julian Date

◆ getJulianDayFromISO8601String()

double StelUtils::getJulianDayFromISO8601String ( const QString &  iso8601Date,
bool *  ok 
)

Return the Julian Date matching the ISO8601 date string.

Also handles negative and distant years.

◆ getMoonFluctuation()

double StelUtils::getMoonFluctuation ( const double  jDay)

Get value of the Moon fluctuation Source: The Rotation of the Earth, and the Secular Accelerations of the Sun, Moon and Planets Spencer Jones, H.

Monthly Notices of the Royal Astronomical Society, 99 (1939), 541-558 1939MNRAS..99..541S [http://adsabs.harvard.edu/abs/1939MNRAS..99..541S]

Parameters
jDaythe JD
Returns
fluctuation in seconds

◆ getMoonSecularAcceleration()

double StelUtils::getMoonSecularAcceleration ( const double  jDay,
const double  ndot,
const bool  useDE4xx 
)

Get Secular Acceleration estimation for a given year.

Method described is here: http://eclipse.gsfc.nasa.gov/SEcat5/secular.html For adapting from -26 to -25.858, use -0.91072 * (-25.858 + 26.0) = -0.12932224 For adapting from -26 to -23.895, use -0.91072 * (-23.895 + 26.0) = -1.9170656

Parameters
jDaythe JD
ndotvalue of n-dot (secular acceleration of the Moon) which should be used in the lunar ephemeris instead of the default values.
useDE4xxtrue if function should adapt calculation of the secular acceleration of the Moon to the DE43x/DE44x ephemerides
Returns
SecularAcceleration in seconds
Note
n-dot for secular acceleration of the Moon in ELP2000-82B is -23.8946 "/cy/cy and for DE43x/DE44x is -25.8 "/cy/cy

◆ getTimeFromJulianDay()

void StelUtils::getTimeFromJulianDay ( const double  julianDay,
int *  hour,
int *  minute,
int *  second,
int *  millis = Q_NULLPTR,
bool *  wrapDay = Q_NULLPTR 
)

Extract from julianDay an hour, minute, second.

Attention
Under rare circumstances with a rounded result where julianDay=*.49999999xyz this will lead to a factual result for *.5000000abc, i.e. not 24 but 0 hours, and wrapDay will be true. Depending on circumstances this may matter or not. If you need a full decoding of a Julian day number, prefer to use getDateTimeFromJulianDay()

◆ hmsToRad()

double StelUtils::hmsToRad ( const unsigned int  h,
const unsigned int  m,
const double  s 
)
inline

Convert an angle in hms format to radian.

Parameters
hhour component
mminute component
ssecond component
Returns
angle in radian

◆ interpolate3()

template<class T >
T StelUtils::interpolate3 ( n,
y1,
y2,
y3 
)

Given regularly spaced steps x1, x2, x3 and curve values y1, y2, y3, calculate an intermediate value of the 3 arguments for the given interpolation point n.

Parameters
nInterpolation factor: steps from x2
y1Argument 1
y2Argument 2
y3Argument 3
Returns
interpolation value

◆ interpolate5()

template<class T >
T StelUtils::interpolate5 ( n,
y1,
y2,
y3,
y4,
y5 
)

Given regularly spaced steps x1, x2, x3, x4, x5 and curve values y1, y2, y3, y4, y5, calculate an intermediate value of the 5 arguments for the given interpolation point n.

Parameters
nInterpolation factor: steps from x3
y1Argument 1
y2Argument 2
y3Argument 3
y3Argument 4
y3Argument 5
Returns
interpolation value

◆ intFloorDiv()

int StelUtils::intFloorDiv ( int  num,
int  den 
)
inline

Floor integer division provides truncating to the next lower integer, also for negative numerators.

https://stackoverflow.com/questions/2622441/c-integer-floor-function

Returns
floor(num/den)

◆ isLeapYear()

bool StelUtils::isLeapYear ( const int  year)
Returns
true if year is a leap year. Observes 1582 switch from Julian to Gregorian Calendar.

◆ isWithin()

template<typename T >
bool StelUtils::isWithin ( const T &  value,
const T &  low,
const T &  high 
)

Interval test. This checks whether.

Parameters
valueis within [
low

◆ jdToQDateTime()

QDateTime StelUtils::jdToQDateTime ( const double &  jd,
const Qt::TimeSpec  timeSpec 
)

Convert a Julian Day number to a QDateTime.

Parameters
jdJulian Day number (with fractions) to convert
timeSpeca Qt::TimeSpec constant. Meaningful in this context seem only Qt::UTC (preferred) and Qt::LocalTime (useful in some GUI contexts).
Note
From 2008 to 2022-05 this converted to local time zone, not to UTC as specified and intended. The old behaviour is kept with
Parameters
timeSpecset to Qt::LocalTime. If you use Qt::LocalTime, you should add StelCore::getUTCOffset(jd)/24 to the current JD before calling this to have
jdas a "local time zone corrected JD" before conversion.
Returns
the matching QDateTime
Note
QDate has no year zero. This and other idiosyncrasies of QDateTime may limit the applicability of program parts which use this method to positive years or may cause other issues.

◆ julianDayToISO8601String()

QString StelUtils::julianDayToISO8601String ( const double  jd,
bool  addMS = false 
)

Format the given Julian Day in (UTC) ISO8601 date string.

Also handles negative and distant years.

◆ lcm()

int StelUtils::lcm ( int  a,
int  b 
)

Least Common Multiple.

Parameters
afirst number
bsecond number
Returns
Least Common Multiple

◆ localeDateString() [1/2]

QString StelUtils::localeDateString ( const int  year,
const int  month,
const int  day,
const int  dayOfWeek 
)

Format the date and day-of-week per the system locale's QLocale::ShortFormat.

Returns
QString representing the formatted date

◆ localeDateString() [2/2]

QString StelUtils::localeDateString ( const int  year,
const int  month,
const int  day,
const int  dayOfWeek,
const QString &  fmt 
)

Format the date and day-of-week per the format in fmt (see QDateTime::toString()).

Uses the system locale, not the one set in Stellarium.

Returns
QString representing the formatted date

◆ localeDiscoveryDateString()

QString StelUtils::localeDiscoveryDateString ( const QString &  discovery)

Format the discovery date.

Returns
QString representing the formatted date

◆ qDateTimeToJd()

double StelUtils::qDateTimeToJd ( const QDateTime &  dateTime)
inline

Convert a QT QDateTime class to julian day.

Parameters
dateTimethe UTC QDateTime to convert
Returns
the matching decimal Julian Day

◆ qTimeToJDFraction()

double StelUtils::qTimeToJDFraction ( const QTime &  time)

Convert a time of day to the fraction of a Julian Day.

Note that a Julian Day starts at 12:00, not 0:00, and so 12:00 == 0.0 and 0:00 == 0.5

◆ radToDecDeg()

void StelUtils::radToDecDeg ( double  rad,
bool &  sign,
double &  deg 
)

Convert an angle in radian to decimal degree.

Parameters
radinput angle in radian
signtrue if positive, false otherwise
degdecimal degree

◆ radToDecDegStr()

QString StelUtils::radToDecDegStr ( const double  angle,
const int  precision = 4,
const bool  useD = false,
const bool  positive = false 
)

Convert an angle in radian to a decimal degree string.

Parameters
angleinput angle in radian
precision
useDDefine if letter "d" must be used instead of deg sign
positiveDefine if function should use 0-360 degrees

◆ radToDms()

void StelUtils::radToDms ( double  rad,
bool &  sign,
unsigned int &  d,
unsigned int &  m,
double &  s 
)

Convert an angle in radian to +-dms format.

Parameters
radinput angle in radian
signtrue if positive, false otherwise
ddegree component
mminute component
ssecond component

◆ radToDmsPStr()

QString StelUtils::radToDmsPStr ( const double  angle,
const int  precision = 0,
const bool  useD = false 
)

Convert an angle in radian to a dms formatted string.

Parameters
angleinput angle in radian
precision
useDDefine if letter "d" must be used instead of deg sign

◆ radToDmsStr()

QString StelUtils::radToDmsStr ( const double  angle,
const bool  decimal = false,
const bool  useD = false 
)

Convert an angle in radian to a dms formatted string.

Parameters
angleinput angle in radian
decimaloutput second value with decimal fraction
useDDefine if letter "d" must be used instead of deg sign

◆ radToDmsStrAdapt()

QString StelUtils::radToDmsStrAdapt ( const double  angle,
const bool  useD = false 
)

Convert an angle in radian to a dms formatted string.

If the second, minute part is == 0, it is not output

Parameters
angleinput angle in radian
useDDefine if letter "d" must be used instead of deg sign

◆ radToHms()

void StelUtils::radToHms ( double  rad,
unsigned int &  h,
unsigned int &  m,
double &  s 
)

Convert an angle in radian to hms format.

Parameters
radinput angle in radian
hhour component
mminute component
ssecond component

◆ radToHmsStr()

QString StelUtils::radToHmsStr ( const double  angle,
const bool  decimal = false 
)

Convert an angle in radian to a hms formatted string.

Parameters
angleinput angle in radian
decimaloutput decimal second value

◆ radToHmsStrAdapt()

QString StelUtils::radToHmsStrAdapt ( const double  angle)

Convert an angle in radian to a hms formatted string.

If the second, minute part is == 0, it is not output

Parameters
angleinput angle in radian

◆ rectToSphe() [1/5]

void StelUtils::rectToSphe ( double *  lng,
double *  lat,
const Vec3d v 
)
inline

Convert from Rectangular direction to spherical coordinate components.

Parameters
lngdouble* to store longitude in radian [-pi, pi]
latdouble* to store latitude in radian
vthe input 3D vector

◆ rectToSphe() [2/5]

void StelUtils::rectToSphe ( double *  lng,
double *  lat,
const Vec3f v 
)
inline

Convert from Rectangular direction to spherical coordinate components.

Parameters
lngdouble* to store longitude in radian [-pi, pi]
latdouble* to store latitude in radian
vthe input 3D vector

◆ rectToSphe() [3/5]

void StelUtils::rectToSphe ( double *  lng,
double *  lat,
double *  r,
const Vec3d v 
)
inline

Convert from Rectangular direction to spherical coordinate components (including distance).

Parameters
lngdouble* to store longitude in radian [-pi, pi]
latdouble* to store latitude in radian
rdouble* length of radius vector (distance)
vthe input 3D vector

◆ rectToSphe() [4/5]

void StelUtils::rectToSphe ( float *  lng,
float *  lat,
const Vec3d v 
)
inline

Convert from Rectangular direction to spherical coordinate components.

Parameters
lngfloat* to store longitude in radian [-pi, pi]
latfloat* to store latitude in radian
vthe input 3D vector

◆ rectToSphe() [5/5]

void StelUtils::rectToSphe ( float *  lng,
float *  lat,
const Vec3f v 
)
inline

Convert from Rectangular direction to spherical coordinate components.

Parameters
lngfloat* to store longitude in radian [-pi, pi]
latfloat* to store latitude in radian
vthe input 3D vector

◆ spheToRect() [1/5]

void StelUtils::spheToRect ( const double  lng,
const double  lat,
const double  r,
Vec3d v 
)
inline

Convert from spherical coordinates (including distance) to Rectangular direction.

Parameters
lnglongitude in radian
latlatitude in radian
rlength of radius vector (distance)
vthe resulting 3D unit vector

◆ spheToRect() [2/5]

void StelUtils::spheToRect ( const double  lng,
const double  lat,
Vec3d v 
)
inline

Convert from spherical coordinates to Rectangular direction.

Parameters
lnglongitude in radian
latlatitude in radian
vthe resulting 3D unit vector

◆ spheToRect() [3/5]

void StelUtils::spheToRect ( const double  lng,
const double  lat,
Vec3f v 
)
inline

Convert from spherical coordinates to Rectangular direction.

Parameters
lnglongitude in radian
latlatitude in radian
vthe resulting 3D unit vector

◆ spheToRect() [4/5]

void StelUtils::spheToRect ( const float  lng,
const float  lat,
Vec3d v 
)
inline

Convert from spherical coordinates to Rectangular direction.

Parameters
lnglongitude in radian
latlatitude in radian
vthe resulting 3D unit vector

◆ spheToRect() [5/5]

void StelUtils::spheToRect ( const float  lng,
const float  lat,
Vec3f v 
)
inline

Convert from spherical coordinates to Rectangular direction.

Parameters
lnglongitude in radian
latlatitude in radian
vthe resulting 3D unit vector

◆ uncompress()

QByteArray StelUtils::uncompress ( QIODevice &  device,
qint64  maxBytes = -1 
)

Uncompress (gzip/zlib) data from this QIODevice, which must be open and readable.

Parameters
deviceThe device to read from, must already be opened with an OpenMode supporting reading
maxBytesThe max. amount of bytes to read from the device, or -1 to read until EOF. Note that it always stops when inflate() returns Z_STREAM_END. Positive values can be used for interleaving compressed data with other data.