Comparing version 0.1.0-alpha3 to 0.1.0-alpha4
@@ -230,7 +230,14 @@ 'use strict'; | ||
const theta = Math.atan2(Math.sqrt(x ** 2 + y ** 2), z); | ||
let phi = Math.PI / 2; | ||
// From: https://en.wikipedia.org/wiki/Spherical_coordinate_system#Coordinate_system_conversions | ||
let phi = NaN; | ||
if (x > 0) | ||
phi = Math.atan(y / x); | ||
else if (x < 0) | ||
phi = Math.PI + Math.atan(y / x); | ||
else if (x < 0 && y >= 0) | ||
phi = Math.atan(y / x) + Math.PI; | ||
else if (x < 0 && y < 0) | ||
phi = Math.atan(y / x) - Math.PI; | ||
else if (x === 0 && y > 0) | ||
phi = Math.PI; | ||
else if (x === 0 && y < 0) | ||
phi = -Math.PI; | ||
return { | ||
@@ -237,0 +244,0 @@ lat: thetaToLat(theta), |
{ | ||
"name": "msfs-geo", | ||
"version": "0.1.0-alpha3", | ||
"version": "0.1.0-alpha4", | ||
"description": "A set of geographic mathematical utility functions, designed for use in aviation, hence the use of Nautical Miles, Feet, and Degrees", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
130231
832