mirror of
https://github.com/cosinekitty/astronomy.git
synced 2026-05-19 06:17:03 -04:00
C Astronomy_EclipticGeoMoon implemented.
This is a thin wrapper function for the internal function CalcMoon, which has already been extensively validated. It will enable outside users to search for ascending and descending nodes of the Moon, or to calculate ecliptic spherical coordinates for the Moon for any other useful purpose.
This commit is contained in:
@@ -1893,6 +1893,8 @@ $ASTRO_ADDSOL()
|
||||
* [Astronomy on the Personal Computer](https://www.springer.com/us/book/9783540672210)
|
||||
* by Montenbruck and Pfleger.
|
||||
*
|
||||
* To calculate ecliptic spherical coordinates instead, see #Astronomy_EclipticGeoMoon.
|
||||
*
|
||||
* @param time The date and time for which to calculate the Moon's position.
|
||||
* @return The Moon's position as a vector in J2000 Cartesian equatorial (EQJ) coordinates.
|
||||
*/
|
||||
@@ -1928,6 +1930,40 @@ astro_vector_t Astronomy_GeoMoon(astro_time_t time)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Calculates spherical ecliptic geocentric position of the Moon.
|
||||
*
|
||||
* Given a time of observation, calculates the Moon's geocentric position
|
||||
* in ecliptic spherical coordinates. Provides the ecliptic latitude and
|
||||
* longitude in degrees, and the geocentric distance in astronomical units (AU).
|
||||
* The ecliptic longitude is measured relative to the equinox of date.
|
||||
*
|
||||
* This algorithm is based on the Nautical Almanac Office's *Improved Lunar Ephemeris* of 1954,
|
||||
* which in turn derives from E. W. Brown's lunar theories from the early twentieth century.
|
||||
* It is adapted from Turbo Pascal code from the book
|
||||
* [Astronomy on the Personal Computer](https://www.springer.com/us/book/9783540672210)
|
||||
* by Montenbruck and Pfleger.
|
||||
*
|
||||
* To calculate an equatorial J2000 vector instead, use #Astronomy_GeoMoon.
|
||||
*
|
||||
* @param time The date and time for which to calculate the Moon's position.
|
||||
* @return The Moon's position expressed in ecliptic coordinates using the mean equinox of date.
|
||||
*/
|
||||
astro_spherical_t Astronomy_EclipticGeoMoon(astro_time_t time)
|
||||
{
|
||||
astro_spherical_t sphere;
|
||||
|
||||
CalcMoon(time.tt / 36525.0, &sphere.lon, &sphere.lat, &sphere.dist);
|
||||
|
||||
/* Convert angles from radians to degrees. */
|
||||
sphere.lon *= RAD2DEG;
|
||||
sphere.lat *= RAD2DEG;
|
||||
|
||||
sphere.status = ASTRO_SUCCESS;
|
||||
return sphere;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Calculates equatorial geocentric position and velocity of the Moon at a given time.
|
||||
*
|
||||
|
||||
@@ -466,6 +466,34 @@ Given coordinates relative to the Earth's equator at J2000 (the instant of noon
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
<a name="Astronomy_EclipticGeoMoon"></a>
|
||||
### Astronomy_EclipticGeoMoon(time) ⇒ [`astro_spherical_t`](#astro_spherical_t)
|
||||
|
||||
**Calculates spherical ecliptic geocentric position of the Moon.**
|
||||
|
||||
|
||||
|
||||
Given a time of observation, calculates the Moon's geocentric position in ecliptic spherical coordinates. Provides the ecliptic latitude and longitude in degrees, and the geocentric distance in astronomical units (AU). The ecliptic longitude is measured relative to the equinox of date.
|
||||
|
||||
This algorithm is based on the Nautical Almanac Office's *Improved Lunar Ephemeris* of 1954, which in turn derives from E. W. Brown's lunar theories from the early twentieth century. It is adapted from Turbo Pascal code from the book [Astronomy on the Personal Computer](https://www.springer.com/us/book/9783540672210) by Montenbruck and Pfleger.
|
||||
|
||||
To calculate an equatorial J2000 vector instead, use [`Astronomy_GeoMoon`](#Astronomy_GeoMoon).
|
||||
|
||||
|
||||
|
||||
**Returns:** The Moon's position expressed in ecliptic coordinates using the mean equinox of date.
|
||||
|
||||
|
||||
|
||||
| Type | Parameter | Description |
|
||||
| --- | --- | --- |
|
||||
| [`astro_time_t`](#astro_time_t) | `time` | The date and time for which to calculate the Moon's position. |
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
<a name="Astronomy_EclipticLongitude"></a>
|
||||
@@ -643,6 +671,8 @@ Given a time of observation, calculates the Moon's position as a vector. The vec
|
||||
|
||||
This algorithm is based on the Nautical Almanac Office's *Improved Lunar Ephemeris* of 1954, which in turn derives from E. W. Brown's lunar theories from the early twentieth century. It is adapted from Turbo Pascal code from the book [Astronomy on the Personal Computer](https://www.springer.com/us/book/9783540672210) by Montenbruck and Pfleger.
|
||||
|
||||
To calculate ecliptic spherical coordinates instead, see [`Astronomy_EclipticGeoMoon`](#Astronomy_EclipticGeoMoon).
|
||||
|
||||
|
||||
|
||||
**Returns:** The Moon's position as a vector in J2000 Cartesian equatorial (EQJ) coordinates.
|
||||
|
||||
@@ -2082,6 +2082,8 @@ static void CalcMoon(
|
||||
* [Astronomy on the Personal Computer](https://www.springer.com/us/book/9783540672210)
|
||||
* by Montenbruck and Pfleger.
|
||||
*
|
||||
* To calculate ecliptic spherical coordinates instead, see #Astronomy_EclipticGeoMoon.
|
||||
*
|
||||
* @param time The date and time for which to calculate the Moon's position.
|
||||
* @return The Moon's position as a vector in J2000 Cartesian equatorial (EQJ) coordinates.
|
||||
*/
|
||||
@@ -2117,6 +2119,40 @@ astro_vector_t Astronomy_GeoMoon(astro_time_t time)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Calculates spherical ecliptic geocentric position of the Moon.
|
||||
*
|
||||
* Given a time of observation, calculates the Moon's geocentric position
|
||||
* in ecliptic spherical coordinates. Provides the ecliptic latitude and
|
||||
* longitude in degrees, and the geocentric distance in astronomical units (AU).
|
||||
* The ecliptic longitude is measured relative to the equinox of date.
|
||||
*
|
||||
* This algorithm is based on the Nautical Almanac Office's *Improved Lunar Ephemeris* of 1954,
|
||||
* which in turn derives from E. W. Brown's lunar theories from the early twentieth century.
|
||||
* It is adapted from Turbo Pascal code from the book
|
||||
* [Astronomy on the Personal Computer](https://www.springer.com/us/book/9783540672210)
|
||||
* by Montenbruck and Pfleger.
|
||||
*
|
||||
* To calculate an equatorial J2000 vector instead, use #Astronomy_GeoMoon.
|
||||
*
|
||||
* @param time The date and time for which to calculate the Moon's position.
|
||||
* @return The Moon's position expressed in ecliptic coordinates using the mean equinox of date.
|
||||
*/
|
||||
astro_spherical_t Astronomy_EclipticGeoMoon(astro_time_t time)
|
||||
{
|
||||
astro_spherical_t sphere;
|
||||
|
||||
CalcMoon(time.tt / 36525.0, &sphere.lon, &sphere.lat, &sphere.dist);
|
||||
|
||||
/* Convert angles from radians to degrees. */
|
||||
sphere.lon *= RAD2DEG;
|
||||
sphere.lat *= RAD2DEG;
|
||||
|
||||
sphere.status = ASTRO_SUCCESS;
|
||||
return sphere;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Calculates equatorial geocentric position and velocity of the Moon at a given time.
|
||||
*
|
||||
|
||||
@@ -1120,6 +1120,7 @@ astro_func_result_t Astronomy_HelioDistance(astro_body_t body, astro_time_t time
|
||||
astro_vector_t Astronomy_HelioVector(astro_body_t body, astro_time_t time);
|
||||
astro_vector_t Astronomy_GeoVector(astro_body_t body, astro_time_t time, astro_aberration_t aberration);
|
||||
astro_vector_t Astronomy_GeoMoon(astro_time_t time);
|
||||
astro_spherical_t Astronomy_EclipticGeoMoon(astro_time_t time);
|
||||
astro_state_vector_t Astronomy_GeoMoonState(astro_time_t time);
|
||||
astro_state_vector_t Astronomy_GeoEmbState(astro_time_t time);
|
||||
astro_libration_t Astronomy_Libration(astro_time_t time);
|
||||
|
||||
Reference in New Issue
Block a user