nearest関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The bodies nearest to a body on a date, nearest first: by the angle between them in the sky of an observer, or by the distance between them in space. The Sun, the planets, the dwarf planets and the moons are searched; the target itself, and the body the sky is seen from, are not in the answer.
A sky angle is astrometric: the observer's place at the date, each body where it was when its light left (a second and a half for the Moon, hours for Neptune), with no aberration or light bending. It is the angle between two centres, found with an arc tangent so that it is as exact near 0 and 180 degrees as at 90. A distance is the straight line between the two centres at that instant, with no light time. Every result carries the accuracy to expect from the theories (the accuracy guide's limits, combined).
インポート
import { nearest } from "@johnmorrisdotca/wakusei-planets/nearest";
定義
function nearest(target: BodyId, options: NearestOptions & { by: "space"; }): SpaceNeighbour[]
function nearest(target: BodyId, options?: NearestOptions & { by?: "sky"; }): SkyNeighbour[]
function nearest(target: BodyId, options: NearestOptions): SkyNeighbour[] | SpaceNeighbour[]
引数
| 名前 | 型 | 説明 |
|---|---|---|
target | BodyId | The body to look around. |
options | NearestOptions |
|
戻り値
SpaceNeighbour[] | SkyNeighbour[]
The bodies, nearest first, as { id, kind, angle, uncertaintyArcseconds } for the sky and { id, kind, distanceKm, distanceAu, uncertaintyKm } for space.
例
import { nearest } from "@johnmorrisdotca/wakusei-planets/nearest";
const date = Date.UTC(2020, 11, 21, 18);
console.log(nearest("jupiter", { count: 2, kind: "planet", date }).map((row) => `${row.id} ${row.angle.toFixed(2)}`).join(", "));
console.log(nearest("earth", { by: "space", kind: "planet", count: 2, date }).map((row) => `${row.id} ${row.distanceAu.toFixed(2)} au`).join(", "));saturn 0.10, mercury 29.25
mars 0.81 au, mercury 1.44 au出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。