如何将纬度和经度映射到 3D 球体 [英] how to map latitude and longitude to a 3D Sphere
本文介绍了如何将纬度和经度映射到 3D 球体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试将经纬度坐标映射到 3d 球体上.
Trying to map coordinates with latitude and longitude onto a 3d sphere.
我从互联网上尝试了三组不同的方程式,但都没有奏效.有谁知道怎么做.
I've tried three different sets of equations from the internet and none of them work. Does anyone know how to do it.
这些是我试过但没有用的.
These are the ones I tried that didn't work.
var phi = (90-lat)*(Math.PI/180),
theta = (lon+180)*(Math.PI/180),
x = -((radius) * Math.sin(phi)*Math.cos(theta)),
z = ((radius) * Math.sin(phi)*Math.sin(theta)),
y = ((radius) * Math.cos(phi));
return new THREE.Vector3(x,y,z);
var height = 600;
var phi = (lat)*Math.PI/180;
var theta = (lon-180)*Math.PI/180;
var x = -(radius+height) * Math.cos(phi) * Math.cos(theta);
var y = (radius+height) * Math.sin(phi);
var z = (radius+height) * Math.cos(phi) * Math.sin(theta);
return new THREE.Vector3(x,y,z);
var x = Math.cos(lon) * Math.sin(lat),
y = Math.sin(lon) * Math.sin(lat),
z = Math.cos(lat);
return new THREE.Vector3(x,y,z);
推荐答案
嗯,这个确实有效!
var phi = (90-lat)*(Math.PI/180),
theta = (lon+180)*(Math.PI/180),
x = -((radius) * Math.sin(phi)*Math.cos(theta)),
z = ((radius) * Math.sin(phi)*Math.sin(theta)),
y = ((radius) * Math.cos(phi));
return new THREE.Vector3(x,y,z);
这篇关于如何将纬度和经度映射到 3D 球体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文