Reference · The Sun, Moon and planets: pure parts
satelliteAxesfunction
The axes of a satellite flying: x along the way it goes (its velocity, taken level with the ground below it), z straight away from the Earth's centre, and y to complete them (z cross x, so it points to the left of the way it goes).
The family's convention for a model: its nose or long axis along +x, its top (the side that faces space) along +z.
Import it
import { satelliteAxes } from "@johnmorrisdotca/chikyu-earth/space";
Definition
function satelliteAxes(position: Vec3, velocity: Vec3): { x: Vec3; y: Vec3; z: Vec3; } | null
Parameters
| Name | Type | Description |
|---|---|---|
position | Vec3 | Where the satellite is, from the Earth's centre, in any unit. |
velocity | Vec3 | The way it is going, in any unit. |
Returns
{ x: Vec3; y: Vec3; z: Vec3; } | null
Three unit vectors, x, y and z, in the scene's axes; null when the position is the centre or the satellite does not move.
Examples
import { satelliteAxes } from "@johnmorrisdotca/chikyu-earth/space";
const axes = satelliteAxes([1.066, 0, 0], [0, 0, -7.66]);
console.log(axes?.x, axes?.z);[ 0, 0, -1 ] [ 1, 0, 0 ]What it prints (run when this page was built)