Hello,

I am currently working on how to find the azimuth with only having information about two points on the globe. The information available due to previous code are longitude, latitude, altitude, and the distance in kilometers between the two points.

I have constructed equations and logical statements to help derive the angle, yet these are not working. Does anybody have an idea as to what is wrong with the code or if there is an easier way to go about solving this problem?

var geodesic = new Cesium.EllipsoidGeodesic(positions[0], positions[1]);

var Dist = (((geodesic.surfaceDistance.toFixed(2))/1000));

var lat1= positions[1].latitude;

var lat0= positions[0].latitude;

var lon1= positions[1].longitude;

var lon0= positions[0].longitude;

var yDist= Math.abs(lat1 - lat0)*(111.2);

var b = Math.acos(Math.cos(90- lat1)*Math.cos(90- lat0) + Math.sin(90-lat1)*Math.sin(90-lat1)*Math.cos(lon1- lon0));

var azi = Math.asin(Math.sin(90-lat1)*Math.sin(lon1-lon0)/Math.sin(b));

```
if ((lat1 > lat0)&& (lon1 > lon0))
{
console.log(azi*100);
}
if ((lat1 < lat0)&& (lon1 < lon0))
{
console.log(180 - azi*100);
}
if ((lat1 < lat0)&& (lon1 > lon0))
{
console.log(180 - azi*100);
}
if ((lat1 > lat0)&& (lon1 < lon0))
{
console.log(azi*100 + 360);
}
```