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)
{ {
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;
s = m = (unsigned int)((angle - d)*60);
s = (angle-d)*3600-60*m;
m = // workaround for rounding numbers
d 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
*************************************************************************/ *************************************************************************/