Stellarium 0.13.2
Functions
StelUtils Namespace Reference

contains general purpose utility functions. More...

Functions

QString getApplicationName ()
 Return the full name of stellarium, i.e. "stellarium 0.9.0". More...
 
QString getApplicationVersion ()
 Return the version of stellarium, i.e. "0.9.0". More...
 
QString getOperatingSystemInfo ()
 Return the name and the version of operating system, i.e. "Mac OS X 10.7". More...
 
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 bool useD=false, const bool useC=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...
 
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...
 
double dmsStrToRad (const QString &s)
 Convert a dms formatted string to an angle in radian. More...
 
Vec3f strToVec3f (const QStringList &s)
 Obtains a Vec3f from a string. More...
 
Vec3f strToVec3f (const QString &s)
 
QString vec3fToHtmlColor (const Vec3f &v)
 Converts a Vec3f to HTML color notation. More...
 
Vec3f htmlColorToVec3f (const QString &c)
 Converts a color in HTML notation to a Vec3f. 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 rectToSphe (double *lng, double *lat, const Vec3d &v)
 Convert from spherical coordinates to Rectangular direction. More...
 
void rectToSphe (float *lng, float *lat, const Vec3d &v)
 Convert from spherical coordinates to Rectangular direction. More...
 
void rectToSphe (float *lng, float *lat, const Vec3f &v)
 Convert from spherical coordinates to Rectangular direction. More...
 
void ctRadec2Ecl (const double raRad, const double decRad, const double eclRad, double *lambdaRad, double *betaRad)
 Coordinate Transformation from equatorial to ecliptical. More...
 
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. More...
 
int getBiggerPowerOfTwo (int value)
 Return the first power of two bigger than the given value. More...
 
double asinh (const double z)
 Return the inverse sinus hyperbolic of z. More...
 
void getDateFromJulianDay (const double julianDay, int *year, int *month, int *day)
 Make from julianDay a year, month, day for the Julian Date julianDay represents. More...
 
void getTimeFromJulianDay (const double julianDay, int *hour, int *minute, int *second)
 Make from julianDay an hour, minute, second. More...
 
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)
 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...
 
double getJDFromSystem ()
 Get the current Julian Date from system time. 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. More...
 
float getGMTShiftFromQT (const double jd)
 Return number of hours offset from GMT, using Qt functions. More...
 
double qDateTimeToJd (const QDateTime &dateTime)
 Convert a QT QDateTime class to julian day. More...
 
QDateTime jdToQDateTime (const double &jd)
 Convert a julian day to a QDateTime. More...
 
bool getJDFromDate (double *newjd, const int y, const int m, const int d, const int h, const int min, const int s)
 Compute Julian day number from calendar date. More...
 
int numberOfDaysInMonthInYear (const int month, const int year)
 
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. More...
 
float fastAcos (const float x)
 Compute acos(x) The taylor serie is not accurate around x=1 and x=-1. More...
 
float fastExp (const float x)
 Compute exp(x) for small exponents x. More...
 
Vec3f getNightColor (const Vec3f &dayColor)
 Get a night mode version of a color. More...
 
double calculateSiderealPeriod (const double SemiMajorAxis)
 Calculate and getting sidereal period in days from semi-major axis (in AU) More...
 
QString hoursToHmsStr (const double hours)
 
long double secondsSinceStart ()
 Get the number of seconds since program start. More...
 
