amit21sharma / stardroid

Automatically exported from code.google.com/p/stardroid
0 stars 0 forks source link

Check position against horizon #8

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Not really an issue, sorry, but you might be able to help anyway.

What i'm trying to achieve is to check whether an object is above or below the 
horizon.

But i'm totally stuck here... How am i supposed to get the "position" of the 
horizon?

Goddchen

Original issue reported on code.google.com by goddc...@googlemail.com on 31 Jan 2012 at 10:08

GoogleCodeExporter commented 8 years ago
Given RA & Dec, time, and latitude/longitude, the calculation is pretty 
straightforward. Essentially, you want to calculate altitude and azimuth. I 
found this site that has the formulae:
http://www.stargazing.net/kepler/altaz.html

Then, and object is above the horizon if altitude > 0.

In the Sky Map code, you can get the RA & Dec using the RaDec class 
(trunk/app/src/com/google/android/stardroid/units/RaDec.java). We don't 
explicitly calculate Alt/Az, which is why you have to do the calculation by 
hand.

Let me know if that makes sense.

Original comment by kevin.se...@gmail.com on 6 Feb 2012 at 1:51

GoogleCodeExporter commented 8 years ago
It does make a lot of sense :) Thanks so much.
I have already found some javascript code that calculates the sun's horizontal 
altitude directly and i successfully ported it to Java.

See the result here: 
https://market.android.com/details?id=de.goddchen.android.solarcollector :)

Original comment by goddc...@googlemail.com on 6 Feb 2012 at 7:35