cesium mars3d screenPointToMap.txt

1. cesium 方法
viewer.scene.pickPosition(windowPosition, result) → Cartesian3 Scene/Scene.js 3486
Returns the cartesian position reconstructed from the depth buffer and window position.
The position reconstructed from the depth buffer in 2D may be slightly different from those reconstructed in 3D and Columbus view. This is caused by the difference in the distribution of depth values of perspective and orthographic projection.

Set Scene#pickTranslucentDepth to true to include the depth of translucent primitives; otherwise, this essentially picks through translucent primitives.

Name           Type       Description
windowPosition Cartesian2 Window coordinates to perform picking on.
result         Cartesian3 optional The object on which to restore the result.
Returns:
The cartesian position.
Throws:
DeveloperError : Picking from the depth buffer is not supported. Check pickPositionSupported.

2. mars3d 方法
let wheelingPosition = {};
// 给$(".cesium-viewer")元素添加 mousemove 事件。
$(".cesium-viewer").on("mousemove", function (event) {
    /*功能:获取鼠标的实时位置。*/
    wheelingPosition.x = event.clientX;
    wheelingPosition.y = event.clientY;
    // console.log("wheelingPosition:", wheelingPosition);
    // wheelingPosition: {x: 139, y: 312}
});
// 获取鼠标位置(笛卡尔坐标系,即,地球直角坐标系)。
let Cartesian3_CurrentMousePosition = mars3d.point.getCurrentMousePosition(viewer.scene, wheelingPosition);
// console.log("Cartesian3_CurrentMousePosition:", Cartesian3_CurrentMousePosition);
// Cartesian3_CurrentMousePosition: a {x: -2308816.906348081, y: 4393127.8631515205, z: 3992865.6356029827}






  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值