• Cesium相机参数 如何获取相机的高度、经纬度和姿态角


    第一视角

    Cesium中的相机—四元素:https://blog.csdn.net/u011575168/article/details/83034048

    Cesium官方教程6--相机:https://www.cnblogs.com/cesium1/p/10063020.html

    相机的高度和飞机的高度不同。。。

    利用:

    viewer.camera.flyTo({
      destination : Cesium.Cartesian3.fromDegrees(lng, lat,alt),
      orientation : {
          heading : Cesium.Math.toRadians(0.0),
          pitch : Cesium.Math.toRadians(-90.0),
          roll : 0.0
      }
    });
    得到的相机高度与传入的alt高度不同。。
    获取相机高度:viewer.camera.positionCartographic.height
    获取相机的位姿:
    var handler = new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
    handler.setInputAction(click => {
    this.viewer.clock.onTick.removeEventListener(onTickCallback);
    
    //查看当前视角的 x,y,z,heading,pitch,roll值
    var e = click;
    var position = this.viewer.scene.pickPosition(e.position);
    //将笛卡尔坐标转化为经纬度坐标
    var cartographic = Cesium.Cartographic.fromCartesian(position);
    var x = Cesium.Math.toDegrees(cartographic.longitude);
    var y = Cesium.Math.toDegrees(cartographic.latitude);
    var z = cartographic.height;
    var h = this.viewer.scene.camera.heading;
    var p = this.viewer.scene.camera.pitch;
    var r = this.viewer.scene.camera.roll;
    handler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK)
    }, Cesium.ScreenSpaceEventType.LEFT_CLICK);

    参考:https://blog.csdn.net/qq_29808089/article/details/108464481

    >>参考:UAV-simulation: 基于Cesium的无人机飞行模拟 (https://gitee.com/KivenGood/uav-simulation)

    //移动模型
            function moveModel() {
                //  tempLng += (step * correction);
                // tempLat -= (step * Math.sin(tempHeading)); //主要用来左右移动
    
                //tempLat += step
    
                tempLat = +msg[0].GPS_LAT_CA - 10;
                tempLng = +msg[0].GPS_LONG_CA - 3.5;
                //  tempHeight = +msg[0].ALT_STD+1000;
                tempHeight = 2000;
                //  tempRoll = +msg[0].ROLL_RATE1;
                localStorage.setItem("msg", JSON.stringify(msg[0]));
                console.log("localStorage:" + JSON.stringify(JSON.parse(localStorage.getItem("msg"))));
                console.log("msg.length1:" + msg.length);
                console.log("***tempLng:" + tempLng);
                console.log("***tempLat:" + tempLat);
                console.log("***tempHeight:" + tempHeight);
                console.log("***tempHeading:" + tempHeading);
                console.log("***tempPitch:" + tempPitch);
                console.log("*** tempRoll:" + tempRoll);
                var position = myCesium.Cartesian3.fromDegrees(tempLng, tempLat, tempHeight);
                var hpr = new myCesium.HeadingPitchRoll(tempHeading, tempPitch, tempRoll);
                var orientation = myCesium.Transforms.headingPitchRollQuaternion(position, hpr);
                myEntity.orientation = orientation;
                myEntity.position = position;
                msg.shift();
                console.log("!!!!msg[0].id" + msg[0].id);
                //受异步请求影响,state相当于一个锁,当数据请求结束才开锁
                if (msg.length < 100 && state == 0) {
                    console.log("!!!!!!");
                    state = 1;
                    readData();
                }
                document.getElementById('msg').innerHTML = "tempLng:" + tempLng;
                document.getElementById('msg1').innerHTML = "tempLat:" + tempLat;
                document.getElementById('msg2').innerHTML = "tempPitch:" + tempPitch;
                document.getElementById('msg3').innerHTML = "tempHeight:" + parseInt(tempHeight);
                document.getElementById('msg4').innerHTML = "tempHeading:" + tempHeading;
                document.getElementById('msg5').innerHTML = "tempRoll:" + tempRoll;
                //    document.getElementById('msg6').innerHTML = "step:" + step;
                document.getElementById('msg7').innerHTML = "correction:" + correction;
            }
  • 相关阅读:
    Android实战技巧之六:PreferenceActivity使用详解
    Gradle for Android 第三篇( 依赖管理 )
    From 虚拟机模板 创建单节点K8S1.14.1的操作步骤
    Android实例剖析笔记(二)
    Android实例剖析笔记(一)
    Android 传感器
    Eclipse:引用一个项目作为类库(图文教程)
    Android Studio导入Project的方法
    Android Studio导入GitHub上的项目常见问题(有例子)
    AndroidStudio导入项目常见问题
  • 原文地址:https://www.cnblogs.com/2008nmj/p/15464735.html
Copyright © 2020-2023  润新知