使用等矩形投影将三维坐标映射到二维坐标

2024-10-03 00:20:44 发布

您现在位置:Python中文网/ 问答频道 /正文

我目前正在研究eeg信号,所以这里基本上我们有电极,放在人的头上,我们得到每个电极的3d坐标,所以基本上我试图从这些3d坐标中找到2d坐标,但借助于等矩形投影(与我们在平面纸上投影地球仪的方式相同)。 以下是几个链接,以便于更好地理解: https://www.earthdatascience.org/courses/use-data-open-source-python/intro-vector-data-python/spatial-data-vector-shapefiles/geographic-vs-projected-coordinate-reference-systems-python/

https://www.coursera.org/lecture/introduction-gis-mapping/associating-points-from-3d-to-2d-y7kIx

https://mathworld.wolfram.com/MercatorProjection.html


Tags: httpsorgdata信号链接www方式电极
1条回答
网友
1楼 · 发布于 2024-10-03 00:20:44

我认为应该是以下内容,但也许您可以确认这是否正确:

import math

def cartesian_to_spherical(x,y,z):
    r=math.sqrt(x**2+y**2+z**2)
    theta=math.acos(z/r)
    phi=math.atan(y/x)
    return r,theta,phi

def spherical_to_mercator(r,theta,phi):
    x=theta
    y=0.5*math.log((1+math.sin(phi))/(1-math.sin(phi)))
    return x,y


r,theta,phi=cartesian_to_spherical(2,3,1) # fill in your x,y,z here
x,y=spherical_to_mercator(r,theta,phi)
print("x = ",x," y = ",y)

相关问题 更多 >