当前位置:   article > 正文

Cesium笔记 获取当前视角的坐标以及偏航角等信息

cesium
  1. const getCameraInfo = () => {
  2. let viewer = Viewer.value;
  3. const camera = viewer.scene.camera;
  4. const cartographic = Cesium.Cartographic.fromCartesian(camera.position);
  5. const x = Cesium.Math.toDegrees(cartographic.longitude);
  6. const y = Cesium.Math.toDegrees(cartographic.latitude);
  7. const z = cartographic.height;
  8. let heading = Cesium.Math.toDegrees(camera.heading);
  9. let pitch = Cesium.Math.toDegrees(camera.pitch);
  10. let roll = Cesium.Math.toDegrees(camera.roll);
  11. let pt = Cesium.Cartographic.fromDegrees(x, y, z);
  12. let ellipsoid = viewer.scene.globe.ellipsoid;
  13. let cartesian3 = ellipsoid.cartographicToCartesian(pt);
  14. let objInfo = {
  15. longitude: x,
  16. latitude: y,
  17. height: z,
  18. x: cartesian3.x,
  19. y: cartesian3.y,
  20. z: cartesian3.z,
  21. heading: heading,
  22. pitch: pitch,
  23. roll: roll
  24. };
  25. console.log(objInfo);
  26. }

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/564027
推荐阅读
相关标签
  

闽ICP备14008679号