Comments (1)
cesium的经纬度,与cesium的xyz 适配:
- 确定一个 cesium的 经纬度中心点.(index.html 25 26行)
- 创建一个 three模型, 位置为0,0,0 绕X轴旋转负半周(因为three 横X 纵Z 深Y,所以要将Z朝上)(index.html 146 163行)
- 模型创好了,cesium的中心点创好了,此时认为 three 跟 cesium的原点 为同一个, 在同步渲染时,
- 使用" Cesium.Cartesian3.fromDegrees "(参数为:经度 纬度 高度)计算出在cesium中的位置,(使能够与cesium的视角相同)(index.html 195行)
- 使用三维向量(new THREE.Vector3)计算出该模型的朝向(up)(index.html 192 至 208行)
如何把threeJs绘制的对象放在地表下:
- 正常创建threeJs 模型,同步渲染的时候,Cesium.Cartesian3.fromDegrees的第三个参数为高度.(https://cesium.com/learn/cesiumjs/ref-doc/Cartesian3.html?classFilter=Cartesian3 关键词:fromDegree)
- 因为是 画布叠加,所以three模型永远会显示在cesium之上, 需要将模型的位置(经纬度) 代入地表海拔高度以Cesium.Cartesian3.fromDegree 拿到z轴,小于该Z轴的 则是地表以下, 将地表以下的模型部分隐藏 则不会出现地表以下的模型还显示在地表(cesium图层)上的效果
- 如果面积较大(跨纬度),可能存在误差,因为地球是球形,地表是曲面,而 three的坐标又是三维坐标, 所以会存在误差,需要使用笛卡尔坐标或对部分点单独做计算,而不是做整个模型的Z轴计算.
from cesiumthreejs.demo.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cesiumthreejs.demo.