如何映射二维网格点(X,Y)上作为球体的3D点(X,Y,Z) [英] how map 2d grid points (x,y) onto sphere as 3d points (x,y,z)

查看:231
本文介绍了如何映射二维网格点(X,Y)上作为球体的3D点(X,Y,Z)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一组二维网格点(X,Y),我要地图/项目到一个球体三维点(X,Y,Z)的。

I have a set of 2d grid points (x,y) that I want to map/project onto a sphere as 3d points (x,y,z).

我知道会有一些扭曲向两极如ABS(Y)上升,但我的网格补丁将只能覆盖赤道附近如此严重扭曲将避免球体的一部分。

I realize there will be some warping towards the poles as abs(y) increases but my grid patch will only cover a portion of the sphere near the equator so severe warping will be avoided.

我无法找到正确的公式为。

I'm having trouble finding the right equations for that.

推荐答案

从墨卡托投影维基百科的文章转述:

Paraphrased from the wikipedia article on Mercator projection:

Given a "mapping sphere" of radius R,
the Mercator projection (x,y) of a given latitude and longitude is:
   x = R * longitude
   y = R * log( tan( (latitude + pi/2)/2 ) )

and the inverse mapping of a given map location (x,y) is:
  longitude = x / R
  latitude = 2 * atan(exp(y/R)) - pi/2

您可以通过逆映射的结果的三维坐标:

To get the 3D coordinates from the result of the inverse mapping:

Given longitude and latitude on a sphere of radius S,
the 3D coordinates P = (P.x, P.y, P.z) are:
  P.x = S * cos(latitude) * cos(longitude)
  P.y = S * cos(latitude) * sin(longitude)
  P.z = S * sin(latitude)

(请注意,地图半径和3D半径将几乎肯定有不同的价值观,所以我使用了不同的变量名。)

(Note that the "map radius" and the "3D radius" will almost certainly have different values, so I have used different variable names.)

这篇关于如何映射二维网格点(X,Y)上作为球体的3D点(X,Y,Z)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