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 <cmath>
#include "VecMath.hpp" #include "VecMath.hpp"
#include <QVariantMap> #include <QVariantMap>
#include <QDateTime> #include <QDateTime>
#include <QString> #include <QString>
// astronomical unit (km) // astronomical unit (km)
#define AU 149597870.691 #define AU 149597870.691
#define AU_KM (1.0/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
#define stelpow10f(x) std::exp((x) * 2.3025850930f)
//! @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" //! Return the name and the version of operating system, i.e. "Mac O S X 10.7"
skipping to change at line 88 skipping to change at line 89
void radToDms(double rad, bool& sign, unsigned int& d, unsigned int& m, double& s); void radToDms(double rad, bool& sign, unsigned int& d, unsigned int& m, double& s);
//! Convert an angle in radian to decimal degree. //! Convert an angle in radian to decimal degree.
//! @param rad input angle in radian //! @param rad input angle in radian
//! @param sign true if positive, false otherwise //! @param sign true if positive, false otherwise
//! @param deg decimal degree //! @param deg decimal degree
void radToDecDeg(double rad, bool& sign, double& deg); void radToDecDeg(double rad, bool& sign, double& deg);
//! Convert an angle in radian to a decimal degree string. //! Convert an angle in radian to a decimal degree string.
//! @param angle input angle in radian //! @param angle input angle in radian
//! @param precision
//! @param useD Define if letter "d" must be used instead of deg sig n //! @param useD Define if letter "d" must be used instead of deg sig n
//! @param useC Define if function should use 0-360 degrees //! @param useC Define if function should use 0-360 degrees
QString radToDecDegStr(const double angle, const bool useD=false, co nst bool useC=false); QString radToDecDegStr(const double angle, const int precision = 4, const bool useD=false, const bool useC=false);
//! Convert an angle in radian to a hms formatted string. //! Convert an angle in radian to a hms formatted string.
//! If the second, minute part is == 0, it is not output //! If the second, minute part is == 0, it is not output
//! @param angle input angle in radian //! @param angle input angle in radian
QString radToHmsStrAdapt(const double angle); QString radToHmsStrAdapt(const double angle);
//! Convert an angle in radian to a hms formatted string. //! Convert an angle in radian to a hms formatted string.
//! @param angle input angle in radian //! @param angle input angle in radian
//! @param decimal output decimal second value //! @param decimal output decimal second value
QString radToHmsStr(const double angle, const bool decimal=false); QString radToHmsStr(const double angle, const bool decimal=false);
skipping to change at line 155 skipping to change at line 157
//! Convert from spherical coordinates to Rectangular direction. //! Convert from spherical coordinates to Rectangular direction.
//! @param lng longitude in radian //! @param lng longitude in radian
//! @param lat latitude in radian //! @param lat latitude in radian
//! @param v the resulting 3D unit vector //! @param v the resulting 3D unit vector
void spheToRect(const double lng, const double lat, Vec3d& v); void spheToRect(const double lng, const double lat, Vec3d& v);
//! Convert from spherical coordinates to Rectangular direction. //! Convert from spherical coordinates to Rectangular direction.
//! @param lng longitude in radian //! @param lng longitude in radian
//! @param lat latitude in radian //! @param lat latitude in radian
//! @param v the resulting 3D unti vector //! @param v the resulting 3D unit vector
void spheToRect(const float lng, const float lat, Vec3f& v); void spheToRect(const float lng, const float lat, Vec3f& v);
//! Convert from spherical coordinates to Rectangular direction. //! Convert from spherical coordinates to Rectangular direction.
//! @param lng double* to store longitude in radian //! @param lng double* to store longitude in radian
//! @param lat double* to store latitude in radian //! @param lat double* to store latitude in radian
//! @param v the input 3D vector //! @param v the input 3D vector
void rectToSphe(double *lng, double *lat, const Vec3d& v); void rectToSphe(double *lng, double *lat, const Vec3d& v);
//! Convert from spherical coordinates to Rectangular direction. //! Convert from spherical coordinates to Rectangular direction.
//! @param lng float* to store longitude in radian //! @param lng float* to store longitude in radian
//! @param lat float* to store latitude in radian //! @param lat float* to store latitude in radian
//! @param v the input 3D vector //! @param v the input 3D vector
void rectToSphe(float *lng, float *lat, const Vec3d& v); void rectToSphe(float *lng, float *lat, const Vec3d& v);
//! Convert from spherical coordinates to Rectangular direction. //! Convert from spherical coordinates to Rectangular direction.
//! @param lng float* to store longitude in radian //! @param lng float* to store longitude in radian
//! @param lat float* to store latitude in radian //! @param lat float* to store latitude in radian
//! @param v the input 3D vector //! @param v the input 3D vector
void rectToSphe(float *lng, float *lat, const Vec3f& v); void rectToSphe(float *lng, float *lat, const Vec3f& v);
// GZ: some additions. I need those just for quick conversions for t ext display.
//! Coordinate Transformation from equatorial to ecliptical //! Coordinate Transformation from equatorial to ecliptical
void ctRadec2Ecl(const double raRad, const double decRad, const doub le eclRad, double *lambdaRad, double *betaRad); void ctRadec2Ecl(const double raRad, const double decRad, const doub le eclRad, double *lambdaRad, double *betaRad);
// GZ: done
//! Convert a string longitude, latitude, RA or Declination angle //! Convert a string longitude, latitude, RA or Declination angle
//! to radians. //! to radians.
//! @param str the angle in format something like these: //! @param str the angle in format something like these:
//! - +53d 51'21.6" //! - +53d 51'21.6"
//! - +53d51'21.6" //! - +53d51'21.6"
//! - -1d 10'31.8" //! - -1d 10'31.8"
//! - +46d6'31" //! - +46d6'31"
//! - 50D46'0"N //! - 50D46'0"N
//! - 123D47'59"W //! - 123D47'59"W
skipping to change at line 612 skipping to change at line 612
//! Compute cosines and sines around a half-circle which is split in "segments" parts. //! 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. //! 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. //! 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 //! @param segments number of partitions (elsewhere called "stacks") for the half-circle
float *ComputeCosSinRho(const int segments); 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. //! 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. //! Values are stored in the global static array cos_sin_rho.
//! Used for the sin/cos values along a meridian. //! 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 //! This allows leaving away pole caps. The array now contains value s for the region minAngle+segments*phi
//! @param dRho a difference angle between the stops //! @param dRho a difference angle between the stops
//! @param segments number of segments //! @param segments number of segments
//! @param minAngle start angle inside the half-circle. maxAngle=min Angle+segments*phi //! @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); float* ComputeCosSinRhoZone(const float dRho, const int segments, co nst float minAngle);
//! Uncompress gzip or zlib compressed data. //! Uncompress gzip or zlib compressed data.
QByteArray uncompress(const QByteArray& data); QByteArray uncompress(const QByteArray& data);
#ifdef _MSC_BUILD
inline double trunc(double x)
{
return (x < 0 ? std::ceil(x) : std::floor(x));
}
#else
inline double trunc(double x) { return ::trunc(x); }
#endif
} }
#endif // _STELUTILS_HPP_ #endif // _STELUTILS_HPP_
 End of changes. 9 change blocks. 
7 lines changed or deleted 16 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/