StelUtils.hpp   StelUtils.hpp 
skipping to change at line 23 skipping to change at line 23
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#ifndef _STELUTILS_HPP_ #ifndef _STELUTILS_HPP_
#define _STELUTILS_HPP_ #define _STELUTILS_HPP_
#include "config.h"
#include "VecMath.hpp" #include "VecMath.hpp"
#include <QVariantMap> #include <QVariantMap>
#include <QDateTime> #include <QDateTime>
#include <QSize>
#include <QString> #include <QString>
// astonomical unit (km) // astronomical unit (km)
#define AU 149597870.691 #define AU 149597870.691
#define AU_KM (1.0/149597870.691)
// Parsec (km) // Parsec (km)
#define PARSEC 30.857e12 #define PARSEC 30.857e12
// speed of light (km/sec) // speed of light (km/sec)
#define SPEED_OF_LIGHT 299792.458 #define SPEED_OF_LIGHT 299792.458
//! @namespace StelUtils contains general purpose utility functions. //! @namespace StelUtils contains general purpose utility functions.
namespace StelUtils namespace StelUtils
{ {
//! Return the full name of stellarium, i.e. "stellarium 0.9.0" //! Return the full name of stellarium, i.e. "stellarium 0.9.0"
QString getApplicationName(); QString getApplicationName();
//! Return the version of stellarium, i.e. "0.9.0" //! Return the version of stellarium, i.e. "0.9.0"
QString getApplicationVersion(); QString getApplicationVersion();
//! Return the name and the version of operating system, i.e. "Mac O
S X 10.7"
QString getOperatingSystemInfo();
//! Convert an angle in hms format to radian. //! Convert an angle in hms format to radian.
//! @param h hour component //! @param h hour component
//! @param m minute component //! @param m minute component
//! @param s second component //! @param s second component
//! @return angle in radian //! @return angle in radian
double hmsToRad(const unsigned int h, const unsigned int m, const do uble s); double hmsToRad(const unsigned int h, const unsigned int m, const do uble s);
//! Convert an angle in +-dms format to radian. //! Convert an angle in +-dms format to radian.
//! @param d degree component //! @param d degree component
//! @param m arcmin component //! @param m arcmin component
skipping to change at line 177 skipping to change at line 182
//! @return the angle in radians. //! @return the angle in radians.
//! Latitude: North are positive, South are negative. //! Latitude: North are positive, South are negative.
//! Longitude: East is positive, West is negative. //! Longitude: East is positive, West is negative.
//! Note: if there is a N, S, E or W suffix, any leading + or - //! Note: if there is a N, S, E or W suffix, any leading + or -
//! characters are ignored. //! characters are ignored.
double getDecAngle(const QString& str); double getDecAngle(const QString& str);
//! Check if a number is a power of 2. //! Check if a number is a power of 2.
bool isPowerOfTwo(const int value); bool isPowerOfTwo(const int value);
//! Return the first power of two greater or equal to the given valu //! Return the first power of two bigger than the given value.
e. int getBiggerPowerOfTwo(int value);
int smallestPowerOfTwoGreaterOrEqualTo(const int value);
//! Return the smallest size with power-of two dimensions at least a
s large as given size.
QSize smallestPowerOfTwoSizeGreaterOrEqualTo(const QSize base);
//! Return the inverse sinus hyperbolic of z. //! Return the inverse sinus hyperbolic of z.
double asinh(const double z); double asinh(const double z);
/////////////////////////////////////////////////// ///////////////////////////////////////////////////
// New Qt based General Calendar Functions. // New Qt based General Calendar Functions.
//! Make from julianDay a year, month, day for the Julian Date julia nDay represents. //! Make from julianDay a year, month, day for the Julian Date julia nDay represents.
void getDateFromJulianDay(const double julianDay, int *year, int *mo nth, int *day); void getDateFromJulianDay(const double julianDay, int *year, int *mo nth, int *day);
//! Make from julianDay an hour, minute, second. //! Make from julianDay an hour, minute, second.
skipping to change at line 266 skipping to change at line 268
bool changeDateTimeForRollover(int oy, int om, int od, int oh, int o min, int os, bool changeDateTimeForRollover(int oy, int om, int od, int oh, int o min, int os,
int* ry, int* rm, int* rd, int* rh, int* rmin, int* rs); int* ry, int* rm, int* rd, int* rh, int* rmin, int* rs);
//! Output a QVariantMap to qDebug(). Formats like a tree where the re are nested objects. //! Output a QVariantMap to qDebug(). Formats like a tree where the re are nested objects.
void debugQVariantMap(const QVariant& m, const QString& indent="", c onst QString& key=""); void debugQVariantMap(const QVariant& m, const QString& indent="", c onst QString& key="");
/// Compute acos(x) /// Compute acos(x)
//! The taylor serie is not accurate around x=1 and x=-1 //! The taylor serie is not accurate around x=1 and x=-1
inline float fastAcos(const float x) inline float fastAcos(const float x)
{ {
return M_PI_2 - (x + x*x*x * (1.f/6.f + x*x * (3.f/40.f + 5. f/112.f * x*x)) ); return static_cast<float>(M_PI_2) - (x + x*x*x * (1.f/6.f + x*x * (3.f/40.f + 5.f/112.f * x*x)) );
} }
//! Compute exp(x) for small exponents x //! Compute exp(x) for small exponents x
inline float fastExp(const float x) inline float fastExp(const float x)
{ {
return (x>=0)? return (x>=0)?
(1.f + x*(1.f+ x/2.f*(1.f+ x/3.f*(1.f+x/4.f*(1.f+x/5 .f))))): (1.f + x*(1.f+ x/2.f*(1.f+ x/3.f*(1.f+x/4.f*(1.f+x/5 .f))))):
1.f / (1.f -x*(1.f -x/2.f*(1.f- x/3.f*(1.f-x /4.f*(1.f-x/5.f))))); 1.f / (1.f -x*(1.f -x/2.f*(1.f- x/3.f*(1.f-x /4.f*(1.f-x/5.f)))));
} }
skipping to change at line 565 skipping to change at line 567
//! @param jDay the JD //! @param jDay the JD
//! @param ndot value n-dot which use in the algorithm //! @param ndot value n-dot which use in the algorithm
//! @return SecularAcceleration in seconds //! @return SecularAcceleration in seconds
//! @note n-dot for secular acceleration of the Moon in ELP2000-82B is -23.8946 "/cy/cy //! @note n-dot for secular acceleration of the Moon in ELP2000-82B is -23.8946 "/cy/cy
double getMoonSecularAcceleration(const double jDay, const double nd ot); double getMoonSecularAcceleration(const double jDay, const double nd ot);
//! Get the standard error (sigma) for the value of DeltaT //! Get the standard error (sigma) for the value of DeltaT
//! @param jDay the JD //! @param jDay the JD
//! @return sigma in seconds //! @return sigma in seconds
double getDeltaTStandardError(const double jDay); double getDeltaTStandardError(const double jDay);
//! Sign function from http://stackoverflow.com/questions/1903954/is
-there-a-standard-sign-function-signum-sgn-in-c-c
template <typename T> int sign(T val) {
return (T(0) < val) - (val < T(0));
}
//! Compute cosines and sines around a circle which is split in "seg
ments" parts.
//! Values are stored in the global static array cos_sin_theta.
//! Used for the sin/cos values along a latitude circle, equator, et
c. for a spherical mesh.
//! @param slices number of partitions (elsewhere called "segments")
for the circle
float *ComputeCosSinTheta(const int slices);
//! 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 mes
h.
//! @param segments number of partitions (elsewhere called "stacks")
for the half-circle
float *ComputeCosSinRho(const int segments);
//! Compute cosines and sines around part of a circle (from top to b
ottom) 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
//! @param dRho a difference angle between the stops
//! @param segments number of segments
//! @param minAngle start angle inside the half-circle. maxAngle=min
Angle+segments*phi
float* ComputeCosSinRhoZone(const float dRho, const int segments, co
nst float minAngle);
//! Uncompress gzip or zlib compressed data.
QByteArray uncompress(const QByteArray& data);
} }
#endif // _STELUTILS_HPP_ #endif // _STELUTILS_HPP_
 End of changes. 8 change blocks. 
10 lines changed or deleted 51 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/