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
评论列表
文章目录