zoukankan      html  css  js  c++  java
  • cesium3dtiles位置改变

    cesium偏移3dtiles高度
    var heightOffset = 20.0; var boundingSphere = tileset.boundingSphere; var cartographic = Cesium.Cartographic.fromCartesian(boundingSphere.center); var surface = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 0.0); var offset = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, heightOffset); var translation = Cesium.Cartesian3.subtract(offset, surface, new Cesium.Cartesian3()); tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation);


    cesium设置3dtiles位置朝向
    var targetPosition = Cesium.Cartesian3.fromDegrees(121.46175, 31.40674, 0);
    var headingPitchRoll = new Cesium.HeadingPitchRoll(0, 0, 0);
    var modelMatrix = new Cesium.Matrix4();
    Cesium.Transforms.headingPitchRollToFixedFrame(targetPosition, headingPitchRoll, Cesium.Ellipsoid.WGS84, Cesium.Transforms.eastNorthUpToFixedFrame, modelMatrix);
    tileset.modelMatrix =modelMatrix;
    viewer.camera.flyTo({
    destination:tileset.boundingSphere.center
    });
     
    cesium添加实体并设置位置朝向

    var position = Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706, height);
    var heading = Cesium.Math.toRadians(135);
    var pitch = 0;
    var roll = 0;
    var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
    var orientation = Cesium.Transforms.headingPitchRollQuaternion(position, hpr);

    var entity = viewer.entities.add({
    name : url,
    position : position,
    orientation : orientation,
    model : {
    uri : url,
    minimumPixelSize : 128,
    maximumScale : 20000
    }
    });
    viewer.trackedEntity = entity;

     



  • 相关阅读:
    教程:如何手动安装Xamarin与Xamarin for VisualStudio
    安装matplotlib
    pycharm中文专业版安装使用
    在win7下安装PowerShell 5.0遇到的坑
    1997-2017
    系统界面截图
    组态与非组态结合的LT
    opencv mat转qimage
    QTableWidget 样式文件
    hiredis window 源码编译
  • 原文地址:https://www.cnblogs.com/943711466qq/p/9535347.html
Copyright © 2011-2022 走看看