spherical_voronoi.py 文件源码

python
阅读 42 收藏 0 点赞 0 评论 0

项目:scikit-discovery 作者: MITHaystack 项目源码 文件源码
def xyzToSpherical(x,y,z):
    ''' 
    Convert x,y,z to spherical coordinates

    @param x: Cartesian coordinate x
    @param y: Cartesian coordinate y
    @param z: Cartesian coordinate z

    @return numpy array of latitude,longitude, and radius
    '''
    radius = np.sqrt(x**2 + y**2 + z**2)
    theta = np.rad2deg(np.arctan2(y,x))
    phi = np.rad2deg(np.arccos(z/radius))
    # lon = (theta + 180) % 360 - 180
    # lon = (theta + 360) % 360
    lon = theta
    lat = 90 - phi

    return np.array([lat,lon,radius]).T
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号