wrapLonfunction
Fold a longitude into the half-open range from -180 up to, but not including, 180. 180 and -180 are the same meridian, and both come back as -180.
Import it
import { wrapLon } from "@johnmorrisdotca/chikyu-earth/door";
Definition
function wrapLon(lon: number): number
Parameters
| Name | Type | Description |
|---|---|---|
lon | number | A longitude in degrees, which may fall outside one turn. |
Returns
number
The longitude in [-180, 180).
Examples
import { wrapLon } from "@johnmorrisdotca/chikyu-earth/door";
console.log(wrapLon(180), wrapLon(-180), wrapLon(190));-180 -180 -170What it prints (run when this page was built)