Conversion question...

General discussion about Celestia that doesn't fit into other forums.
Topic author
Rassilon
Posts: 1887
Joined: 29.01.2002
With us: 22 years 10 months
Location: Altair

Conversion question...

Post #1by Rassilon » 10.05.2002, 22:48

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...
I'm trying to teach the cavemen how to play scrabble, its uphill work. The only word they know is Uhh and they dont know how to spell it!

Guest

Post #2by Guest » 11.05.2002, 09:54

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


Return to “Celestia Users”