请选择 进入手机版 | 继续访问电脑版

01BIM社区

 找回密码
 立即注册

扫一扫,访问微社区

查看: 7322|回复: 3

Cesium坐标系

[复制链接]

155

主题

643

帖子

2531

积分

金牌会员

Rank: 6Rank: 6

积分
2531
发表于 2022-6-19 20:22:16 | 显示全部楼层 |阅读模式
<Cesium坐标系>

2022年6月19日


回复

使用道具 举报

155

主题

643

帖子

2531

积分

金牌会员

Rank: 6Rank: 6

积分
2531
 楼主| 发表于 2022-6-19 20:35:31 | 显示全部楼层
本帖最后由 tzbm123456 于 2022-7-27 11:58 编辑

一、弧度角度转换:
1、弧度 -> 角度:Cesium.Math.toDegrees(Math.PI)
2、度 -> 度:Cesium.Math.toRadians(180)
二、获取地理坐标:
1、笛卡尔坐标 -> 地理坐标:Cesium.Cartographic.fromCartesian(cartesian3)
2、度 -> 地理坐标Cesium.Cartographic.fromDegrees(130,37,height)
3、弧度 -> 地理坐标Cesium.Cartographic.fromDegrees(Math.PI,Math.PI/4,height)
4、创建地理坐标:new Cesium.Cartographic(Math.PI,Math.PI/4,height)
三、获取笛卡尔坐标:
1、地理坐标 -> 笛卡尔坐标:Cesium.Cartographic.toCartesian(cartoGraphic)
2、经纬度值 -> 笛卡尔坐标Cesium.Cartesian3.fromDegrees(130,37,height)
3、经纬度值数组(不带高度) -> 笛卡尔坐标数组Cesium.Cartesian3.fromDegreesArray([130,37,128,34])
4、经纬度值数组(带高度) -> 笛卡尔坐标数组Cesium.Cartesian3.fromDegreesArrayHeights([130,37,100000,128,34,150000])
5、数值 -> 笛卡尔坐标Cesium.Cartesian3.fromElements(x, y, z, result)
6、创建笛卡尔坐标:new Cesium.Cartesian3(x, y, z)
四、屏幕坐标转笛卡尔坐标:
    var pick = mouseClick.position;
//相机到点击点的射线和地球表面的交点
    var cartesian = viewer.scene.globe.pick(viewer.camera.getPickRay(pick), viewer.scene);
    var ellipsoid = viewer.scene.globe.ellipsoid;
    var cartographic = ellipsoid.cartesianToCartographic(cartesian);
    var lat = Cesium.Math.toDegrees(cartographic.latitude);
    var lon = Cesium.Math.toDegrees(cartographic.longitude);
    var alt = cartographic.height;
    console.log('经度:' + lon + '\n纬度:' + lat + '\n高度:' + alt);
//获取点击点的位置坐标
        position = viewer.scene.pickPosition(pick );
        cartographicNew=Cesium.Cartographic.fromCartesian(position);












回复 支持 反对

使用道具 举报

155

主题

643

帖子

2531

积分

金牌会员

Rank: 6Rank: 6

积分
2531
 楼主| 发表于 2022-7-6 07:42:44 | 显示全部楼层
本帖最后由 tzbm123456 于 2022-7-6 08:50 编辑

Cesium.Transforms.eastNorthUpToFixedFrame(origin, ellipsoid, result)
   Computes a 4x4 transformation matrix from a reference frame with an east-north-up axes centered at the provided origin to the provided ellipsoid's fixed reference frame. The local axes are defined as:
   The x axis points in the local east direction.
   The y axis points in the local north direction.
   The z axis points in the direction of the ellipsoid surface normal which passes through the position.


   Name        Type        Default        Description
   origin        Cartesian3                The center point of the local reference frame.
   ellipsoid        Ellipsoid        Ellipsoid.WGS84        optionalThe ellipsoid whose fixed frame is used in the transformation.
   result        Matrix4                optionalThe object onto which to store the result.
   Returns:
   The modified result parameter or a new Matrix4 instance if none was provided.
Example:
// Get the transform from local east-north-up at cartographic (0.0, 0.0) to Earth's fixed frame.
            const center = Cesium.Cartesian3.fromDegrees(0.0, 0.0);
          const transform = Cesium.Transforms.eastNorthUpToFixedFrame(center);

//坐标转换方式:
        const p = new Cesium.Cartesian3(250.0, 0.0, 0.0);
        const result = Cesium.Matrix4.multiplyByPoint(transform, p, new Cesium.Cartesian3());
//result为Cartesian3坐标


回复 支持 反对

使用道具 举报

155

主题

643

帖子

2531

积分

金牌会员

Rank: 6Rank: 6

积分
2531
 楼主| 发表于 2022-10-14 17:10:54 | 显示全部楼层
QQ图片20221014171028.png
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|01BIM社区 - 最专业的BIM技术交流平台 ( 渝ICP备15000873号 )

GMT+8, 2024-3-29 02:07 , Processed in 0.050271 second(s), 24 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表