经纬度高度转ThreeJS的xyz坐标丨技术开发分享录

经纬度高度转ThreeJS的xyz坐标

{{ detail.nickname }}

转载 翻译 {{ formatTime(detail.create_time) }} 字数 {{ detail.content && detail.content.length }} 阅读 {{ detail.read_num }} {{ formatTag(v) }}

"```\n// 计算位置\nfunction calcPosition(lng, lat, alt) {\n    var phi = (90-lat)*(Math.PI/180),\n        theta = (lng+180)*(Math.PI/180),\n        radius = alt+200,\n        x = -(radius * Math.sin(phi) * Math.cos(theta)),\n        z = (radius * Math.sin(phi) * Math.sin(theta)),\n        y = (radius * Math.cos(phi));\n    return {x: x, y: y, z: z};\n}\n```\n\n调用\n\n```\ncalcPosition(114.662688, 30.791616, 3459); // {x: -1311.5833759459222, y: 1873.1049219485822, z: -2856.4852527738162}\n```"
PS:写作不易,如要转裁,请标明转载出处。

如果此篇对您有帮助,可小额赞助,以兹鼓励!

猜你想看