datasets.py 文件源码

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

项目:augment3D 作者: yulkang 项目源码 文件源码
def _samp_sphere(self, radius = 1):
        # from http://stackoverflow.com/a/5408843/2565317

        if radius is not np.array:
            radius = np.array(radius)

        n = radius.size

        phi = np.random.rand(n) * 2 * np.pi
        costheta = np.random.rand(n) * 2 - 1
        u = np.random.rand(n)

        theta = np.arccos( costheta )
        r = radius * u ** (1. / 3)

        x = r * np.sin(theta) * np.cos(phi)
        y = r * np.sin(theta) * np.sin(phi)
        z = r * np.cos(theta)

        return x, y, z

#%%
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号