# @behaver/solar-planets-hecc

> This package is created for calcultating main planets of solar system heliocentric ecliptic coordinate.

Latest version **1.0.10** (published 2019-06-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install @behaver/solar-planets-hecc
pnpm add @behaver/solar-planets-hecc
yarn add @behaver/solar-planets-hecc
bun add @behaver/solar-planets-hecc
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.10 |
| Published | 2019-06-13 |
| First published | 2018-11-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 1.3 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Sanwan, Dong |
| Maintainers | behaver |
| Keywords | heliocentric, coordinate |

## Links

- npm: https://www.npmjs.com/package/@behaver/solar-planets-hecc
- Repository: https://github.com/behaver/solar-planets-hecc
- Homepage: https://github.com/behaver/solar-planets-hecc#readme
- Issues: https://github.com/behaver/solar-planets-hecc/issues
- npm.io page: https://npm.io/package/@behaver/solar-planets-hecc

## Dependencies (3)

- [@behaver/angle](https://npm.io/package/@behaver/angle.md) ^2.0.3
- [@behaver/jdate](https://npm.io/package/@behaver/jdate.md) ^2.3.2
- [@behaver/coordinate](https://npm.io/package/@behaver/coordinate.md) ^3.4.0

## Recent versions

- 1.0.10 (latest) — 2019-06-13
- 1.0.8 — 2019-05-25
- 1.0.7 — 2019-03-26
- 1.0.6 — 2019-03-24
- 1.0.5 — 2019-03-22
- 1.0.4 — 2019-02-28
- 1.0.3 — 2019-02-20
- 1.0.2 — 2019-02-20
- 1.0.1 — 2018-11-11
- 1.0.0 — 2018-11-06

## README

# SolarPlanetsHECC

[![GitHub license](https://img.shields.io/badge/license-MIT-brightgreen.svg)](#) [![npm version](https://img.shields.io/npm/v/react.svg?style=flat)](https://www.npmjs.com/package/@behaver/solar-planets-hecc) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](#)

## 简介

SolarPlanetsHECC 是计算太阳系行星的动力学 Date 日心平黄道坐标的组件库，这其中包含了 *Mercury*、*Mars*、*Earth*、*Venus*、*Jupiter*、*Saturn*、*Uranus*、*Neptune* 这八个太阳系行星的日心黄道坐标计算组件。

核心组件 VSOP87 计算器文档，另见：[VSOP87Calculator](./doc/VSOP87Calculator.md)

## 安装

通过 npm 安装，在你的 node 项目目录下执行：

`npm install @behaver/solar-planets-hecc`

安装完成后，调用即可：

`const { MercuryHECC, MarsHECC, EarthHECC } = require('@behaver/solar-planets-hecc');`

## 用例

```js
const { VenusHECC } = require('@behaver/solar-planets-hecc');
const { JDateRepository } = require('@behaver/jdate');

let jdr = new JDateRepository(2446896);
let venus = VenusHECC(jdr);

// 获取金星日心黄经度数
let l = venus.l.getDegrees();

// 获取金星日心黄纬度数
let b = venus.b.getDegrees();

// 获取金星日心距离
let r = venus.r;

// 获取金星日心球坐标
let sc = venus.sc;
```

关于计算误差的设置：

```js
const { VenusHECC } = require('@behaver/solar-planets-hecc');
const { JDateRepository } = require('@behaver/jdate');

let jdr = new JDateRepository(2446896);
let venus = VenusHECC(jdr);

// 方法一：调整精度等级
venus.accuracy = 'low';

// 方法二：设置计算截断值数组
venus.setTruncation('b', [ 20, 10, 5, 3, 2, 1 ]);

// 方法三：
// 设置最大误差（瞬时）
venus.setMaxError('r', 0.000005);

// 设置平均最大误差
venus.setMaxError('r', 0.000005, 'mean');

// 设置安全最大误差
venus.setMaxError('r', 0.000005, 'safe');
```

## 类图

![SolarPlanetsHECC](./doc/img/SolarPlanetsHECC.png "SolarPlanetsHECC 组件库类图")

## API

`constructor(obTime, accuracy = 'normal')`

构造函数

* obTime 观测儒略时间
* accuracy 计算精度

`get l()`

获取 行星 Date 日心黄经值

`get b()`

获取 行星 Date 日心黄纬值

`get r()`

获取 行星 Date 日心距离，单位：AU

`get sc()`

获取 行星 Date 日心黄道球坐标

`get obTime()`

获取观测儒略时间

`set obTime(jdr)`

* jdr 儒略时间对象

设定观测儒略时间

`get accuracy()`

获取计算精度

`set accuracy(level)`

设置计算精度

* levev 包括以下几个等级：low, normal, high, fine, complete。

精度等级和安全最大误差（单位：弧度, AU）的对应关系：

* low      0.00005 
* normal   0.000005
* high     0.0000005
* fine     0.00000005
* complete 0

此处不考虑 VSOP87 数据算法自身误差，实际误差要进行叠加。

`getTruncation(item)`

获取截断值数组

* item 计算项：l、b、r

`setTruncation(item, tNumsArray)`

设置截断值数组

* item 计算项：l、b、r
* tNumsArray 截断值数组

`setMaxError(item, value, mode = 'true')`

设置计算允许最大误差

通过此方法设置运算截断值相较于 `setTruncation(item, tNumsArray)` 和 `set accuracy(level)` 会产生额外的运算量，若为了缩小运算量而使用该方法，则不适于多次调用。

* item 计算项：l、b、r
* value 最大误差数值
* mode 计算模式: true(瞬时误差)、mean(平均误差)、safe(安全误差)

`getMaxError(item)`

获取最大误差

* item 计算项：l、b、r

## 许可证书

The MIT license.

---
_Source: https://npm.io/package/@behaver/solar-planets-hecc · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
