共计 380 个字符,预计需要花费 1 分钟才能阅读完成。
// 计算地位
function calcPosition(lng, lat, alt) {var phi = (90-lat)*(Math.PI/180),
theta = (lng+180)*(Math.PI/180),
radius = alt+200,
x = -(radius * Math.sin(phi) * Math.cos(theta)),
z = (radius * Math.sin(phi) * Math.sin(theta)),
y = (radius * Math.cos(phi));
return {x: x, y: y, z: z};
}
调用
calcPosition(114.662688, 30.791616, 3459); // {x: -1311.5833759459222, y: 1873.1049219485822, z: -2856.4852527738162}
欢送关注:http://fenxianglu.cn/
正文完