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;
n = (int)std::floor(std::fabs(3600 * angle) + 0.5); d = (unsigned int)angle;
s = n % 60; m = (unsigned int)((angle - d)*60);
n /= 60; s = (angle-d)*3600-60*m;
m = (unsigned int)(n % 60); // workaround for rounding numbers
d = (unsigned int)(n / 60); if (s>59.9)
{
s = 0.;
if (sign)
m += 1;
else
m -= 1;
}
if (m==60)
{
m = 0.;
if (sign)
d += 1;
else
d -= 1;
}
} }
/************************************************************************* /*************************************************************************
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;
 End of changes. 2 change blocks. 
6 lines changed or deleted 20 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/