Calculate elevation angle as observed from the ground

Hi,

I have two points consisting of long/lat/height. I’d like to calculate the elevation angle (as though we were standing on the ground at the 1st point looking up at the 2nd point)

I’ve been working on this gist: http://cesiumjs.org/Cesium/Apps/Sandcastle/?src=Hello%20World.html&label=Showcases&gist=64912dc9178bf064ade2f65f671bfa56

Ultimately I’m trying to adjust the pitch of the cone to match that of the blue line.

Any help would be greatly appreciated.

Thank you,

Fidel

Kevin Ring suggested the following. Could someone please walk me through how this would be done in code?

If you’re interested in the elevation angle as observed by a point on the ground, your plane of interest is probably the local horizontal plane. In other words, a plane with a normal parallel to the WGS84 ellipsoid surface normal. This plane isn’t exactly the same as what a level would show you at that point on the Earth, but it’s very close. To transform your target point in the Earth-fixed frame to this local horizontal plane, you can use Transforms.eastNorthUpToFixedFrame. That returns a Matrix4, which you then multiply your target point vector by, yielding a new vector. Normalize that vector, and then the elevation angle is simply asin(z) of the normalized vector.

Hi Fidel,

I used a slightly different method, but try this code example: http://cesiumjs.org/Cesium/Apps/Sandcastle/?src=Hello%20World.html&label=Showcases&gist=c16fff23b7b1283afea477747c731e37

Best,

  • Rachel

Wow, that is perfect. Thanks Rachel