StelUtils.cpp   StelUtils.cpp 
skipping to change at line 88 skipping to change at line 88
h = (unsigned int)angle; h = (unsigned int)angle;
m = (unsigned int)((angle-h)*60); m = (unsigned int)((angle-h)*60);
s = (angle-h)*3600.-60.*m; s = (angle-h)*3600.-60.*m;
} }
/************************************************************************* /*************************************************************************
Convert an angle in radian to dms Convert an angle in radian to dms
*************************************************************************/ *************************************************************************/
void radToDms(double angle, bool& sign, unsigned int& d, unsigned int& m, d ouble& s) void radToDms(double angle, bool& sign, unsigned int& d, unsigned int& m, d ouble& s)
{ {
int n;
angle = std::fmod(angle,2.0*M_PI); angle = std::fmod(angle,2.0*M_PI);
sign=true; sign=true;
if (angle<0) if (angle<0)
{ {
angle *= -1; angle *= -1;
sign = false; sign = false;
} }
angle *= 180./M_PI; angle *= 180./M_PI;
d = (unsigned int)angle; n = (int)std::floor(std::fabs(3600 * angle) + 0.5);
m = (unsigned int)((angle - d)*60); s = n % 60;
s = (angle-d)*3600-60*m; n /= 60;
m = (unsigned int)(n % 60);
d = (unsigned int)(n / 60);
} }
/************************************************************************* /*************************************************************************
Convert an angle in radian to a hms formatted string Convert an angle in radian to a hms formatted string
If the minute and second part are null are too small, don't print them If the minute and second part are null are too small, don't print them
*************************************************************************/ *************************************************************************/
QString radToHmsStrAdapt(double angle) QString radToHmsStrAdapt(double angle)
{ {
unsigned int h,m; unsigned int h,m;
double s; double s;
skipping to change at line 350 skipping to change at line 353
*lng = atan2(v[1],v[0]); *lng = atan2(v[1],v[0]);
} }
void rectToSphe(double *lng, double *lat, const Vec3f& v) void rectToSphe(double *lng, double *lat, const Vec3f& v)
{ {
double r = v.length(); double r = v.length();
*lat = asin(v[2]/r); *lat = asin(v[2]/r);
*lng = atan2(v[1],v[0]); *lng = atan2(v[1],v[0]);
} }
// GZ: some additions. I need those just for quick conversions for text dis
play.
void ctRadec2Ecl(const double raRad, const double decRad, const double eclR
ad, double *lambdaRad, double *betaRad)
{
*lambdaRad=std::atan2(std::sin(raRad)*std::cos(eclRad)+std::tan(decRad)*s
td::sin(eclRad), std::cos(raRad));
*betaRad=std::asin(std::sin(decRad)*std::cos(eclRad)-std::cos(decRad)*std
::sin(eclRad)*std::sin(raRad));
}
// GZ: done
double getDecAngle(const QString& str) double getDecAngle(const QString& str)
{ {
QRegExp re1("^\\s*([\\+\\-])?\\s*(\\d+)\\s*([hHDd\xBA])\\s*(\\d+)\\s *['Mm]\\s*(\\d+(\\.\\d+)?)\\s*[\"Ss]\\s*([NSEWnsew])?\\s*$"); // DMS/HMS QRegExp re1("^\\s*([\\+\\-])?\\s*(\\d+)\\s*([hHDd\xBA])\\s*(\\d+)\\s *['Mm]\\s*(\\d+(\\.\\d+)?)\\s*[\"Ss]\\s*([NSEWnsew])?\\s*$"); // DMS/HMS
QRegExp re2("^\\s*([\\+\\-])?\\s*(\\d+(\\.\\d+)?).?([NSEWnsew])?\\s* $"); // Decimal QRegExp re2("^\\s*([\\+\\-])?\\s*(\\d+(\\.\\d+)?).?([NSEWnsew])?\\s* $"); // Decimal
if (re1.exactMatch(str)) if (re1.exactMatch(str))
{ {
bool neg = (re1.capturedTexts().at(1) == "-"); bool neg = (re1.capturedTexts().at(1) == "-");
float d = re1.capturedTexts().at(2).toFloat(); float d = re1.capturedTexts().at(2).toFloat();
float m = re1.capturedTexts().at(4).toFloat(); float m = re1.capturedTexts().at(4).toFloat();
 End of changes. 3 change blocks. 
3 lines changed or deleted 18 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/