django-vue3-admin-web/node_modules/astronomia/lib/parallax.cjs
2025-10-20 21:21:14 +08:00

175 lines
6.7 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var base = require('./base.cjs');
var globe = require('./globe.cjs');
var sidereal = require('./sidereal.cjs');
var sexagesimal = require('./sexagesimal.cjs');
/**
* @copyright 2013 Sonia Keys
* @copyright 2016 commenthol
* @license MIT
* @module parallax
*/
const horPar = (8.794 / 3600) * Math.PI / 180; // 8".794 arcseconds in radians
/**
* Horizontal returns equatorial horizontal parallax of a body.
*
* @param {number} Δ - distance in AU.
* @return {number} parallax in radians.
*/
function horizontal (Δ) {
// (40.1) p. 279
return Math.asin(Math.sin(horPar) / Δ)
// return horPar / Δ // with sufficient accuracy
}
/**
* Topocentric returns topocentric positions including parallax.
*
* Arguments α, δ are geocentric right ascension and declination in radians.
* Δ is distance to the observed object in AU. ρsφ, ρcφ are parallax
* constants (see package globe.) lon is geographic longitude of the observer,
* jde is time of observation.
*
* @param {Coord} c - geocentric right ascension and declination in radians
* @param {number} ρsφ - parallax constants (see package globe.)
* @param {number} ρcφ - parallax constants (see package globe.)
* @param {number} lon - geographic longitude of the observer (measured positively westwards!)
* @param {number} jde - time of observation
* @return {Coord} observed topocentric ra and dec in radians.
*/
function topocentric (c, ρ, ρ, lon, jde) {
const [α, δ, Δ] = [c.ra, c.dec, c.range];
const π = horizontal(Δ);
const θ0 = new sexagesimal["default"].Time(sidereal["default"].apparent(jde)).rad();
const H = base["default"].pmod(θ0 - lon - α, 2 * Math.PI);
const = Math.sin(π);
const [sH, cH] = base["default"].sincos(H);
const [, ] = base["default"].sincos(δ);
const Δα = Math.atan2(-ρ * * sH, - ρ * * cH); // (40.2) p. 279
const α_ = α + Δα;
const δ_ = Math.atan2(( - ρ * ) * Math.cos(Δα), - ρ * * cH); // (40.3) p. 279
return new base.Coord(α_, δ_)
}
/**
* Topocentric2 returns topocentric corrections including parallax.
*
* This function implements the "non-rigorous" method descripted in the text.
*
* Note that results are corrections, not corrected coordinates.
*
* @param {Coord} c - geocentric right ascension and declination in radians
* @param {number} ρsφ - parallax constants (see package globe.)
* @param {number} ρcφ - parallax constants (see package globe.)
* @param {number} lon - geographic longitude of the observer (measured positively westwards!)
* @param {number} jde - time of observation
* @return {Coord} observed topocentric ra and dec in radians.
*/
function topocentric2 (c, ρ, ρ, lon, jde) {
const [α, δ, Δ] = [c.ra, c.dec, c.range];
const π = horizontal(Δ);
const θ0 = new sexagesimal["default"].Time(sidereal["default"].apparent(jde)).rad();
const H = base["default"].pmod(θ0 - lon - α, 2 * Math.PI);
const [sH, cH] = base["default"].sincos(H);
const [, ] = base["default"].sincos(δ);
const Δα = -π * ρ * sH / ; // (40.4) p. 280
const Δδ = -π * (ρ * - ρ * cH * ); // (40.5) p. 280
return new base["default"].Coord(Δα, Δδ)
}
/**
* Topocentric3 returns topocentric hour angle and declination including parallax.
*
* This function implements the "alternative" method described in the text.
* The method should be similarly rigorous to that of Topocentric() and results
* should be virtually consistent.
*
* @param {Coord} c - geocentric right ascension and declination in radians
* @param {number} ρsφ - parallax constants (see package globe.)
* @param {number} ρcφ - parallax constants (see package globe.)
* @param {number} lon - geographic longitude of the observer (measured positively westwards!)
* @param {number} jde - time of observation
* @return {Array}
* {number} H_ - topocentric hour angle
* {number} δ_ - topocentric declination
*/
function topocentric3 (c, ρ, ρ, lon, jde) {
const [α, δ, Δ] = [c.ra, c.dec, c.range];
const π = horizontal(Δ);
const θ0 = new sexagesimal["default"].Time(sidereal["default"].apparent(jde)).rad();
const H = base["default"].pmod(θ0 - lon - α, 2 * Math.PI);
const = Math.sin(π);
const [sH, cH] = base["default"].sincos(H);
const [, ] = base["default"].sincos(δ);
const A = * sH;
const B = * cH - ρ * ;
const C = - ρ * ;
const q = Math.sqrt(A * A + B * B + C * C);
const H_ = Math.atan2(A, B);
const δ_ = Math.asin(C / q);
return [H_, δ_]
}
/**
* TopocentricEcliptical returns topocentric ecliptical coordinates including parallax.
*
* Arguments `c` are geocentric ecliptical longitude and latitude of a body,
* s is its geocentric semidiameter. φ, h are the observer's latitude and
* and height above the ellipsoid in meters. ε is the obliquity of the
* ecliptic, θ is local sidereal time, π is equatorial horizontal parallax
* of the body (see Horizonal()).
*
* All angular parameters and results are in radians.
*
* @param {Coord} c - geocentric right ascension and declination in radians
* @param {number} s - geocentric semidiameter of `c`
* @param {number} φ - observer's latitude
* @param {number} h - observer's height above the ellipsoid in meters
* @param {number} ε - is the obliquity of the ecliptic
* @param {number} θ - local sidereal time
* @param {number} π - equatorial horizontal parallax of the body
* @return {Array}
* {number} λ_ - observed topocentric longitude
* {number} β_ - observed topocentric latitude
* {number} s_ - observed topocentric semidiameter
*/
function topocentricEcliptical (c, s, φ, h, ε, θ, π) {
const [λ, β] = [c.lon, c.lat];
const [S, C] = globe["default"].Earth76.parallaxConstants(φ, h);
const [, ] = base["default"].sincos(λ);
const [, ] = base["default"].sincos(β);
const [, ] = base["default"].sincos(ε);
const [, ] = base["default"].sincos(θ);
const = Math.sin(π);
const N = * - C * * ;
let λ_ = Math.atan2( * - * (S * + C * * ), N);
if (λ_ < 0) {
λ_ += 2 * Math.PI;
}
const _ = Math.cos(λ_);
const β_ = Math.atan(_ * ( - * (S * - C * * )) / N);
const s_ = Math.asin(_ * Math.cos(β_) * Math.sin(s) / N);
return [λ_, β_, s_]
}
var parallax = {
horizontal,
topocentric,
topocentric2,
topocentric3,
topocentricEcliptical
};
exports["default"] = parallax;
exports.horizontal = horizontal;
exports.topocentric = topocentric;
exports.topocentric2 = topocentric2;
exports.topocentric3 = topocentric3;
exports.topocentricEcliptical = topocentricEcliptical;