spherical_voronoi.py 文件源码

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

项目:scikit-discovery 作者: MITHaystack 项目源码 文件源码
def sphericalToXYZ(lat,lon,radius=1):
    ''' 
    Convert spherical coordinates to x,y,z

    @param lat: Latitude, scalar or array
    @param lon: Longitude, scalar or array
    @param radius: Sphere's radius

    @return Numpy array of x,y,z coordinates
    '''
    phi = np.deg2rad(90.0 - lat)
    theta = np.deg2rad(lon % 360)
    x = radius * np.cos(theta)*np.sin(phi)
    y = radius * np.sin(theta)*np.sin(phi)
    z = radius * np.cos(phi)

    if np.isscalar(x) == False:
        return np.vstack([x,y,z]).T
    else:
        return np.array([x,y,z])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号