withinfunction
Every body inside a radius of a body on a date, nearest first: nearest with no limit on how many. The radius is degrees for by: "sky" and kilometres for by: "space".
Import it
import { within } from "@johnmorrisdotca/wakusei-planets/nearest";
Definition
function within(target: BodyId, radius: number, options: Omit<NearestOptions, "count" | "within"> & { by: "space"; }): SpaceNeighbour[]
function within(target: BodyId, radius: number, options?: Omit<NearestOptions, "count" | "within"> & { by?: "sky"; }): SkyNeighbour[]
function within(target: BodyId, radius: number, options: Omit<NearestOptions, "count" | "within">): SkyNeighbour[] | SpaceNeighbour[]
Parameters
| Name | Type | Description |
|---|---|---|
target | BodyId | The body to look around. |
radius | number | How close, in degrees (the sky) or kilometres (space). |
options | Omit<NearestOptions, "count" | "within"> | The same as |
Returns
SpaceNeighbour[] | SkyNeighbour[]
The bodies inside the radius, nearest first.
Examples
import { within } from "@johnmorrisdotca/wakusei-planets/nearest";
const date = Date.UTC(2023, 2, 2, 0);
console.log(within("venus", 1, { date }).map((row) => `${row.id} ${row.angle.toFixed(2)}`).join(", "));
console.log(within("jupiter", 1_000_000, { by: "space", kind: "moon", date }).map((row) => row.id).join(", "));europa 0.53, jupiter 0.53, io 0.55, ganymede 0.55, callisto 0.58
io, europaWhat it prints (run when this page was built)