//astronomy/io.github.cosinekitty.astronomy/horizon
fun horizon(time: Time, observer: Observer, ra: Double, dec: Double, refraction: Refraction): Topocentric
Calculates the apparent location of a body relative to the local horizon of an observer on the Earth.
Given a date and time, the geographic location of an observer on the Earth, and equatorial coordinates (right ascension and declination) of a celestial body, this function returns horizontal coordinates (azimuth and altitude angles) for the body relative to the horizon at the geographic location.
The right ascension ra and declination dec passed in must be equator of date coordinates, based on the Earth's true equator at the date and time of the observation. Otherwise the resulting horizontal coordinates will be inaccurate. Equator of date coordinates can be obtained by calling equator, passing in EquatorEpoch.OfDate as its equdate parameter. It is also recommended to enable aberration correction by passing in Aberration.Corrected as the aberration parameter.
This function optionally corrects for atmospheric refraction. For most uses, it is recommended to pass Refraction.Normal in the refraction parameter to correct for optical lensing of the Earth's atmosphere that causes objects to appear somewhat higher above the horizon than they actually are. However, callers may choose to avoid this correction by passing in Refraction.None. If refraction correction is enabled, the azimuth, altitude, right ascension, and declination in the Topocentric object returned by this function will all be corrected for refraction. If refraction is disabled, none of these four coordinates will be corrected; in that case, the right ascension and declination in the returned structure will be numerically identical to the respective ra and dec values passed in.
The body's apparent horizontal coordinates and equatorial coordinates, both optionally corrected for refraction.
time | The date and time of the observation. |
observer | The geographic location of the observer. |
ra | The right ascension of the body in sidereal hours. See remarks above for more details. |
dec | The declination of the body in degrees. See remarks above for more details. |
refraction | Selects whether to correct for atmospheric refraction, and if so, which model to use. The recommended value for most uses is Refraction.Normal. See remarks above for more details. |