distance関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The distance between two bodies on a date: the straight line between their centres at that instant, in kilometres and astronomical units, with no light time. Any two of the Sun, the planets, the dwarf planets and the moons.
インポート
import { distance } from "@johnmorrisdotca/wakusei-planets/nearest";
定義
function distance(a: BodyId, b: BodyId, date?: When): Distance
引数
| 名前 | 型 | 説明 |
|---|---|---|
a | BodyId | One body. |
b | BodyId | The other. |
date (省略可) | When | undefined | The moment, a |
戻り値
Distance
The distance and the accuracy to expect of it.
例
import { distance } from "@johnmorrisdotca/wakusei-planets/nearest";
const mars = distance("earth", "mars", Date.UTC(2003, 7, 27, 9));
console.log(mars.distanceAu.toFixed(4), Math.round(mars.distanceKm), "km");0.3727 55756681 km出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。