Reference · Where the Sun, Moon and planets are for a date, in two scales, with the camera maths
groundDirectionfunction
The unit direction, in the scene's axes, of a longitude and latitude on the Earth as the stars see it at ms: the camera fixed to the stars looks at the same place on the ground only at that moment, and the Earth turns away under it as time runs.
Import it
import { groundDirection } from "@johnmorrisdotca/wakusei-planets/space";
Definition
function groundDirection(lon: number, lat: number, ms: number): Vec3
Parameters
| Name | Type | Description |
|---|---|---|
lon | number | Degrees east. |
lat | number | Degrees north. |
ms | number | The moment, in milliseconds since the Unix epoch. |
Returns
Vec3
The direction from the Earth's centre.
Examples
import { groundDirection } from "@johnmorrisdotca/wakusei-planets/space";
const [x, y, z] = groundDirection(0, 90, Date.UTC(2026, 10, 2));
console.log(y.toFixed(2));1.00What it prints (run when this page was built)