1
$\begingroup$

I'm developing my own Planetarium software using C++ following the book Practical Astronomy with your Calculator or Spreadsheet 4th Edition.

I don't know if I my formulas are correct or not, but when I check my results (Azimuth and Altitude) with Stellarium, they are different.

I have also checked my values with this page, but they are different. By the way, the azimuth and altitude given in that page are also different from the values given in Stellarium.

Do you know where can I find the formulas to covert celestial coordinate to horizontal coordinates?

$\endgroup$
  • $\begingroup$ Several immediate thoughts (eg, are you using radians when computing trigonometric functions), but the most obvious question: can we see your source code? $\endgroup$ – user21 Jan 4 '16 at 16:11
  • $\begingroup$ Yes, I'm using radians. And no, you can't see my source code. There are a lot of classes. $\endgroup$ – VansFannel Jan 5 '16 at 7:07
  • $\begingroup$ Did you verified your results other sources, and also cross-checked the same for stellarium? Maybe your reference frame is different. $\endgroup$ – Astroynamicist Jan 5 '16 at 14:37
  • $\begingroup$ How about just the part of your source code that does the calculation? Trying to debug a "black box" is fairly difficult. $\endgroup$ – user21 Jan 5 '16 at 15:17
1
$\begingroup$

It depends from which celestial coordinates you are converting. I suppose you are working in equatorial coordinates. Then, you can convert as following:

$$\tan A = {\sin h \over \cos h \sin\phi_o - \tan\delta \cos\phi_o} $$ $$ \begin{cases} \cos a \sin A = \cos\delta \sin h \\ \cos a \cos A = \cos\delta \cos h \sin\phi_o - \sin\delta \cos\phi_o \end{cases}$$ $$\sin a = \sin\phi_o \sin\delta + \cos\phi_o \cos\delta \cos h$$

Where $A$ is azimuth, $a$ altitude, $\alpha$ right ascension, $\delta$ declination, $h$ hour angle and $\phi_0$ the observer's latitude.

Source: Wikipedia

| improve this answer | |
$\endgroup$
  • $\begingroup$ Yes, that is the formula that I am using. $\endgroup$ – VansFannel Jan 4 '16 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.