Better way of calculating elevation angle

I've written some code to calculate the range, azimuth and elevation between two points.
Sandcastle is here:
The values are printed to the console.

All the calculations work very accurately. I.e. when they are used to calculate the orientation of a cylinder, the start and end of the cylinder fall exactly on the source and target.

You'll notice though that toElevationRadiansNumerical() is not very elegant. It tries different elevation angles until it finds one that produces the expected target.

Is there a better (more concise) way to calculate the elevation angle yet still produce good results?

Hi there,

While I’m no rocket scientist, after a search I found this previous thread thread. There, they suggest using the EllipsoidGeodesic class and in particular the startHeading property.

Thanks, hopefully that helps!


Thanks Gabby,

The bearing is calculated using EllipsoidGeodesic and startHeading. I'm looking to improve the elevation calculation.


Sorry, I missed that! Like I said, I’m not familiar with the algorithms used here. I would try reaching out to the community members in that thread as they are likely more versed in this.