Point.py 文件源码

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

项目:nimo 作者: wolfram2012 项目源码 文件源码
def asSpherical(self):
        ''' 
        Computes and returns a representation of this point in spherical coordinates: (r,phi,theta). 

        r = radius or distance of the point from the origin.
        phi = is the angle of the projection on the xy plain and the x axis
        theta = is the angle with the z axis.

        x = r*cos(phi)*sin(theta)
        y = r*sin(phi)*sin(theta)
        z = r*cos(theta)
        '''
        x,y,z,_ = self.asArray()

        r = np.sqrt(x**2+y**2+z**2)
        phi = np.arctan2(y,x)
        theta = np.arctan2(np.sqrt(x**2+y**2),z)

        return r,phi,theta
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号