Conversion question...
Posted: 10.05.2002, 22:48
by Rassilon
When converting right ascension from time to a float used in C++...what is the correct procedure?
eg. 12 : 40.0 (h:m) to float 12 + (40 hours in decimal format) Can't quite remember this was done...
And Declination?
eg. -11 : 37 (deg:m)
Thanks...
Posted: 11.05.2002, 09:54
by Guest
It depends on what units you want in your float. Say you want hours, then
12h40m = 12h + 40m * (1/60) (h/m) = 12.667h
since 1h = 60m. Similarly, 1m = 1s -> 1h=3600s.
If you want to convert to degrees, you have to know that
360deg = 24h -> 15deg = 1h, so
12.667h = 12.667h * 15(deg/h) = 190.0deg.
Since 2*pi rad = 360deg, we have 1deg = pi/180 rad, so in case you want radians,
190.0deg = 190.0deg * (pi/180) (rad/deg) = 3.32 rad
For declination, the same procedure as for right ascension applies, i.e.
-11deg37' = -(11deg + 37') = -(11deg + 37'*(1/60)(deg/')) = -11.62deg
since 1deg = 60' (1' = 1 arc minute).
/Alexis