Conversion between spherical coordinate system and rectangular coordinate system

Spherical coordinate system (r, θ, φ) ---> Cartesian coordinate system (x, y, z)

x=rsinθcosφ

y=rsinθsinφ

z=rcosθ

Cartesian coordinate system (x, y, z) ---> Spherical coordinate system (r, θ, φ)

r= sqrt(x^2 + y^2 + z^2)

φ= arctan(y/x)

θ= arcs(z/r)

Guess you like

Origin blog.csdn.net/weixin_49617318/article/details/133267789