double getDeltaTByEspenakMeeus (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 getMoonSecularAcceleration (const double jDay, const double ndot)
 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...
 
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. More...
 
float * ComputeCosSinTheta (const int slices)
 Compute cosines and sines around a circle which is split in "segments" parts. More...
 
float * ComputeCosSinRho (const int segments)
 Compute cosines and sines around a half-circle which is split in "segments" parts. More...
 
float * ComputeCosSinRhoZone (const float dRho, const 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...
 
QByteArray uncompress (const QByteArray &data)
 Uncompress gzip or zlib compressed data. More...
 

Detailed Description

contains general purpose utility functions.

Function Documentation

double StelUtils::asinh ( const double  z)

Return the inverse sinus hyperbolic of z.

double StelUtils::calculateSiderealPeriod ( const double  SemiMajorAxis)

Calculate and getting sidereal period in days from semi-major axis (in AU)

float* StelUtils::ComputeCosSinRho ( const 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
float* StelUtils::ComputeCosSinRhoZone ( const float  dRho,
const 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. GZ: allow 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
float* StelUtils::ComputeCosSinTheta ( const int  slices)

Compute cosines and sines around a circle which is split in "segments" 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
void StelUtils::ctRadec2Ecl ( const double  raRad,
const double  decRad,
const double  eclRad,
double *  lambdaRad,
double *  betaRad 
)

Coordinate Transformation from equatorial to ecliptical.

void StelUtils::debugQVariantMap ( const QVariant &  m,
const QString &  indent = "",
const QString &  key = "" 
)

Output a QVariantMap to qDebug(). Formats like a tree where there are nested objects.

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
QString StelUtils::decDegToDmsStr ( const double  angle)

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

Parameters
angleinput angle in decimal degrees
double StelUtils::dmsStrToRad ( const QString &  s)

Convert a dms formatted string to an angle in radian.

Parameters
sThe input string
double StelUtils::dmsToRad ( const int  d,
const unsigned int  m,
const double  s 
)

Convert an angle in +-dms format to radian.

Parameters
ddegree component
marcmin component
sarcsec component
Returns
angle in radian
float StelUtils::fastAcos ( const float  x)
inline

Compute acos(x) The taylor serie is not accurate around x=1 and x=-1.

Definition at line 291 of file StelUtils.hpp.

float StelUtils::fastExp ( const float  x)
inline

Compute exp(x) for small exponents x.

Definition at line 297 of file StelUtils.hpp.

QString StelUtils::getApplicationName ( )

Return the full name of stellarium, i.e. "stellarium 0.9.0".

QString StelUtils::getApplicationVersion ( )

Return the version of stellarium, i.e. "0.9.0".

int StelUtils::getBiggerPowerOfTwo ( int  value)

Return the first power of two bigger than the given value.

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

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

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.

double StelUtils::getDecAngle ( const QString &  str)

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

Parameters
strthe angle in format something like these:
  • +53d 51'21.6" - +53d51'21.6"
  • -1d 10'31.8" - +46d6'31"
  • 50D46'0"N - 123D47'59"W
  • 123.567 N
  • 123.567W
  • -123.567
  • 12h 14m 6s The degree separator may be a degree symbol (\xBA) in addition to a 'd' or 'D'.
Returns
the angle in radians. Latitude: North are positive, South are negative. Longitude: East is positive, West is negative. Note: if there is a N, S, E or W suffix, any leading + or - characters are ignored.
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
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
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
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
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
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
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
double StelUtils::getDeltaTByEspenakMeeus ( const double  jDay)

Get Delta-T estimation for a given date.

Note that this method is valid for the year range: -1999 to +3000, outside of which "0" will be returned. 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
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
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
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 (!)
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
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)

Parameters
jDaythe date and time expressed as a julian day
Returns
Delta-T in seconds or 0 if not 1825<=year<2005
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
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
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
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
double StelUtils::getDeltaTByReingoldDershowitz ( const double  jDay)

Get Delta-T estimation for a given date.

Implementation of algorithm by Reingold & Dershowitz (1997, 2001, 2002, 2007) 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 3rd edition (2007) which added the fit for 1700..1799 omitted from previous editions.

Parameters
jDaythe date and time expressed as a julian day
Returns
Delta-T in seconds
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
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
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
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
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
double StelUtils::getDeltaTByStephensonHoulden ( const double  jDay)

Get Delta-T estimation for a given date.

Implementation of algorithm by Stephenson & Houlden (1986) for DeltaT computation

Parameters
jDaythe date and time expressed as a julian day
Returns
Delta-T in seconds or 0 if year > 1600
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
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
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
double StelUtils::getDeltaTStandardError ( const double  jDay)

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

Parameters
jDaythe JD
Returns
sigma in seconds
float StelUtils::getGMTShiftFromQT ( const double  jd)

Return number of hours offset from GMT, using Qt functions.

bool StelUtils::getJDFromDate ( double *  newjd,
const int  y,
const int  m,
const int  d,
const int  h,
const int  min,
const int  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.
double StelUtils::getJDFromSystem ( )

Get the current Julian Date from system time.

Returns
the current Julian Date
double StelUtils::getJulianDayFromISO8601String ( const QString &  iso8601Date,
bool *  ok 
)

Return the Julian Date matching the ISO8601 date string.

Also handles negative and distant years.

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

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 n-dot which use in the algorithm
Returns
SecularAcceleration in seconds
Note
n-dot for secular acceleration of the Moon in ELP2000-82B is -23.8946 "/cy/cy
Vec3f StelUtils::getNightColor ( const Vec3f dayColor)
inline

Get a night mode version of a color.

That is find the brightness of a color and set that in the red channel only

Definition at line 306 of file StelUtils.hpp.

QString StelUtils::getOperatingSystemInfo ( )

Return the name and the version of operating system, i.e. "Mac OS X 10.7".

void StelUtils::getTimeFromJulianDay ( const double  julianDay,
int *  hour,
int *  minute,
int *  second 
)

Make from julianDay an hour, minute, second.

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

Convert an angle in hms format to radian.

Parameters
hhour component
mminute component
ssecond component
Returns
angle in radian
Vec3f StelUtils::htmlColorToVec3f ( const QString &  c)

Converts a color in HTML notation to a Vec3f.

Parameters
cThe HTML spec color string
bool StelUtils::isPowerOfTwo ( const int  value)

Check if a number is a power of 2.

QTime StelUtils::jdFractionToQTime ( const double  jd)

Convert a fraction of a Julian Day to a QTime.

QDateTime StelUtils::jdToQDateTime ( const double &  jd)

Convert a julian day to a QDateTime.

Parameters
jdto convert
Returns
the matching UTC QDateTime
QString StelUtils::julianDayToISO8601String ( const double  jd)

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

Also handles negative and distant years.

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
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
double StelUtils::qDateTimeToJd ( const QDateTime &  dateTime)

Convert a QT QDateTime class to julian day.

Parameters
dateTimethe UTC QDateTime to convert
Returns
the matching decimal Julian Day
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

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
QString StelUtils::radToDecDegStr ( const double  angle,
const bool  useD = false,
const bool  useC = false 
)

Convert an angle in radian to a decimal degree string.

Parameters
angleinput angle in radian
useDDefine if letter "d" must be used instead of deg sign
useCDefine if function should use 0-360 degrees
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
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
useDDefine if letter "d" must be used instead of deg sign
decimaloutput decimal second value
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
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
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
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
void StelUtils::rectToSphe ( double *  lng,
double *  lat,
const Vec3d v 
)

Convert from spherical coordinates to Rectangular direction.

Parameters
lngdouble* to store longitude in radian
latdouble* to store latitude in radian
vthe input 3D vector
void StelUtils::rectToSphe ( float *  lng,
float *  lat,
const Vec3d v 
)

Convert from spherical coordinates to Rectangular direction.

Parameters
lngfloat* to store longitude in radian
latfloat* to store latitude in radian
vthe input 3D vector
void StelUtils::rectToSphe ( float *  lng,
float *  lat,
const Vec3f v 
)

Convert from spherical coordinates to Rectangular direction.

Parameters
lngfloat* to store longitude in radian
latfloat* to store latitude in radian
vthe input 3D vector
long double StelUtils::secondsSinceStart ( )

Get the number of seconds since program start.

Note
This is implemented in platform-specific ways to be as precise as possible, but there is a fallback for other platforms that might not be precise at all. This is currently used e.g. to measure FPS, but it should never be used for critical functionality.
template<typename T >
int StelUtils::sign ( val)
void StelUtils::spheToRect ( const double  lng,
const double  lat,
Vec3d v 
)

Convert from spherical coordinates to Rectangular direction.

Parameters
lnglongitude in radian
latlatitude in radian
vthe resulting 3D unit vector
void StelUtils::spheToRect ( const float  lng,
const float  lat,
Vec3f v 
)

Convert from spherical coordinates to Rectangular direction.

Parameters
lnglongitude in radian
latlatitude in radian
vthe resulting 3D unti vector
Vec3f StelUtils::strToVec3f ( const QStringList &  s)

Obtains a Vec3f from a string.

Parameters
sthe string describing the Vector with the form "x,y,z"
Returns
The corresponding vector
Deprecated:
Use the >> operator from Vec3f class
QByteArray StelUtils::uncompress ( const QByteArray &  data)

Uncompress gzip or zlib compressed data.

QString StelUtils::vec3fToHtmlColor ( const Vec3f v)

Converts a Vec3f to HTML color notation.

Parameters
vThe vector
Returns
The string in HTML color notation "#rrggbb".