使用cesiumjs,我想计算两点之间的仰角,就好像我们站在第一个点的热气球上一样。点是简单的制图点(纬度,长度,高度)。使用cesiumjs计算两个lat/long/alt点之间的仰角
一些经过研究,这是一个建议的方法:
改变你的目标点在地球固定框架这个地方 水平面,你可以使用Transforms.eastNorthUpToFixedFrame。 返回一个Matrix4,然后将您的目标点数乘以 ,产生一个新的向量。标准化该矢量,然后将仰角简化为标准化矢量的asin(z)。
这是我放在一起的代码,但它为乘法返回NaN。任何建议将不胜感激。
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)
你尝试我所提供的答案吗? – ethorn10
你好,是的,但不幸的是它没有工作。还是)感谢你的建议 – Fidel