title: Calculate elevation angle between two lat/long/alt points using cesiumjs
body: <p>Using cesiumjs, I'd like to calculate the elevation angle between two points as though we were standing on a hot air balloon at the first point. The points are simple cartographic points (lat, long, altitude).</p>
  
  <p>This picture sums it up nicely
  <a href="https://i.stack.imgur.com/62FVT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/62FVT.png" alt="enter image description here"></a></p>
  
  <p>After some researching, this was a suggested approach:</p>
  
  <blockquote>
    <p>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.</p>
  </blockquote>
  
  <p>This is the code I've put together, but it returns NaN for the multiplication. Any suggestions would be greatly appreciated.</p>
  
  <pre><code>var Cesium = require('cesium');
  
  var startPoint = new Cesium.Cartesian3.fromDegrees(-107, 30, 3000);
  var endPoint = new Cesium.Cartesian3.fromDegrees(-112, 25, 1000000);
  
  //To transform your target point in the Earth-fixed frame to this local horizontal plane, you can use Transforms.eastNorthUpToFixedFrame.
  var effTarget = Cesium.Transforms.eastNorthUpToFixedFrame(endPoint)
  console.log("Earth-fixed frame (target): " + effTarget);
  
  //That returns a Matrix4, which you then multiply your target point vector by, yielding a new vector.
  var multiplicationResult = new Cesium.Cartesian3();
  Cesium.Cartesian3.multiplyComponents(effTarget, endPoint, multiplicationResult)
  console.log("Multiplication result: " + multiplicationResult)
  
  //Normalize that vector
  var normalizationResult = new Cesium.Cartesian3();
  Cesium.Cartesian3.normalize(multiplicationResult, normalizationResult);
  console.log("Normalize result: " + normalizationResult)
  
  //and then the elevation angle is simply asin(z) of the normalized vector.
  var elevationAngle = Math.asin(normalizationResult.z)
  console.log("Elevation angle: " + elevationAngle)
  </code></pre>