Reference · The realistic Earth's pure parts
unitVectorfunction
A point on the globe as a unit vector: +z is longitude 0 on the equator, +x east, +y north.
Import it
import { unitVector } from "@johnmorrisdotca/chikyu-earth/realistic";
Definition
function unitVector(point: GeoPoint): [number, number, number]
Parameters
| Name | Type | Description |
|---|---|---|
point | GeoPoint | A longitude and latitude in degrees. |
Returns
[number, number, number]
The [x, y, z] of the point on a sphere of radius 1.
Examples
import { unitVector } from "@johnmorrisdotca/chikyu-earth/realistic";
console.log(unitVector({ lon: 90, lat: 0 }).map((n) => Math.round(n)));[ 1, 0, 0 ]What it prints (run when this page was built)