-
Notifications
You must be signed in to change notification settings - Fork 0
/
equatorial.js
41 lines (37 loc) · 991 Bytes
/
equatorial.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/**
* @module sowngwala/coords/equatorial
*/
import { isEmpty } from 'ramda';
/**
* @typedef AngleContext
* @type {import('./angle.js').AngleContext}
*/
/**
* An object returned when calling
* 'EquaCoord' which represents
* the position of the planetary body
* in Equatorial coordinate system,
* and it consists of "right ascension
* (α)" and "declination (δ)".
*
* @typedef EquaCoordContext
* @type {Object}
* @property {AngleContext} asc - right ascension (α)
* @property {AngleContext} dec - declination (δ)
*/
/**
* @public
* @function
* @throw {Error}
* @param {Object} args
* @param {AngleContext} args.asc - right ascension (α)
* @param {AngleContext} args.dec - declination (δ)
* @returns {EquaCoordContext}
*/
export const EquaCoord = ({ asc, dec }) => {
if (isEmpty(asc)) throw new Error(`No 'asc'`);
if (isEmpty(dec)) throw new Error(`No 'dec'`);
asc.calibrate({ angle: true });
dec.calibrate({ angle: true });
return { asc, dec };
};